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


Hewarth, Michael wrote:
Hi !

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

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema targetNamespace="urn:bsp" xmlns:t="urn:bsp"

elementFormDefault="qualified" attributeFormDefault="unqualified"

xmlns:xs=""; >

        <xs:element name="baselem" type="t:mybase"/>

        <xs:complexType name="mybase">

                <xs:sequence id="baseseq">

                        <xs:element name="base1" type="xs:string"/>

                        <xs:element name="base2" type="xs:string"/>




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.

Can anyone help me ?

Since AFAIK the targetNamespace of complex/simple types is not involved
in any schema construction or validation process, it was not exposed
yet. It would only be usefull for display purposes, and for construction
of schemata using an API, which is not supported yet; construction from
XML Schema _documents_ is implemented only. A quick workaround would be
to take the targetNamespace of the schema itself, since it's always the
same. For a schema build from different schema documents by import this
workaround would obviously not work.
The spec declares the targetNamespace as part of the complex/simple type
component, so we will have to put it in anyway. I'll look into it.

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]