Re: [xml] xmlSchemaSAXPlug and xsi:schemaLocation
- From: Graham Bennett <graham-libxml simulcra org>
- To: Kasimier Buchcik <K Buchcik 4commerce de>
- Cc: ML-libxml2 <xml gnome org>
- Subject: Re: [xml] xmlSchemaSAXPlug and xsi:schemaLocation
- Date: Tue, 11 Oct 2005 22:02:38 +0100
On Mon, Oct 10, 2005 at 10:30:06AM +0200, Kasimier Buchcik wrote:
Hi,
On Sun, 2005-10-09 at 21:41 +0100, Graham Bennett wrote:
Hi,
I've been playing with xmlSchemaSAXPlug to do schema validation on my
own stream of SAX events and it's proving to be very useful. However it
seems that a schema is required to be provided up front in order to get
an xmlSchemaValidCtxt.
Is there any automatic way to handle the situation where the schema
location is provided as an xsi:schemaLocation attribute in the SAX
stream, or should I just handle it myself? I suppose I should be able
to detect such an attribute, plug in the validating sax handler, then
replay the events I have already seen, but this seems a bit messy.
Create the schema validation context with a NULL for the @schema
argument if you want to switch on xsi-driven schema acquisition.
Internally a new schema will be created during the validation and
all the schemata, specified via xsi, will be constructed.
However, this is a bit limited, since Libxml2's schema processors
wants references to schema components to be resolved after each
schema construction episode; thus it will work only on a subset
of all the possible scenarios. E.g. if you have a schema at the
document element, which references a component which would be
acquired deeper in the tree (via a second xsi acquisition) then
you would get a reference resolution error with Libxml2, while the
spec allows such "late binding".
Thanks Kasimier, I'll try this. Just to check, is the 'late binding'
problem an issue with libxml2 schema in general or just when using the
SAX plug interface?
Thanks,
Graham.
--
Graham Bennett
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]