You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Bagepalli, Kiran" <kb...@informatica.com> on 2002/11/26 02:40:48 UTC
Problem with SchemaAttDef
I am trying to figure out the URI given the URIId. If I use SEnumVal for
attribute "Unit", I get a QName with uridid = 1
And when I call getURIText(uriId), it returns me a empty string saying it
does not belong to any namespace.
Actually this should return 6 which is the uriid for www.books.org.
Can someone explain what is happening.
Thanks
Kiran
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.books.org"
xmlns="http://www.books.org"
elementFormDefault="qualified">
<xsd:complexType name="PublicationType" abstract="true">
<xsd:sequence>
<xsd:element name="Title" type="xsd:string"/>
<xsd:element name="Author" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="Date" type="xsd:gYear"/>
</xsd:sequence>
<xsd:attribute name="Unit" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="BookType">
<xsd:complexContent>
<xsd:extension base="PublicationType" >
<xsd:sequence>
<xsd:element name="ISBN" type="xsd:string"/>
<xsd:element name="Publisher" type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="MagazineType">
<xsd:complexContent>
<xsd:restriction base="PublicationType">
<xsd:sequence>
<xsd:element name="Title" type="xsd:string"/>
<xsd:element name="Author" type="xsd:string"
minOccurs="0" maxOccurs="0"/>
<xsd:element name="Date" type="xsd:gYear"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="Publication" type="PublicationType"/>
<xsd:element name="BookStore">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Publication" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Problem with SchemaAttDef
Posted by "Peter A. Volchek" <Pe...@ti.com.od.ua>.
Kiran,
You got an absolutely correct namespaceUri.
If you want the "Unit" (and other lcoal attributes) to belong to
namespaceUri www.books.org
you should also add the attributeFormDefault="qualified" like
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.books.org"
xmlns="http://www.books.org"
elementFormDefault="qualified"
attributeFormDefault="qualified">
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
....
Regards,
Peter A. Volchek
----- Original Message -----
From: "Bagepalli, Kiran" <kb...@informatica.com>
To: <xe...@xml.apache.org>
Sent: Tuesday, November 26, 2002 3:40 AM
Subject: Problem with SchemaAttDef
> I am trying to figure out the URI given the URIId. If I use SEnumVal for
> attribute "Unit", I get a QName with uridid = 1
> And when I call getURIText(uriId), it returns me a empty string saying it
> does not belong to any namespace.
> Actually this should return 6 which is the uriid for www.books.org.
>
> Can someone explain what is happening.
>
> Thanks
> Kiran
>
>
>
> <?xml version="1.0"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.books.org"
> xmlns="http://www.books.org"
> elementFormDefault="qualified">
> <xsd:complexType name="PublicationType" abstract="true">
> <xsd:sequence>
> <xsd:element name="Title" type="xsd:string"/>
> <xsd:element name="Author" type="xsd:string" minOccurs="0"
> maxOccurs="unbounded"/>
> <xsd:element name="Date" type="xsd:gYear"/>
> </xsd:sequence>
> <xsd:attribute name="Unit" type="xsd:string"/>
> </xsd:complexType>
>
> <xsd:complexType name="BookType">
> <xsd:complexContent>
> <xsd:extension base="PublicationType" >
> <xsd:sequence>
> <xsd:element name="ISBN" type="xsd:string"/>
> <xsd:element name="Publisher" type="xsd:string"/>
> </xsd:sequence>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
> <xsd:complexType name="MagazineType">
> <xsd:complexContent>
> <xsd:restriction base="PublicationType">
> <xsd:sequence>
> <xsd:element name="Title" type="xsd:string"/>
> <xsd:element name="Author" type="xsd:string"
> minOccurs="0" maxOccurs="0"/>
> <xsd:element name="Date" type="xsd:gYear"/>
> </xsd:sequence>
> </xsd:restriction>
> </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:element name="Publication" type="PublicationType"/>
> <xsd:element name="BookStore">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="Publication" maxOccurs="unbounded"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org