Discussion:
[XOM-interest] Stupid Newbie Question
t***@snkmail.com
2015-03-14 04:26:28 UTC
Permalink
Greetings all,

Sorry if this is a stupid question but I'm new to XML and trying to
figure out how to export a XML file from my Java app.
I'm using XOM-1.2.10 and Java JRE 1.8.0_31-b13. My program (not
production quality) writes the attached stuff.xml which I believe looks
reasonable, but when I try to read it, line 73 /int kids =
record.getChildCount();///sets kids to 9. I don't understand why since I
attach 4 elements to the "record" element.

BTW, I just added the serial number to the "record" element because I
was seeing unexpected behavior. I'd like to remove it and have just
<file ...>
<record>
<field id="1stfieldName">1stvalue</field>
<field id="2ndfieldName">2nd field value</field>
<field id="3rdfieldName">3rdfield value</field>
<record>
<record>
<field id="1stfieldName">1stvalue</field>
<field id="2ndfieldName">2nd field value</field>
<field id="3rdfieldName">3rdfield value</field>
<record>
</file>

Am I on the right track or do I need to learn a lot more about XML
before I try this in the real world?

TIA for whatever advice I can get.
Elliotte Rusty Harold
2015-03-15 21:19:22 UTC
Permalink
The white space in between elements is also a child and gets counted.
Post by t***@snkmail.com
Greetings all,
Sorry if this is a stupid question but I'm new to XML and trying to figure
out how to export a XML file from my Java app.
I'm using XOM-1.2.10 and Java JRE 1.8.0_31-b13. My program (not
production quality) writes the attached stuff.xml which I believe looks
reasonable, but when I try to read it, line 73 /int kids =
record.getChildCount();///sets kids to 9. I don't understand why since I
attach 4 elements to the "record" element.
BTW, I just added the serial number to the "record" element because I was
seeing unexpected behavior. I'd like to remove it and have just
<file ...>
<record>
<field id="1stfieldName">1stvalue</field>
<field id="2ndfieldName">2nd field value</field>
<field id="3rdfieldName">3rdfield value</field>
<record>
<record>
<field id="1stfieldName">1stvalue</field>
<field id="2ndfieldName">2nd field value</field>
<field id="3rdfieldName">3rdfield value</field>
<record>
</file>
Am I on the right track or do I need to learn a lot more about XML before
I try this in the real world?
TIA for whatever advice I can get.
_______________________________________________
XOM-interest mailing list
http://lists.ibiblio.org/mailman/listinfo/xom-interest
--
Elliotte Rusty Harold
***@ibiblio.org
Loading...