Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Stupid Newbie Question

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT ibiblio.org>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Stupid Newbie Question
  • Date: Sun, 15 Mar 2015 17:19:22 -0400

The white space in between elements is also a child and gets counted.

On Sat, Mar 14, 2015 at 12:26 AM, <tcdfemgdnf AT snkmail.com> wrote:

> 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
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>
>


--
Elliotte Rusty Harold
elharo AT ibiblio.org




Archive powered by MHonArc 2.6.24.

Top of Page