You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jack Sprat <re...@yahoo.com> on 2007/09/24 18:53:21 UTC

[Axis2] schema validation exception

I am getting an UnsupportedOperation Exception each time I try to validate an OMElement against a schema.  I am using Axis2 1.2 with no data binding so my service class receives an OMElement object.  The validation code is quite simple:

        // Get XML stream reader from OMElement received
        XMLStreamReader reader = doc.getXMLStreamReader();
        //Create the DOOM OMFactory
        OMFactory doomFactory = DOOMAbstractFactory.getOMFactory();
        //Create the new builder
        StAXOMBuilder doomBuilder = new StAXOMBuilder(doomFactory, reader);
        //Get the document element
        OMElement omElem = doomBuilder.getDocumentElement();

        try {
            SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            Schema xsd = factory.newSchema(schemaLocation);
            Validator validator = xsd.newValidator();
            validator.validate(new DOMSource((Element) omElem));
            return true;
        }
        catch (Exception e) {
            return false;
        }

Below is a snippet of the stack trace:


java.lang.UnsupportedOperationException: TODO
      at
org.apache.axiom.om.impl.dom.DocumentImpl.getDoctype(DocumentImpl.java:225)
      at
org.apache.xerces.jaxp.validation.DOMValidatorHelper.setupEntityMap(Unknown
Source)
      at
org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown
Source)
      at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown
Source)
      at javax.xml.validation.Validator.validate(Unknown Source)

Note that this works fine in Tomcat 5.5 but chokes in Websphere 6.1 so I suspect there is a class loading issue somewhere.  What could be the problem??

Thanks,
T



       
---------------------------------
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel and lay it on us.