[JAXP-21] XMLGregorianCalendar Does Not Implement Serializable Created: 22/Mar/07  Updated: 27/Mar/07

Status: Open
Project: jaxp
Component/s: www
Affects Version/s: current
Fix Version/s: milestone 1

Type: Bug Priority: Major
Reporter: mshaffer55 Assignee: ndw
Resolution: Unresolved Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issuezilla Id: 21

 Description   

The class javax.xml.datatype.XMLGregorianCalendar does not implement
java.io.Serializable. This creates a problem around JAXB classes generated from
schemas. JAXB's default binding of xs:dateTime is to XMLGregorianCalender, and a
standard global JAXB binding makes the generated classes implement Serializable,
but any such class generated from a schema type containing an element of type
xs:dateTime will in fact fail binary serialization.



 Comments   
Comment by Joe Wang [ 27/Mar/07 ]

Assigning to Norm





[JAXP-24] jaxp 1.3 failed on well known schema Created: 28/Mar/07  Updated: 28/Mar/07

Status: Open
Project: jaxp
Component/s: www
Affects Version/s: current
Fix Version/s: milestone 1

Type: Bug Priority: Major
Reporter: tryzigc Assignee: ndw
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issuezilla Id: 24

 Description   

JAXP 1.3 cannot produce Schema object from the well known XML schema
http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd
Try to compile and run the following class

import javax.xml.validation.*;
import javax.xml.transform.stream.*;
import javax.xml.*;

public class XmlTest3 {
public static void main(String[] args) {
try

{ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); StreamSource schemaSrc = new StreamSource("http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"); Schema schema = factory.newSchema(schemaSrc); System.out.println("Successfully created schema"); System.exit(0); }

catch(Exception e)

{ System.out.println("Caught exception"); e.printStackTrace(); System.exit(1); }

}
}

You will get the following exception
org.xml.sax.SAXParseException: InvalidRegex: Pattern value
'[-+]?(\d+|\d+(\.\d+)?%)' is not a valid regular expression. The reported error
was: ''-' is an invalid character range. Write '-'.'.

It seems to me that the regular expression engine used by jaxp 1.3 is more
restricted than before. jaxp 1.2 works just fine. Of course, the schema could be
corrected by changing [-+] to [\-+] and this will fix the problem. However, this
schema is such a well known schema, jaxp 1.3 and jdk1.5 sure will break a lot of
existing application. Is it possible to relax the restriction on the regular
expression?



 Comments   
Comment by Joe Wang [ 28/Mar/07 ]

Assigning to Norm





[JAXP-19] LSSerializer writes processing instruction at end of document Created: 16/Mar/07  Updated: 19/Mar/07

Status: Open
Project: jaxp
Component/s: www
Affects Version/s: current
Fix Version/s: milestone 1

Type: Bug Priority: Major
Reporter: simplemind Assignee: ndw
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Windows 2000
Platform: PC


Issuezilla Id: 19

 Description   

When serializing a XML-Document using LSSerializer (DOMSerializerImpl) a leading
processing-instruction (firstChild of the Document) appears at the end of the
serialized Document.
This issue occours using jre 1.4.2 (I checked it with different releases
(1.4.2_01, 1.4.3_13 and one or two more)) and JAXP 1.4.
This issue does NOT appear with jre 1.5 or JAXP 1.3

I used Eclipse 3.2.1 for the tests and the endorsed standard override mechanism.

Here is a sample-class for evaluating:

import java.io.IOException;
import java.io.StringReader;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSSerializer;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class SerializeTest {

public SerializeTest() {
}

public static void main(String [] args)

{ SerializeTest serializeTest = new SerializeTest(); serializeTest.serializePI(); }

public void serializePI() {
//create XML as String
StringBuffer xmlString = new StringBuffer();
xmlString.append("<?xml version=\"1.0\" encoding=\"UTF-16\"?>");
xmlString.append("<?processingTarget processingData?>");
xmlString.append("<Elements>");
xmlString.append("<Element>Text1</Element>");
xmlString.append("</Elements>");
//parse XML
Document xmlDocument = null;
InputSource is = new InputSource(new StringReader(xmlString.toString()));
DocumentBuilder docBuilder = null;
try

{ docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); }

catch (ParserConfigurationException e)

{ e.printStackTrace(); }
try { xmlDocument = docBuilder.parse(is); } catch (SAXException e) { e.printStackTrace(); }

catch (IOException e)

{ e.printStackTrace(); }

//serialize
DOMImplementation domImpl = docBuilder.getDOMImplementation();
DOMImplementationLS domImplLS = (DOMImplementationLS) domImpl.getFeature("LS",
"3.0");
LSSerializer serializer = domImplLS.createLSSerializer();
System.out.println(serializer.writeToString(xmlDocument));
}
}

