Schema validation issues

View: New views
4 Messages — Rating Filter:   Alert me  

Schema validation issues

by bimargulies :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm looking at coding support for schema validation over Woodstox
4.0.2 into CXF, but there are aspects of the API that make me doubtful
as to the chances of success.

In CXF, we've got the entire forest of XML Schema that hang from a
WSDL. When validating with DOM or SAX, we can load all of them into a
single Schema object, including resolution of the inter-schema
imports, for which we use a LSResourceResolver.

The Woodstox API seems to accept one XSD file at a time, so I don't
see how I could crank this up.

Am I missing something?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Schema validation issues

by Cowtowncoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Mar 3, 2009 at 4:31 PM, Benson Margulies <bimargulies@...> wrote:

> I'm looking at coding support for schema validation over Woodstox
> 4.0.2 into CXF, but there are aspects of the API that make me doubtful
> as to the chances of success.
>
> In CXF, we've got the entire forest of XML Schema that hang from a
> WSDL. When validating with DOM or SAX, we can load all of them into a
> single Schema object, including resolution of the inter-schema
> imports, for which we use a LSResourceResolver.
>
> The Woodstox API seems to accept one XSD file at a time, so I don't
> see how I could crank this up.
>
> Am I missing something?

This is correct at this point: Schema loading API is designed to take
just a single resource. My assumption was that typically a
"super-schema" (which imports other pieces) would be used to work
around the problem. But that assumes that the end system is using
this, not a service that may not have luxury of doing this.

But beyond question of XMLValidationSchemaFactory issue there
shouldn't be anything preventing from multiple schemas from being
used, as long as MSV allows that. I think you are right in that MSV
allows this -- with RelaxNG there's no need, and so initially no
support was added. With W3C Schema maybe it is time to revisit this
thing. I was basically waiting to see if anyone wants this feature.
:-)
Looks like I got the answer.

