Re: [xml] How can I get namespaces of schematypes ?


Hewarth, Michael wrote:
Hi !

I'm writing a Generator for C++ classes corresponding to an xsd schema. The generated classes should be able 
to read and write xml docs with elements of the schema.
If there are other schemas imported which have types with the same name, but different namespace I can't 
distinguish them, and so I'm creating one class for them, which might be wrong in most cases.

I used the workaound you described until now, but now I have exactly this problem. It would be usefull to 
have an Ns struct in xmlSchemaTypePtr which is filled with the targetnamespace of the schema in which the 
type is defined.

By the way: Is there a schema API in work ? For Example it would be nice to have a list of root elements of an schema - 
the hash tables are sometimes a little bit difficult to handle. Furthermore GetType(), GetContentModel and so on would 
save me a lot of work. Wath time will it take do you think to get the implementation of XML Schemas Part 1, described 
on "A partial implementation of XML Schemas Part 1: Structure is being worked on but it would 
be far too early to make any conformance statement about it at the moment." ?

There's no schema construction API in work. The build of the schema and
validation is not completed yet, so an API would be too early.
If it is ever going to be written, much of the current code needs to
be changed - if it's possible with the current public schema structs
at all.

I would not recommend using the structs to access the data. Try to use
accessor functions. If you have finished them, send them to this mailing
list with a subject like: "I give you some functions" :-)
The hope here, for the future is, that the multi-purpose structs can be
mapped more clearly to the schema components defined by the spec. But
maby Daniel again has one of this superb ideas how to do this in a
different, possibly simpler, manner.

I cannot foresee when the implementation of XML Schema part 1 will be
finished. I'm currently trying to implement identity-constraints, which
should be available soon (2-3 weeks?), if I have time and Daniel does
not kill me due to the changes they will need.
There's still a lot missing, on the schema construction side, as well as
on the validation side. Help is needed.  We don't have unique particle
attribution constraints (this might be broken in the spec), derivation
constraints for complex types, the include/import mechanism is somehow
broken in the spec + not complete in Libxml2, all of PSVI,
redefinitions, substitution groups are not complete. There may be other
things missing. We integrated the W3C XML Schema test suite, which
helped a lot; but many of the tests are still failing.

I added targetNamespace to xmlSchemaType, xmlSchemaAttributeGroup and
xmlSchemaNotation. Should be usable now with the following files:
xmlschemas.c rev. 1.98
include/libxml/schemasInternals.h rev. 1.30


I`m using xmllib 2.6.13 to parse xsd files. How to get the namespace
of type t:mybase of this sample schema:


I tried to get it from a pointer xmlSchemaTypePtr ptype - but couldn`t
find it.

There is no targetNamespace field in the xmlSchemaType yet.

ptype->name="mybase", but there is no namespace field - the namespace
should be urn:bsp.


It would be interesting if you could describe your use case here.



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