Hi -

I don't believe there's any concept of attribute ordering in XML (and hence in any DOM implementation). See http://www.w3.org/TR/REC-xml/, section 3.1

Brian

Steve Loughran wrote:
Jacob,

I've been looking at teh xmlproperty source. The order the task works through attrs is driven by the order it comes from the DOM in node.getAttributes():


     if (node.hasAttributes()) {

            NamedNodeMap nodeAttributes = node.getAttributes();

            // Is there an id attribute?
            Node idNode = nodeAttributes.getNamedItem(ID);
            id = (semanticAttributes && idNode != null
                  ? idNode.getNodeValue() : null);

            // Now, iterate through the attributes adding them.
            for (int i = 0; i < nodeAttributes.getLength(); i++) {

                Node attributeNode = nodeAttributes.item(i);

                if (!semanticAttributes) {
String attributeName = getAttributeName(attributeNode); String attributeValue = getAttributeValue(attributeNode); addProperty(prefix + attributeName, attributeValue, null);
                } else {

                    String nodeName = attributeNode.getNodeName();
String attributeValue = getAttributeValue(attributeNode);


Being an XML person, perhaps you can answer some details that are not in the javadocs.

1. What is the ordering in node.getAttributes() according to the normative DOM specification?

2. If we want attributes in declaration order, how do we do it? Go through all child nodes and only pick up things that are in the right order.

3. Does the same ordering appear when running Ant with the older version of Xerces?

XmlProperty is all dom based. If we cannot get stuff except in alpha order, then we are going to have to live with it and document the fact.

-Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd         brian @ oopsconsultancy.com
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to