Hi Doug,
if you are sure, that "internal" is an element, I think you can try the
type-cast
Element wanted = (Element)
selectSingleNode("//server_request/server/weblogic/internal");
Hope it helps
Pete
>X-MS-Has-Attach:
>X-MS-TNEF-Correlator:
>Thread-Topic: Adding a node to the middle of a pre-existing DOM
>Thread-Index: AcFVwQxQQvYgX23ERXKkNMIOclhiMQ==
>From: "Doug Hoppes" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Subject: [dom4j-user] Adding a node to the middle of a pre-existing DOM
>Sender: [EMAIL PROTECTED]
>X-BeenThere: [EMAIL PROTECTED]
>X-Mailman-Version: 2.0.5
>List-Help: <mailto:[EMAIL PROTECTED]?subject=help>
>List-Post: <mailto:[EMAIL PROTECTED]>
>List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/dom4j-user>,
> <mailto:[EMAIL PROTECTED]?subject=subscribe>
>List-Id: mail list for users of DOM4J <dom4j-user.lists.sourceforge.net>
>List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/dom4j-user>,
> <mailto:[EMAIL PROTECTED]?subject=unsubscribe>
>List-Archive: <http://www.geocrawler.com/redir-sf.php3?list=dom4j-user>
>X-Original-Date: Mon, 15 Oct 2001 17:33:37 -0400
>Date: Mon, 15 Oct 2001 17:33:37 -0400
>X-AntiVirus: OK (checked by AntiVir Version 6.10.0.11)
>
>Hi all,
>
> Just started playing with Dom4J and pretty impressed with it, so far.
> Question: I have a extremely large Xml object where I want to add an
> element to the middle of the Dom tree. What's the most efficient way of
> doing this?
>
>For example, I want to create an element called
><server_address>192.10.20.41</server_address> (where 192.10.20.41 is the
>text node) to <server_request><server><weblogic><internal>....
>I was trying to use the
>selectSingleNode("//server_request/server/weblogic/internal") to get a
>Node() and use the addElement(), but the Node class doesn't have the
>addElement() method.
>
>Could someone post the code for creating an element in the middle of a Xml
>Dom if I know what the XPath is to the parent element?
>
>Any help is appreciated.
>
>Doug Hoppes
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user