[ http://issues.apache.org/jira/browse/XERCESJ-993?page=all ]
Ankit Pasricha resolved XERCESJ-993:
------------------------------------
Resolution: Fixed
Fix Version: (was: 2.6.2)
> Identity-constraint validation on cross datatypes is incorrect
> --------------------------------------------------------------
>
> Key: XERCESJ-993
> URL: http://issues.apache.org/jira/browse/XERCESJ-993
> Project: Xerces2-J
> Type: Bug
> Components: XML Schema datatypes
> Versions: 2.6.2
> Reporter: Venugopal Rao K
> Assignee: Ankit Pasricha
>
> ------------------------------------------- test.xsd
> <?xml version="1.0"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
> <xsd:element name="root">
> <xsd:complexType>
> <xsd:choice maxOccurs="unbounded">
> <xsd:element name="key" type="xsd:anyURI" />
> <xsd:element name="keyref" type="xsd:NCName" />
> </xsd:choice>
> </xsd:complexType>
> <xsd:key name="key1">
> <xsd:selector xpath="key"/>
> <xsd:field xpath="."/>
> </xsd:key>
> <xsd:keyref name="key2" refer="key1">
> <xsd:selector xpath="keyref"/>
> <xsd:field xpath="."/>
> </xsd:keyref>
> </xsd:element>
> </xsd:schema>
> ----------------------------------------------------
> ------------------------------------------- test.xml
> <?xml version="1.0"?>
> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="test.xsd">
> <key>true</key>
> <keyref>true</keyref>
> </root>
> ----------------------------------------------------
> ------------------------------------------ test.java
> import java.io.File;
> import org.xml.sax.SAXException;
> import org.xml.sax.SAXParseException;
> import org.xml.sax.helpers.DefaultHandler;
> import javax.xml.parsers.SAXParserFactory;
> import javax.xml.parsers.SAXParser;
> public class test {
> protected static class ErrorHandler extends DefaultHandler {
> public int errorCounter = 0;
> public void error(SAXParseException e) throws SAXException {
> System.out.println(e);
> errorCounter++;
> }
> public void fatalError(SAXParseException e) throws SAXException {
> System.out.println(e);
> errorCounter++;
> }
> }
> public static void main(String [] args) throws Exception {
> ErrorHandler errorHandler = new ErrorHandler();
> SAXParserFactory spf = SAXParserFactory.newInstance();
> spf.setNamespaceAware(true);
> spf.setValidating(true);
> SAXParser parser = spf.newSAXParser();
> parser.setProperty(
> "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
> "http://www.w3.org/2001/XMLSchema");
> parser.setProperty(
> "http://java.sun.com/xml/jaxp/properties/schemaSource",
> args[0]);
> try {
> parser.parse(args[1], errorHandler);
> } catch (SAXException e) {
> exit(1, "Fatal Error: " + e);
> }
> if (errorHandler.errorCounter == 0) {
> exit(1, "Failed: no error is reported for " + args[1]
> + ", but expected to violate identity constraint");
> } else {
> exit(0, "Passed.");
> }
> }
> public static void exit(int errCode, String msg) {
> System.out.println(msg);
> System.exit(errCode);
> }
> }
> ----------------------------------------------------
--
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]