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

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

I've done this for SAX parser as well. Here's what we need to write in the 
client side code, to be able to do this,

SAXParserFactory factory = SAXParserFactory.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);
 SAXParser parser = factory.newSAXParser();
 DefaultHandler handler = new DefaultHandler1();
 parser.parse(xml, handler);

class DefaultHandler1 extends DefaultHandler {
    public void startElement(String arg0, String arg1, String arg2, Attributes 
arg3) throws SAXException {
        System.out.println(arg1);
    }

    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