[Advanced-java] How do I retrieve attributes in correct order from a DOM?

Prashant Parashar pparashar at csc.com
Thu Apr 13 08:15:44 PDT 2006


I am trying to retrieve database query result in XML and the columns are 
returned as attributes. I know the better way is to get them as elements 
but now can't go back...
and correct order is the order in which they appear in XML text - 
<element1 attr1="v1" attr2="v2" attr3="v3"........ />

here the correct order would be attr1, attr2, attr3 and so on. I hope it 
would help.

Thanks in advance,
Prashant Parashar
Computer Sciences Corporation (CSC)


"Talent hits the target nobody can hit, and a Genius hits the target 
nobody can see"



--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. NOTE: Regardless of content, this e-mail shall not operate to 
bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use of 
e-mail for such purpose.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------




Kathy Van Stone <kvs at acm.org> 
Sent by: advanced-java-bounces at lists.XCF.Berkeley.EDU
04/13/2006 08:39 PM

To
advanced-java at lists.XCF.Berkeley.EDU
cc

Subject
Re: [Advanced-java] How do I retrieve attributes in correct     order from 
a DOM?






At 10:44 AM 4/13/2006, Prashant Parashar wrote:

>Hi,
>How do I retrieve attributes in correct order from a DOM?

By the specification (see http://www.w3.org/TR/REC-xml/#NT-STag) the 
order or attributes is not supposed to be significant, so it unlikely 
that any parser will preserve their order. There is no "correct" order to 
get.

What is your document that the order of the attributes matters? 
Generally if you need ordering, you use a list of elements.

-Kathy Van Stone
kvs at acm.org


_______________________________________________
Advanced-java mailing list
Advanced-java at lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/advanced-java

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /lists/advanced-java/attachments/20060413/d32ea817/attachment.html


More information about the Advanced-java mailing list