[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    [jira] Commented: (XMLBEANS-100) Support of DOM Level 3
From:       "Robert H. Pollack (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date:       2008-08-22 19:10:44
Message-ID: 80710204.1219432244776.JavaMail.jira () brutus
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/XMLBEANS-100?page=com.atlassian.jira.plugi \
n.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624957#action_12624957 ] 

Robert H. Pollack commented on XMLBEANS-100:
--------------------------------------------

What works for me as a workaround is to copy the DOM tree created by XMLBeans into a \
Document created by the JDK's DocumentBuilder. In other words, suppose we have a \
Document that has been obtained by something like this:

   Document doc1 = (Document) myXMLObject.newDomNode();

Create a DocumentBuilder in the usual way and use it to build a new Document:

   DocumentBuilder builder = \
DocumentBuilderFactory.newInstance().newDocumentBuilder();  Document doc2 = \
builder.newDocument();

(you'll need exception handlers not shown here). Then import the first Document into \
the second:

   Element newRoot = (Element) doc2.importNode (doc1.getDocumentElement(), true);
   doc2.appendChild (newRoot);

Now do your work--transformations or whatever--with doc2, which will be a DOM level 3 \
Document.

As I say, this is working fine for me; the JVM has no problem handling two different \
DOM implementations, a level 2 implementation from XMLBeans and a level 3 \
implementation from the JDK. And the JDK's implementation seems to have no trouble \
importing nodes from XMLBeans' implementation. Admittedly, this would not scale to \
large trees; I have no workaround to suggest when the tree is so large that copying \
it is expensive.

If, afterward, you need to turn this back into an XmlObject, it should be possible to \
do this by using XmlObject.Factory.parse (doc2), although I haven't tested this since \
my application doesn't need it. 

> Support of DOM Level 3
> ----------------------
> 
> Key: XMLBEANS-100
> URL: https://issues.apache.org/jira/browse/XMLBEANS-100
> Project: XMLBeans
> Issue Type: New Feature
> Components: DOM
> Affects Versions: Version 2
> Reporter: Walter Dorninger
> Assignee: Jacob Danner
> Priority: Minor
> Fix For: TBD
> 
> 
> Support of DOM Level 3 would be a powerful feature.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic