xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 24696] New: - Creating a new DOM node from an XmlObject drops the document element text value
Date Fri, 14 Nov 2003 00:20:56 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24696>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24696

Creating a new DOM node from an XmlObject drops the document element text value

           Summary: Creating a new DOM node from an XmlObject drops the
                    document element text value
           Product: XMLBeans
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: XmlObject
        AssignedTo: xmlbeans-dev@xml.apache.org
        ReportedBy: kkrouse@bea.com


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 );
                  }

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Mime
View raw message