You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Jacob Danner (JIRA)" <xm...@xml.apache.org> on 2005/04/19 23:46:26 UTC

[jira] Closed: (XMLBEANS-5) Creating a new DOM node from an XmlObject drops the document element text value

     [ http://issues.apache.org/jira/browse/XMLBEANS-5?page=all ]
     
Jacob Danner closed XMLBEANS-5:
-------------------------------

    Assign To:     (was: xmlbeans-dev@xml.apache.org)

Test now returned something, in the V2 branch
org.apache.xmlbeans.impl.store.Xobj$ElementXobj@1e8703

Closing


> Creating a new DOM node from an XmlObject drops the document element text value
> -------------------------------------------------------------------------------
>
>          Key: XMLBEANS-5
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-5
>      Project: XMLBeans
>         Type: Bug
>   Components: XmlObject
>     Versions: unspecified
>  Environment: Operating System: All
> Platform: All
>     Reporter: Kevin Krouse

>
> description:
>  - creae a new DOM node using XmlObject.newDomNode() where the XmlObject is both
> the document element and is a leaf with text causes the text to be dropped.
> repro:
>  - compile and run the test.java
>  - the output of the test will be "<node/>"
> expect:
>  - the output of the test should be "<node>text</node>"
> import org.apache.xmlbeans.*;
> public class test
> {
>     public static void main(String[] args) throws Exception
>     {
>         XmlObject xobj = XmlObject.Factory.parse("<node>text</node");
>         System.out.println(xobj.newDomNode().getFirstChild());
>     }
> }
> suggested patch:
>  - the org.apache.xmlbeans.impl.Saver.DomSaver makes an unnecessary check that
> the _currentNode is not the document node when adding the text node to the 'e'
> element.
> Index: v1/src/xmlstore/org/apache/xmlbeans/impl/store/Saver.java
> ===================================================================
> RCS file:
> /home/cvspublic/xml-xmlbeans/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Saver.java,v
> retrieving revision 1.3
> diff -C2 -r1.3 Saver.java
> *** v1/src/xmlstore/org/apache/xmlbeans/impl/store/Saver.java   30 Sep 2003
> 21:31:17 -0000      1.3
> --- v1/src/xmlstore/org/apache/xmlbeans/impl/store/Saver.java   14 Nov 2003
> 00:18:06 -0000
> ***************
> *** 4603,4607 ****
>                       }
>   
> !                     if (text != null && _currentNode != _doc)
>                           e.insertBefore( _doc.createTextNode( text ), null );
>                   }
> --- 4603,4607 ----
>                       }
>   
> !                     if (text != null)
>                           e.insertBefore( _doc.createTextNode( text ), null );
>                   }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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