Christopher Lenz wrote:
It should be much more efficient (and probably simpler) to just
traverse the DOM and replace properties in-place:
Splendid! This job gets easier by the moment!
Thanks for that.
Regards, Upayavira
public void replaceProperties(Node n) throws DOMException {
switch (n.getNodeType()) {
case Node.ATTR_NODE:
case Node.CDATA_SECTION_NODE:
case Node.TEXT_NODE: {
n.setValue(getProject().replaceProperties(n.getNodeValue()));
break;
}
case Node.DOCUMENT_NODE:
case Node.DOCUMENT_FRAGMENT_NODE:
case Node.ELEMENT_NODE: {
Node child = n.getFirstChild();
while (child != null) {
replaceProperties(child);
child = child.getNextSibling();
}
break;
}
default: {
// ignore all other node types
}
}
}
[disclaimer: this is all untested code]
-chris
[EMAIL PROTECTED] wrote:
Is there an Ant way to 'spider' a DOM node, replacing properties as
it goes?
I donīt know such a thing. But you can do:
- write the DOM to a String
- use Project.replace() on that String
- parse the String
- replace the DOM with new one
Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]