Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCESJ-969

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCESJ-969
    Summary: DOMSerializerImpl or LSSerializer fails to write an element
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Xerces2-J
 Components: 
             Serialization
   Versions:
             2.6.2

   Assignee: 
   Reporter: Yoon Kyung Koo

    Created: Sat, 22 May 2004 12:41 AM
    Updated: Sat, 22 May 2004 12:41 AM
Environment: Microsoft Windows XP [Version 5.1.2600]
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
Xerces 2.6.2

Description:
DOMSerializerImpl can write a document but fails to write an element.
NullPointerException occurs arround the wellformedness checking routine.

[run result]
c:\Works\tmax\offwork\javaworks\xml\event>c:\jdk1.4\bin\java -cp .;xercesImpl.jar 
LSSerializerTest
c:\jdk1.4\bin\java -cp .;xercesImpl.jar LSSerializerTest
document is <?xml version="1.0"?>
<boys xmlns="urn:foo"/>
org.w3c.dom.ls.LSException: java.lang.NullPointerException
        at org.apache.xml.serialize.DOMSerializerImpl.writeToString(Unknown Source)
        at LSSerializerTest.<init>(LSSerializerTest.java:53)
        at LSSerializerTest.main(LSSerializerTest.java:61)

[test program]
import java.io.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;  
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.*;
import org.xml.sax.*;

public class LSSerializerTest {
    /**
     * XML schema validation key for JAXP
     */
    private static final String JAXP_SCHEMA_LANGUAGE
        = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";;

    /**
     * XML schema namespace
     */
    private static final String W3C_XML_SCHEMA
        = "http://www.w3.org/2001/XMLSchema";; 

    /**
     * OASIS catalog resolver key for Apache Xerces
     */
    private static final String OASIS_XML_CATALOG
        = "http://apache.org/xml/properties/internal/entity-resolver";;

    public LSSerializerTest() {
        System.setProperty("javax.xml.parsers.SAXParserFactory",
                           "org.apache.xerces.jaxp.SAXParserFactoryImpl");
        System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
                           "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setValidating(false);
        factory.setIgnoringElementContentWhitespace(false);
        factory.setIgnoringComments(true);
        factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);

        try {
            // Parse the input
            DocumentBuilder domBuilder = factory.newDocumentBuilder();
            DOMImplementation domImpl = domBuilder.getDOMImplementation();

            Document doc = domBuilder.newDocument();
            Element el = doc.createElementNS("urn:foo", "boys");
            doc.appendChild(el);

            org.apache.xml.serialize.DOMSerializerImpl writer = new 
org.apache.xml.serialize.DOMSerializerImpl();
            // xerces 2.6.2 has a problem in wellformed check routine
            // writer.getDomConfig().setParameter("well-formed", Boolean.FALSE);
            System.out.println("document is " + writer.writeToString(doc));
            System.out.println("element is " + writer.writeToString(el));
        } catch (ParserConfigurationException e) {
            e.printStackTrace ();
        }

    }

    public static void main(String[] args) {
        new LSSerializerTest();
    }

}




---------------------------------------------------------------------
JIRA INFORMATION:
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

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Reply via email to