You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by João Luís Pinto <jo...@gmail.com> on 2007/10/05 22:23:56 UTC

[AXIOM] Validation requiring resolver

Hello,

I'm trying to implement validation of a WS payload in Axis2.

Messages are expected to follow a know location schema,  which
includes <xsd:any> (strict) elements.

The code I'm using is:

<code>
  XMLStreamReader reader = message.getXMLStreamReader();
  OMFactory doomFactory = DOOMAbstractFactory.getOMFactory();
  StAXOMBuilder doomBuilder = new StAXOMBuilder(doomFactory, reader);
  OMElement omElement = doomBuilder.getDocumentElement();

  SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

  Schema xsd = factory.newSchema();
  Validator validator = xsd.newValidator();
  validator.setResourceResolver(new LSResourceResolverImplementation());
  validator.validate(new DOMSource((Element) omElement));
</code>

The main schema validation works, since schemaLocation info is
included in the payload, but I need to be able to register a set of
know schemas that will be considered valid for the <xsd:any> elements,
and that will be referenced in the message by the elements namespace
(and also supposed to be part of the validation).

So I sorted to use a resolver implementation. The issue is that the
resolver is never called, and a "cvc-complex-type.2.4.c: The matching
wildcard is strict, but no declaration can be found for element" is
always thrown.

Can anyone shed some light?

Thanks,

João

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org