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=14480>.
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=14480

Error by appending a text node to a child

           Summary: Error by appending a text node to a child
           Product: Xerces2-J
           Version: 2.2.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: JAXP
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


By appending a textnode to a child the text node will not appended. The 
following junit test failes with the newest xerces 2.2.1. When I run this test 
with crimson it works.

TestCase:
---------
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import junit.framework.TestSuite;


public class XMLTest extends TestCase
{                          
    /**
     * Constructor
     * @param name the name
     */
    public XMLTest( String name )
    {
        super( name );
    }

    
    /**
     * Test append a text node to an element
     */
    public void testAppendTextNode() throws Exception
    {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = factory.newDocumentBuilder();
        Document doc = docBuilder.newDocument();
        Element e = doc.createElement( "TEST" );
        e.appendChild( doc.createTextNode( "42" ) );
        System.err.println("element:"+e);
        assertNotNull( e );
        assertNotNull( e.toString() );
        assertEquals( e.toString(), "<TEST>42</TEST>" );
    }


    /**
     * Run test cases
     * @param args
     */
    public static void main( String[] args )
    {
        TestSuite suite = new TestSuite( XMLTest.class );
        junit.textui.TestRunner.run( suite );        
    }    
}


// compile;
[xercesTest]$ javac -classpath "junit.jar;xercesImpl.jar;xmlParserAPIs.jar" 
XMLTest.java

// run test:
[xercesTest]$ java -cp "junit.jar;xercesImpl.jar;xmlParserAPIs.jar;." XMLTest
.element:[TEST: null]
F
Time: 0.911
There was 1 failure:
1) testAppendTextNode(XMLTest)junit.framework.ComparisonFailure: expected:<
[TEST: null]> but was:<<TEST>42</TEST>>
        at XMLTest.testAppendTextNode(XMLTest.java:35)
        at XMLTest.main(XMLTest.java:46)

FAILURES!!!
Tests run: 1,  Failures: 1,  Errors: 0

[xercesTest]$

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to