Proyecto crear programa usando flex (XML document)
Budget: €8 – €30 EUR
Using flex create a program to process an XML document
performing the necessary operations so that at the end of the
processed allows the following statistics to be displayed:
- the number of comments.
- the number of empty elements (end without having tags
nested or text inside).
- the name of the tag that contains more attributes and its number.
- the namespace with the longest value and its associated prefix,
if you have it.
The contents of the CDATA sections should be ignored for all
the statistics.
For example, with an input like the following:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE eje PUBLIC "-//cgosorio//DTD eje//ES"
"http://www.hola.es/DTD/eje.dtd" >
<!-- the above processes it without counting -->
<eje>
<etiq1 atr1="v1" atr2='val2' atr3="val3">
text and more text
text and more text
</etiq1> <!-- a closing tag-->
text and more text
text and more text
<!-- this is a comment -->
<etiqueta2/><!-- an empty element -->
<!-- I am going to count this as a beginning and a closing -->
<ns1:etiq2 xmlns:ns1="www.hola.es" at2="val2" at3="val3"></ns1:etiq2>
<![CDATA[
<etiq2 > <!-- I'm not going to count this tag and this comment
for being inside a CDATA section -->
]]>
</eje>
The result should give:
- Comments: 5
- Empty elements: 2
- The label "etiq1" is the one with the most attributes inside: 3.
- The longest namespace value is "hola/" and the associated prefix is "ns1".
It has to work for any xml file.
performing the necessary operations so that at the end of the
processed allows the following statistics to be displayed:
- the number of comments.
- the number of empty elements (end without having tags
nested or text inside).
- the name of the tag that contains more attributes and its number.
- the namespace with the longest value and its associated prefix,
if you have it.
The contents of the CDATA sections should be ignored for all
the statistics.
For example, with an input like the following:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE eje PUBLIC "-//cgosorio//DTD eje//ES"
"http://www.hola.es/DTD/eje.dtd" >
<!-- the above processes it without counting -->
<eje>
<etiq1 atr1="v1" atr2='val2' atr3="val3">
text and more text
text and more text
</etiq1> <!-- a closing tag-->
text and more text
text and more text
<!-- this is a comment -->
<etiqueta2/><!-- an empty element -->
<!-- I am going to count this as a beginning and a closing -->
<ns1:etiq2 xmlns:ns1="www.hola.es" at2="val2" at3="val3"></ns1:etiq2>
<![CDATA[
<etiq2 > <!-- I'm not going to count this tag and this comment
for being inside a CDATA section -->
]]>
</eje>
The result should give:
- Comments: 5
- Empty elements: 2
- The label "etiq1" is the one with the most attributes inside: 3.
- The longest namespace value is "hola/" and the associated prefix is "ns1".
It has to work for any xml file.