Re: Attributes from a different namespace

If you wanted to keep your attribute named as IsHidden, then in your first 
schema you could do:

 <java:simpleType name="IsBridge">
    <java:restriction base="java:boolean"/>
 </java:simpleType>

which effectively sets up an alias for the boolean type, and then in your 
second schema so:

 <xs:attribute name="IsHidden" type="java:IsBridge"/>

If you still wanted an attribute called IsBridge in your first schema, you 
could include in it:

    <java:attribute name="IsBridge" type="IsBridge"/>

(The two names are in different namespaces.)

(BTW - In your first schema I would also make the prefix associated with the 
http://www.w3.org/2001/XMLSchema namespace be 'xs' as you have done in the 
second schema.)

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================

----- Original Message ----- 
From: "Swayam Vemuri -X (swvemuri - WIPRO at Cisco)" <swvemuri@cisco.com>
To: "Michael Kay" <mike@saxonica.com>; <xmlschema-dev@w3.org>
Sent: Wednesday, March 07, 2007 4:36 AM
Subject: RE: Attributes from a different namespace


Thanks Michael.

Well my intention was to use the IsBridge attribute in java1.xsd in
base1.xsd. That's all.

After some trial and error I solved my problem by using below in my
base1.xsd, it worked



<xs:attribute ref="java:IsBridge"/>



Pl let me know if there is any better way of doing the same.



Thanks

Swayam



________________________________

From: Michael Kay [mailto:mike@saxonica.com]
Sent: Wednesday, March 07, 2007 2:59 AM
To: Swayam Vemuri -X (swvemuri - WIPRO at Cisco); xmlschema-dev@w3.org
Subject: RE: Attributes from a different namespace



You can't write type="java:IsBridge" because java:IsBridge is an
attribute, not a type.



I'm not sure what you wanted it to mean.



Michael Kay

http://www.saxonica.com/




________________________________


From: xmlschema-dev-request@w3.org
[mailto:xmlschema-dev-request@w3.org] On Behalf Of Swayam Vemuri -X
(swvemuri - WIPRO at Cisco)
Sent: 06 March 2007 08:50
To: xmlschema-dev@w3.org
Subject: Attributes from a different namespace

Hi All,



Iam newbie regarding xml and xsd. I am facing below issue, Can
anyone please tell me a way out.



I have below schema - java1.xsd



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

<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by
Prakash Bettadapur (private) -->

<java:schema xmlns="http://www.cisco.com/efg/abc/java"

xmlns:java="http://www.w3.org/2001/XMLSchema"

attributeFormDefault="unqualified" elementFormDefault="qualified"

targetNamespace="http://www.cisco.com/efg/abc/java">

      <java:simpleType name="javaTypeOfReference">

            <java:restriction base="java:string">

                  <java:enumeration value="Set"/>

                  <java:enumeration value="Bag"/>

                  <java:enumeration value="List"/>

            </java:restriction>

      </java:simpleType>

      <java:attribute name="IsBridge" type="java:boolean"/>

</java:schema>





I have imported above xsd into below schema - base1.xsd, a
snippet of which is as shown below



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

<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by
Prakash Bettadapur (private) -->

<xs:schema

xmlns="http://www.cisco.com/efg/abc"

xmlns:xs="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified"

xmlns:java="http://www.cisco.com/efg/abc/java"

targetNamespace="http://www.cisco.com/efg/abc">

<xs:import namespace="http://www.cisco.com/efg/abc/java"
schemaLocation="java1.xsd"/>



....................................................................

<xs:complexType name="attributeType">

            <xs:sequence>

                  <xs:any minOccurs="0" namespace="##other"
processContents="lax"/>

                  <xs:element minOccurs="0" name="description"
type="xs:string"/>

                  <xs:element maxOccurs="unbounded" minOccurs="0"
ref="assert"/>

            </xs:sequence>

            <xs:attribute name="name" type="xs:string" use="required"/>

            <xs:attribute name="type" type="xs:string" use="required"/>


            <xs:attributeGroup ref="statusAttrGroup"/>

            <xs:attribute name="IsHidden" type="java:IsBridge"/> ----->
Error

            <xs:anyAttribute namespace="##other" processContents="lax"/>

      </xs:complexType>

....................

</xs:schema>



Iam getting error in base1.xsd saying

Problems were detected while validating and converting the XML
Schemas

  Error: XSD: Attribute reference
'http://www.cisco.com/efg/abc/java#IsBridge' is unresolved : URI
file:/D:/swayam/Polyphony/EFG_schema/abc_21.xsd Line 88 Column 3



Thanks

Swayam

Received on Wednesday, 7 March 2007 10:51:31 UTC