On May 1, 7:52 am, Rolf.Kem...@eu.necel.com wrote:
> Dear Java experts,
>
[quoted text clipped - 24 lines]
>
> Rolf
org.apache classes probably come from apache.org. I'm guessing thats
part of Xerces, but I don't know for certain... It is not standard,
but easy to bundle.
Steve W. Jackson - 01 May 2007 18:36 GMT
> On May 1, 7:52 am, Rolf.Kem...@eu.necel.com wrote:
> > Dear Java experts,
[quoted text clipped - 29 lines]
> part of Xerces, but I don't know for certain... It is not standard,
> but easy to bundle.
The Apache Xerces and Xalan classes are bundled as of 1.5. They're
simply moved to another package hierarchy in order to allow users the
ability to use newer releases from Apache should they wish.
But they're not all listed in the Javadocs, including XMLSerializer.
It's now at com.sun.org.apache.xml.internal.serialize.XMLSerializer.
Note the "com.sun" prefix and the addition of "internal". Poke around
in the src.zip with the JDK installation.
= Steve =

Signature
Steve W. Jackson
Montgomery, Alabama
Rolf.Kemper@eu.necel.com - 01 May 2007 18:39 GMT
> On May 1, 7:52 am, Rolf.Kem...@eu.necel.com wrote:
>
[quoted text clipped - 32 lines]
>
> - Zitierten Text anzeigen -
Daniel,
thanks for your mail. Based on the little I know your understanding is
right. I think XERCES is part of standard distribution.
This is why I'm a bit pussled that XMLSerializer is obviously not.
Meantime I found a solution by using TransformerFactory and DomSource.
But I have not finalized it yet.
The part I'struggling is the following:
I have created a Nodelist out of an XML docuemnt by Xpath which works
well.
// snipet
NodeList Config = (NodeList )xpath.evaluate("/ShotMapConfigs/
Config[@Name='" + "uCFL_V1.0" + "']", DocConfigXML ,
XPathConstants.NODESET )
// end snipet
Next I tried to add a single node out of this list to a NEW dom
document.
I get an error that the nodes are not from the same document.
Basically I undestand that.
I tried to use DocumentFragment , but this does not help.
// snipet
Document doc = impl.createDocument(null,"ShotMapDocLog", null);
DocumentFragment fragment = doc.createDocumentFragment();
fragment.appendChild(Config.item(0));
Element root = doc.getDocumentElement();
// end snipet
So , the question on this is how can I let's say copy a fragment from
one dom to another ?
Any idea is welcome.
Rolf
wisccal@googlemail.com - 02 May 2007 15:02 GMT
On May 1, 1:39 pm, Rolf.Kem...@eu.necel.com wrote:
> > On May 1, 7:52 am, Rolf.Kem...@eu.necel.com wrote:
>
[quoted text clipped - 67 lines]
>
> Rolf
I believe all that you have to do is to import the node first, which
creates a copy that can be inserted into the new Document. Something
like:
Node node = doc.importNode(Config.item(0), true); //true to deep-copy
...
fragment.appendChild(node);
Also, I would recommend that you use the various factory classes
instead of the vendor-specific implementations. I.e., instead of
impl.createDocument(), use DocumentBuilderFactory & DocumentBuilder to
parse or to create a new Document.
Hope this proves helpful.
Steve
------------
www.stkomp.com