Hi, Matthias!
Your problem is in that you are using _static_ method:
static String valueOf(int)
So, id.valueOf() is essentially String.valueOf(). It doesn't belong to
instance of String id.
You should replace the code
String id = new String();
id.valueOf(i);
to
String id = String.valueOf(i);
Maksim Sakki
Hi everyone,
one more Question about appending an Attribute to Each Element.
I want to append an Attribute to each Element in an Document.
The created Attributes are not appended to the DOM-Tree.
What is the mistake? A code-example would be great (because i'm a new to
Xerces an DOM-Parsers)
----------------------------------------------------------------------------
---
*
*
----------------------------------------------------------------------------
---
Document xmldoc = parser.getDocument();
NodeList Elements = xmldoc.getElementsByTagName("*");
for (int i=0; i < Elements.getLength(); i++){
String id = new String();
id.valueOf(i);
Attr n = xmldoc.createAttribute("id");
n.setNodeValue(id);
NamedNodeMap attributes = Elements.item(i).getAttributes();
attributes.setNamedItem(n);
}
----------------------------------------------------------------------------
---
*
*
----------------------------------------------------------------------------
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]