[ 
https://issues.apache.org/jira/browse/XERCESJ-1688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16363712#comment-16363712
 ] 

Mukul Gandhi commented on XERCESJ-1688:
---------------------------------------

I've just committed a piece of code, which makes it possible to do XSD 1.1 
validation while doing DOM parsing.

Here's what we need to write in the client side code, to be able to do this,

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
 factory.setNamespaceAware(true);
 SchemaFactory sf = 
SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1";);
 Schema schema = sf.newSchema(new File(xsd));
 factory.setSchema(schema);
 DocumentBuilder builder = factory.newDocumentBuilder();
 builder.setErrorHandler(new ErrorHandler1());
 Document document = builder.parse(xml);

class ErrorHandler1 implements ErrorHandler {

public void error(SAXParseException arg0) throws SAXException {
 System.out.println(arg0.getMessage());
 }

public void fatalError(SAXParseException arg0) throws SAXException {
 System.out.println(arg0.getMessage());
 }

public void warning(SAXParseException arg0) throws SAXException {
 System.out.println(arg0.getMessage());
 }

}

 

> Support for XML Schema 1.1 validation with the DOM and SAX parsers
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1688
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1688
>             Project: Xerces2-J
>          Issue Type: Wish
>         Environment: JDK 1.4 and above, OS independent
>            Reporter: Mukul Gandhi
>            Priority: Minor
>
> XML Schema 1.0 validation has been available in XercesJ since long time. 
> There we have following three methods for doing XML Schema 1.0 validation:
> Using DOM parser,
> Using SAX parser,
> Using JAXP API
> But XercesJ's XML Schema 1.1 processor, supports XML Schema 1.1 validation 
> using only JAXP API. I wish we support XML Schema 1.1 validation, using DOM 
> and SAX parsing as well. I feel, this will make our XML Schema 1.1 validation 
> API complete.
> I'm creating this issue, so that anyone (including me) can try implementing 
> the functionality I've mentioned in this issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-dev-h...@xerces.apache.org

Reply via email to