ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: <xmlproperty> intra-element attribute property resolution issue
Date Mon, 22 Jan 2007 23:12:37 GMT

I think Brian is correct.  XML attributes have no defined order other than the
obvious alphabetical order, which might be an implementation detail.  Even so,
I wonder if logic could be written to maximize resolution.  If a property is
found to not be resolved, it could be deferred until other attributes are
processed.  If after all attributes are processed, a property is still not
resolved, then so be it.  But it would make sense to try.  If it were to pose a
performance issue, it could be an option of XMLProperty defaulting to 'false'. 
I'm not sure how complex the logic might be, but I would think it's doable.

Jake

Quoting Brian Agnew <brian@oopsconsultancy.com>:

> 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: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
>
> --
> 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: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message