Both of the following are well-formed according to the syntactical rules of XML:

<client>
<name>Sally</name>
<child>
<name>Peter</name>
</child>
<child>
<name>Jill</name>
</child>
</client>

OR

<client>
<name>Sally</name>
<children>
<child>
<name>Peter</name>
</child>
<child>
<name>Jill</name>
</child>
</children>
</client>

You can validate both of the above using the w3Schools online validator:
http://www.w3schools.com/xml/xml_validator.asp

Which of the two you decide to use will therefore depend on which is most convenient given your situation (e.g., which XML parser you are using, whether or not the XML file will be used with other technologies like JSON or xslt, and so forth).

Thanks,

Kelly Cookson
Senior Programmer/Analyst
Dot Foods, Inc.
217-773-4486 x12676
www.dotfoods.com


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of hr@xxxxxxxxxxxx
Sent: Tuesday, March 09, 2010 2:00 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Basic question on XML structure

Nathan,

im' sorry but you are wrong, <children> defines an array of childs, try to
express my second
enhanced example in JSON - it is impossible




Nathan Andelin <nandelin@xxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
09-03-2010 20:05
Please respond to
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>


To
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>
cc

Subject
Re: [WEB400] Basic question on XML structure






I should admit that an XML parser wouldn't have any trouble with parsing
either document, and should also admit that the extra <children> node
created by the first structure may not be necessary, but I think it makes
reading and document with the naked eye more intuitive, and reading the
source code for processing the parsed node tree more intuitive, because
the <children> node organizes the data similar to normalized database
structures.

-Nathan.




----- Original Message ----
From: David FOXWELL <David.FOXWELL@xxxxxxxxx>
To: Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>
Sent: Tue, March 9, 2010 10:12:45 AM
Subject: [WEB400] Basic question on XML structure

Hi all,

A little inexperienced in xml here.

Compare these 2 structures :

<client>
<name>bill</name>
<children>
<child>
<name>jon</name>
</child>
<child>
<name>joe</name>
</child>
</children>
</client>

<client>
<name>bill</name>
<child>
<name>jon</name>
</child>
<child>
<name>joe</name>
</child>
</client>

Are there any advantages or disadvantages to using or not using the
element <children>?

We do not use attributes.


Thanks.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.