From: "Brain, Jim" <[EMAIL PROTECTED]>
> All over my code I write method that pass back elements. So, I end up
> starting the method with this:
>
> Element
>
el=(Element)((Node)DocumentHelper.createDocument().add("MyElementName")).det
> ach();
>
> Is there a better way to get an unconnected element?
Or you could just do...
public class Foo {
DocumentFactory factory = new DocumentFactory();
public Element makeSomething() {
Element element = factory.createElement( "MyElementName" );
element.addText( "some text content" );
return element;
}
}
and use this mechansim to create any node or document fragment.
> As well, last night, I was writing some code that pulls a SOAP body from a
> soap message. The Body tag was namespace qualified. If it is, how do you
> XPath search for it. Searching for //Body failed.
Namespace support in XPath is a big topic. The short answer is to use a
prefix...
//SOAP-ENV:Body
dom4j will use the prefixes that are available in your document by default
or you can specify your own prefixes to use with an XPath.
e.g.
http://dom4j.org/todo.html
the first feature in the 'New Features' section describes how to pass in
namespace prefixes using a Map to XPath queries.
James
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user