Hi
I got a document that look like this:
<?xml version="1.0"
encoding="UTF-8"?>
<root>
<author name="James" location="UK">James Strachan</author> <author name="Bob" location="US">Bob McWhirter</author> </root> <?kalle kalle?>
What I want to do is to move the Process
instruction to be located right after the xml tag
(<?xml....?>).
I can do this with these
lines:
Node el =
document.getRootElement().detach();
document.add(el); And the result is like
this:
<?xml version="1.0"
encoding="UTF-8"?>
<?kalle kalle?> <root>
<author name="James" location="UK">James Strachan</author> <author name="Bob" location="US">Bob McWhirter</author> </root> And this is correct. BUT if I instead
do:
Node el =
document.getRootElement().detach();
document.setRootElement((Element)el); The result looks like
this:
<?xml version="1.0"
encoding="UTF-8"?>
<root>
<author name="James" location="UK">James Strachan</author> <author name="Bob" location="US">Bob McWhirter</author> </root> As you can see the Process instruction
(<?kalle kalle?>) is removed and it should not be since I only detached
the rootelement and only set a new root element...
Is this a bug in dom4j or have I missed
something in the implementation?
Thankfull for any
input!
Cheers Christian
Holmqvist
|
[dom4j-user] Bug in remove functions?
Christian Holmqvist, IT, Posten Thu, 16 Jan 2003 02:30:14 -0800
- [dom4j-user] Bug in remove functions? Christian Holmqvist, IT, Posten
- [dom4j-user] Bug in remove functions? Christian Holmqvist, IT, Posten
- Re: [dom4j-user] Bug in remove fu... James Strachan