Question about parsing xml attributes using DOM

Discussion in 'Java' started by phantom, May 11, 2004.

  1. phantom

    phantom Guest

    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
     
    phantom, May 11, 2004
    #1
    1. Advertising

  2. phantom

    Andy Fish Guest

    "phantom" <> wrote in message
    news:...
    > 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
     
    Andy Fish, May 11, 2004
    #2
    1. Advertising

  3. phantom

    Lutz Horn Guest

    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-20040204/#sec-starttags
     
    Lutz Horn, May 11, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bugbear
    Replies:
    0
    Views:
    1,048
    bugbear
    Aug 28, 2003
  2. burn_hall
    Replies:
    0
    Views:
    333
    burn_hall
    May 31, 2004
  3. Greg Wogan-Browne
    Replies:
    1
    Views:
    839
    Uche Ogbuji
    Jan 28, 2005
  4. jkugler
    Replies:
    5
    Views:
    492
    John Bokma
    Jun 13, 2006
  5. ming
    Replies:
    2
    Views:
    194
Loading...

Share This Page