Hi Henric,
"Henric Rosvall" <[EMAIL PROTECTED]> wrote on 06/15/2007 05:49:04 AM:
> I know it's possible to export an Element and all its sub-elements
> to a String using this command:
> org.apache.batik.dom.util.DOMUtilities.writeNode(e, writer);
Yes.
> But is there some way to convert it back to an Element once again?
Use an XML parser. You can see our implementation in:
batik.bridge.ScriptingEnvironment.parseXML.
> (of course, with all the parent-document-references gone, but in my
> case that really doesn't matter since I'm going to import the
> Element into another document anyway once de-serialized)
This is what parseXML is typically use for.
> Of course I could create a new empty Document, import the node, and
> convert the document to a String, and then recreate the document
> once again and extract the Element, but it seems like that would
> waste alot of unnecessary space and CPU.
Unfortunately this is exactly what the parseXML code does.
There isn't a standard interface to parse fragments of XML,
additionally you have issues for namespaces and the like that
make it tricky.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]