The output of the last System.out when using JAXP 1.3 is:
<?xml version="1.0" encoding="UTF-16"?>
<?processingTarget processingData?><Elements><Element>Text1</Element></Elements>

The JAXP 1.4 - output is:
<?xml version="1.0" encoding="UTF-16"?>
<Elements><Element>Text1</Element></Elements><?processingTarget processingData?>

I am interested in this functionality because I want to create a xml-stylesheet

  • processing instruction, which surely must be between the prolog and the
    root-element.

I tested this issue with different JREs and configurations.
Additionally I spent a lot of time searching for solutions but I could not find
anything on this site nor at sun.com or anywhere else, so I am quiet sure this
is a defect.



 Comments   
Comment by Santiago Pericas-Geertsen [ 19/Mar/07 ]

Accepted for further investigation.





[JAXP-23] JAXP 1.3 cannot failed to validate XML against DTD Created: 27/Mar/07  Updated: 27/Mar/07

Status: Open
Project: jaxp
Component/s: www
Affects Version/s: current
Fix Version/s: milestone 1

Type: Bug Priority: Major
Reporter: tryzigc Assignee: ndw
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issuezilla Id: 23

 Description   

JAXP 1.3 failed to parse an valid XML against a DTD. Using the following Java
class and XML document to test.

import javax.xml.parsers.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import java.io.*;

/**

  • To test:
  • 1. Using jdk1.4.2.
  • 2. Put the six jar files of JAXP 1.2 in $jdkhome/jre/lib/endorsed directory.
  • 3. Compile and run. Parsing is a success.
  • 4. Replace the six jar files of JAXP 1.2 with the five jar files of JAXP 1.3.
  • 5. Compile and run. Parsing is a failure.
    */
    public class XmlTest {

/** The property name to specify schema language. */
public static final String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";

/** The property value for W3C schema language. */
public static final String W3C_XML_SCHEMA =
"http://www.w3.org/2001/XMLSchema";

public static void main(String[] args) {
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
System.out.println("SAXParserFactory: "+factory.getClass().getName());

factory.setNamespaceAware(true);
factory.setValidating(true);

SAXParser parser = factory.newSAXParser();
FileInputStream xmlStream = new FileInputStream("ejbxml.xml");
DefaultHandler handler = new DefaultHandler() {
// override to do validation
public void error(SAXParseException e) throws SAXException

{ throw e; }

};

// If the following line is enabled, the parsing will fail. The
// xml is defined by a DTD rather than a schema. Therefore, the
// parser should not fail due to the following line. In fact, the
// failure only occurs when using JAXP 1.3 (i.e. JDK 1.5), JAXP 1.2
// works just fine.
parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);

parser.parse(xmlStream, handler);

System.out.println("Successfully parsed XML");
System.exit(0);
} catch(Exception e)

{ System.out.println("Caught exception"); e.printStackTrace(); System.exit(1); }

}
}

<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
<ejb-jar>
<display-name>AccountEjbJar</display-name>
<enterprise-beans>
<entity>
<display-name>AccountEjb</display-name>
<ejb-name>AccountEjb</ejb-name>
<home>j2eetrails.account.ejb.AccountHome</home>
<remote>j2eetrails.account.ejb.Account</remote>
<ejb-class>j2eetrails.account.ejb.AccountEjb</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<resource-ref>
<res-ref-name>jdbc/SQLServerDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<security-role>
<role-name>all</role-name>
</security-role>
<method-permission>
<role-name>all</role-name>
<method>
<ejb-name>AccountEjb</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>AccountEjb</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>AccountEjb</ejb-name>
<method-intf>Remote</method-intf>
<method-name>debit</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>AccountEjb</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getBalance</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>AccountEjb</ejb-name>
<method-intf>Remote</method-intf>
<method-name>credit</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>



 Comments   
Comment by Joe Wang [ 27/Mar/07 ]

Assigning to Norm





[JAXP-9] Inconsistent exception thrown in SchemaFactory Created: 24/Aug/06  Updated: 29/Aug/06

Status: Open
Project: jaxp
Component/s: www
Affects Version/s: current
Fix Version/s: milestone 1

Type: Bug Priority: Major
Reporter: dserodio Assignee: ndw
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issuezilla Id: 9

 Description   

SchemaFactory#newSchema("non existing file") throws SaxException. Shouldn't it
throw IOException, for consistency with Validator#validateSource, for instance,
and also to follow the "principle of least suprise" ?



 Comments   
Comment by lindstro [ 29/Aug/06 ]

Assigning bug to Norm.





Generated at Mon Aug 31 22:59:23 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.