Question about parsing xml attributes using DOM

P

phantom

Hi all.

I have a xml file as

<?xml version="1.0" ?>
<INFO name="" orderno="123" type="abc" status="done">
<info1 .... some more information/>
</INFO>

I am using a DOM parser and the NamedNodeMap to get the attributes,
the problem is the order of the attributes does matter in the
processing and the data structure stores the attributes in an
alphabetized format, what i want is the attributes be stored in the
way they were received. I would appreciate all suggestions/pointers
for the same.

Thanks
Sid
 
A

Andy Fish

phantom said:
Hi all.

I have a xml file as

<?xml version="1.0" ?>
<INFO name="" orderno="123" type="abc" status="done">
<info1 .... some more information/>
</INFO>

I am using a DOM parser and the NamedNodeMap to get the attributes,
the problem is the order of the attributes does matter in the
processing and the data structure stores the attributes in an
alphabetized format, what i want is the attributes be stored in the
way they were received. I would appreciate all suggestions/pointers
for the same.

don't use XML. that's your only option, simple as that
 
L

Lutz Horn

Hi,
the problem is the order of the attributes does matter in the
processing and the data structure stores the attributes in an
alphabetized format, what i want is the attributes be stored in the
way they were received.

That's not possible since attributes form a set with no order.

"Note that the order of attribute specifications in a start-tag or
empty-element tag is not significant."[1]

Regards
Lutz

[1] http://www.w3.org/TR/2004/REC-xml-20040204/#sec-starttags
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top