I am open to suggestions on how to resolve this -- changing XML
validation API is bit tricky, since I'd want API to remain stable for
4.0.0 series. But since no other package yet implements it (if some
did, they'd break if we added new method(s)), it might be reasonable
to add new functionality for 4.1 release if necessary.

I appreciate your help with this: I think that not many developers
have used RNG/Schema validation functionality of Woodstox up until
this point. And without usage, it is hard to find all use cases that
need to be supported.

-+ Tatu +-

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Schema validation issues

by bimargulies :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm working on an experiment involving a class that uses the MSV
MultiSchemaReader. If it works, I'll post it to the JIRA I opened as a
patch. It doesn't fit into the generic factory model very well, but
the first question is whether it works at all.

On Tue, Mar 3, 2009 at 9:31 PM, Tatu Saloranta <tsaloranta@...> wrote:

> - Show quoted text -
> On Tue, Mar 3, 2009 at 4:31 PM, Benson Margulies <bimargulies@...> wrote:
>> I'm looking at coding support for schema validation over Woodstox
>> 4.0.2 into CXF, but there are aspects of the API that make me doubtful
>> as to the chances of success.
>>
>> In CXF, we've got the entire forest of XML Schema that hang from a
>> WSDL. When validating with DOM or SAX, we can load all of them into a
>> single Schema object, including resolution of the inter-schema
>> imports, for which we use a LSResourceResolver.
>>
>> The Woodstox API seems to accept one XSD file at a time, so I don't
>> see how I could crank this up.
>>
>> Am I missing something?
>
> This is correct at this point: Schema loading API is designed to take
> just a single resource. My assumption was that typically a
> "super-schema" (which imports other pieces) would be used to work
> around the problem. But that assumes that the end system is using
> this, not a service that may not have luxury of doing this.
>
> But beyond question of XMLValidationSchemaFactory issue there
> shouldn't be anything preventing from multiple schemas from being
> used, as long as MSV allows that. I think you are right in that MSV
> allows this -- with RelaxNG there's no need, and so initially no
> support was added. With W3C Schema maybe it is time to revisit this
> thing. I was basically waiting to see if anyone wants this feature.
> :-)
> Looks like I got the answer.
>
> I am open to suggestions on how to resolve this -- changing XML
> validation API is bit tricky, since I'd want API to remain stable for
> 4.0.0 series. But since no other package yet implements it (if some
> did, they'd break if we added new method(s)), it might be reasonable
> to add new functionality for 4.1 release if necessary.
>
> I appreciate your help with this: I think that not many developers
> have used RNG/Schema validation functionality of Woodstox up until
> this point. And without usage, it is hard to find all use cases that
> need to be supported.
>
> -+ Tatu +-
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Schema validation issues

by bimargulies :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here, by the way, is the code I'm going to try.

public class W3CMultiSchemaFactory extends BaseSchemaFactory {

    private MultiSchemaReader multiSchemaReader;
    private SAXParserFactory parserFactory;
    private XMLSchemaReader xmlSchemaReader;
    private MyGrammarController ctrl = new MyGrammarController();

    public W3CMultiSchemaFactory() {
        super(XMLValidationSchema.SCHEMA_ID_RELAXNG);
    }

    public XMLValidationSchema loadSchemas(InputSource[] sources)
throws XMLStreamException {
        parserFactory = getSaxFactory();
        xmlSchemaReader = new XMLSchemaReader(ctrl, parserFactory);
        multiSchemaReader = new MultiSchemaReader(xmlSchemaReader);
        for (InputSource source : sources) {
            multiSchemaReader.parse(source);
        }

        XMLSchemaGrammar grammar = multiSchemaReader.getResult();
        if (grammar == null) {
            throw new XMLStreamException("Failed to load schemas: " +
ctrl.getMErrorMsg());
        }
        return new W3CSchema(grammar);
    }

    @Override
    protected XMLValidationSchema loadSchema(InputSource src, Object
sysRef) throws XMLStreamException {
        throw new XMLStreamException("W3CMultiSchemaFactory does not
support the provider API.");
    }
}

On Tue, Mar 3, 2009 at 9:48 PM, Benson Margulies <bimargulies@...> wrote:

> I'm working on an experiment involving a class that uses the MSV
> MultiSchemaReader. If it works, I'll post it to the JIRA I opened as a
> patch. It doesn't fit into the generic factory model very well, but
> the first question is whether it works at all.
>
> On Tue, Mar 3, 2009 at 9:31 PM, Tatu Saloranta <tsaloranta@...> wrote:
>> - Show quoted text -
> - Show quoted text -
>> On Tue, Mar 3, 2009 at 4:31 PM, Benson Margulies <bimargulies@...> wrote:
>>> I'm looking at coding support for schema validation over Woodstox
>>> 4.0.2 into CXF, but there are aspects of the API that make me doubtful
>>> as to the chances of success.
>>>
>>> In CXF, we've got the entire forest of XML Schema that hang from a
>>> WSDL. When validating with DOM or SAX, we can load all of them into a
>>> single Schema object, including resolution of the inter-schema
>>> imports, for which we use a LSResourceResolver.
>>>
>>> The Woodstox API seems to accept one XSD file at a time, so I don't
>>> see how I could crank this up.
>>>
>>> Am I missing something?
>>
>> This is correct at this point: Schema loading API is designed to take
>> just a single resource. My assumption was that typically a
>> "super-schema" (which imports other pieces) would be used to work
>> around the problem. But that assumes that the end system is using
>> this, not a service that may not have luxury of doing this.
>>
>> But beyond question of XMLValidationSchemaFactory issue there
>> shouldn't be anything preventing from multiple schemas from being
>> used, as long as MSV allows that. I think you are right in that MSV
>> allows this -- with RelaxNG there's no need, and so initially no
>> support was added. With W3C Schema maybe it is time to revisit this
>> thing. I was basically waiting to see if anyone wants this feature.
>> :-)
>> Looks like I got the answer.
>>
>> I am open to suggestions on how to resolve this -- changing XML
>> validation API is bit tricky, since I'd want API to remain stable for
>> 4.0.0 series. But since no other package yet implements it (if some
>> did, they'd break if we added new method(s)), it might be reasonable
>> to add new functionality for 4.1 release if necessary.
>>
>> I appreciate your help with this: I think that not many developers
>> have used RNG/Schema validation functionality of Woodstox up until
>> this point. And without usage, it is hard to find all use cases that
>> need to be supported.
>>
>> -+ Tatu +-
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email