xml Node.appendChild problem
From: TED (guen_at_usa.net)
Date: 12/30/03
- Next message: junaid: "JMF: encrypting rtp payload"
- Previous message: Jonathan Lofthouse: "ANT config - running java"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Dec 2003 19:25:28 +0100
Hi,
I have a really complex xml dom and I can access it only using an
already developed interface.
This interface takes an XPath string and returns me the retrieved nodes.
I need to add some children.
I wrote the following code:
Element e = mydoc.createElement("mytag");
e.appendChild(mydoc.createTextNode("my text"));
xpath_retrieved_node.appendChild(e);
it doesn't work !!!
org.apache.crimson.tree.DomEx: HIERARCHY_REQUEST_ERR
Actually xpath_retrieved_node is an instance of
org.apache.crimson.tree.XmlDocument
so the called method is this one:
public Node appendChild (Node n) throws DOMException
{
if (n instanceof Element && getDocumentElement () != null)
throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR);
if (n instanceof DocumentType && getDoctype () != null)
throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR);
return super.appendChild (n);
}
My Element e is not an instance of DocumentType!!!
moreover the getDoctype method looks for a DocumentType element as a
child of node and not from the tree root.
By the way is impossible to pass the second condition.
How can I add a child to this node?
I surely missed something, but I cannot immagine what!
thanks in advance for your help
TED
- Next message: junaid: "JMF: encrypting rtp payload"
- Previous message: Jonathan Lofthouse: "ANT config - running java"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|