Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Question about parsing xml attributes using DOM

Reply
Thread Tools

Question about parsing xml attributes using DOM

 
 
phantom
Guest
Posts: n/a
 
      05-11-2004
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
 
Reply With Quote
 
 
 
 
Andy Fish
Guest
Posts: n/a
 
      05-11-2004

"phantom" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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

> Thanks
> Sid



 
Reply With Quote
 
 
 
 
Lutz Horn
Guest
Posts: n/a
 
      05-11-2004
Hi,

phantom wrote:
> 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-20...#sec-starttags
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing XML and storing attributes in MySQL using Perl jkugler Perl Misc 5 06-12-2006 11:32 PM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Clarification on XML parsing & namespaces (xml.dom.minidom) Greg Wogan-Browne Python 1 01-28-2005 03:19 AM
XML Parsing problem using DOM Parser: HELP NEEDED burn_hall Python 0 05-31-2004 08:27 PM
parsing XML to DOM, validating against a local DTD, using Xerces under JAXP? bugbear XML 0 08-28-2003 09:22 AM



Advertisments