Re: [xml] support for xml schema in libxml2



Hi Manfred, 

-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On 
Behalf Of Manfred Rahmig

Hi XML-Team,
   currently I am dealing with XML in order to check if it
could be used as representation for testdata used as input for
regression tests within a CAD-software development environment.
For this reason I have the libxml2 libraries available on Windows.
This is libxml2-2.6.22.win32 (and the matching additional libs).
Later we will need them for
SUN, HP, SGI, IBM and Linux as well.

These are my first experiences with XML.
My theory reference is "XML in a Nutshell" by Harold/Means.

Now I am on the point that I think it would be nice to setup
any development on the base of XML Schema.

You should consider RelaxNG as well; a technology often underestimated;
clouded by the W3C XML Schema hype.

Studying the documentation (coming with the libxml2 download) I
found that it is not quite clear in which way libxml2 supports

True. I always forgot (maybe it's a psychological thingy) to change
the description of the state of the W3C XML Schema processor.

XML schema. The following are some problems I found during evaluation.
May be some of these problems result from my lacking experience
with XML. If you have some comments or if you think that some of the
statements below are wrong, I would like you to give me a reply.

With respect to xmllint:

(1) xmllint supports schema validation, but it may have problems.
    --> Importing the x3d extensions of www.web3d.org via 
"x3d-3.0.xsd"
        it seems that
        xmllint does a validation for this schema but afterwards
        the xml file will always be ignored
(2) the xs:ID type seems not to be checked, multiple occurences of the
    same xs:ID are not indicated

The xs:ID issue might be related to
http://bugzilla.gnome.org/show_bug.cgi?id=170795.
This is one of the areas where I'm unsure how to implement.

With respect to the programming interface (I know that the 
interface is incomplete as stated within the documentation):

(1) Here we have the same behaviour as xmllint.
(2) The xmlTextReader is a suitable interface for me, but it does not
    support schema files.
    --> For example default attributes will not be inserted
    --> Fixed attributes will not be set

Hmm, excuse me for challenge your logic: writing that it does
not support schema files, then enumerating the areas which don't work,
sounds like it would support schema files and just has issues.

However, adding default or fixed attributes to the validated instance,
regardless if it's a node tree or processed with a stream-based
technique, is not stated by the W3C XML Schema specification.
What you really want is PSVI (http://www.w3.org/TR/xmlschema-1/), which
would allow to lookup default/fixed attributes. Currently PSVI is
not supported. Additionally, I wonder how we should provide PSVI
with a streaming API?
But we added the automatic creation of default/fixed attributes for
the non-streaming API, so if you would be so kind and investigate
if it's possible with Libxml2 to fire additional xml-reader events
for default/fixed attribute, then this would be a good first step
to have it implemented.
  
I came to the conclusion that it currently makes no sense to
do some implementation based on XML schema within libxml2. Is 
this correct?

Well, every question needs it's appropriate answer: Yes and no.
If you provide reports and test cases for the areas
which don't work for you, plus investigate the spec to allow you
a broader assessment of Libxml2's implementation, then you'll surely
will be gratified with a working solution. If you cannot afford this
additional time-consuming overhead on your side, then, I fear, you
made contact with a term that's called a "bug", or "feature request",
and, unlike a Bose-Einstein condensation, where multiple bosons can
share the same quantum state, a bug is not a non-bug.

If you see a way to do some development, I would ask you to 
send me some example code or some hints where to find example code for
"how to read xml files based on xml schema" using libxml2.
What are the future intentions with respect to  XML schema support?

I think we intend to implement the missing areas. PSVI is a different
story, which we need to consider well when implementing XPath 2.0
and XSLT 2.0 in the future, since PSVI will have to be a part of those
new technologies, and we don't mant to make API-related mistakes, before
we see the whole picture; and that should be when XSLT 2.0 & Co. become
a W3C recommendation.

By the way, the DTD based functionality works fine.


Thanks in advance and best regards
Manfred Rahmig

Regards,

Kasimier



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]