473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

sequence of XML elements

Can someone please clarify the in which XML standard (and various parsers)
handle sequence of elements in XML?

1. Are the following two documents same (syntactically and sematically)?
a.
<Data>
<InitialQualifier>xyz</InitialQualifier>
<Value>678</Value>
<Value>524</Value>
</Data>
b.
<Data>
<InitialQualifier>xyz</InitialQualifier>
<Value>524</Value>
<Value>678</Value>
</Data>
2. Do parsers (JDOM, MSXML, etc, etc) guarantee that the sequence of
elements at a given level in hierarchy (like the <Value> elements in the
above example) will be preserved when the file is loaded,
processed(edited) and saved back?
3. Any comments on the following:
<Data>
<Year>2001</Year>
<Month>06</Month> <--implies Jun-2001-->
<Month>05</Month> <--implies May-2002-->
<Month>07</Month> <--implies Jul-2003-->
</Data>
Jul 20 '05 #1
1 1331


Jonas Hei wrote:

1. Are the following two documents same (syntactically and sematically)?
a.
<Data>
<InitialQualifier>xyz</InitialQualifier>
<Value>678</Value>
<Value>524</Value>
</Data>
b.
<Data>
<InitialQualifier>xyz</InitialQualifier>
<Value>524</Value>
<Value>678</Value>
</Data>
No, the documents are not the same, the order of elements matters, see
for instance the XML information set specification
http://www.w3.org/TR/xml-infoset/#infoitem.element
2. Do parsers (JDOM, MSXML, etc, etc) guarantee that the sequence of
elements at a given level in hierarchy (like the <Value> elements in
the above example) will be preserved when the file is loaded,
processed(edited) and saved back?


In the DOM (document object model) the order of child nodes matters and
is preserved when saving back (serializing the DOM tree).

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: dan | last post by:
I was recently surprised, and quite shocked in fact, to find that Python treats negative indices into sequence types as if they were mod(length-of-sequence), at least up to -len(seq). This fact...
1
by: Thu | last post by:
I export some database data to an XML file. How do I change the sequence of the elements (fields) appear in the XML document? For example, my XML output from TableA is: <TableA> <Field(0)>...
2
by: shumaker | last post by:
I designed a schema in VS C# 2005 Express and am wondering why it chooses to place a sequence tag around the elements of a table. And additionally, if I move the elements around within the table,...
2
by: klikic | last post by:
Hi. How can create a unordered sequence with defined elements that can occur ones and "other" elements that are ignored. Example: XML: <Recur> <ignoredElement>saasda</ignoredElement>...
7
by: desktop | last post by:
In the C++ standard page 472 it says that you can construct a std::set in linear time if the constructor gets a sorted sequence of elements. But how is this possible when insert takes logarithmic...
21
by: bilgekhan | last post by:
After doing a succcessful insert() or find() on a set<Tcontainer is it possible to get the item number of this item in the set? (ie. its zero-based sequence number (position/location/rank/index)...
0
by: ChipR | last post by:
Is there any way to specify a sequence with one or more elements that can be repeated like <complexType name="element_type"> <sequence> <element name="A" type="string"/> <element...
9
by: Mr.SpOOn | last post by:
Hi, I'm trying to create a class which inherit a list to change some behavior. This list should contain other instance objects and has to manage these instances in a particular way. 1) I need...
8
by: Slaunger | last post by:
Hi all, I am a Python novice, and I have run into a problem in a project I am working on, which boils down to identifying the patterns in a sequence of integers, for example ..... 1 6 6 1 6 6...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.