logo       


Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: XML Schema + Namespace Issues: msg#00067

Subject: Re: XML Schema + Namespace Issues
I think you should then use <xsd:schema elementFormDefault="qualified"

Regards
Dick Deneer
Op 20-okt-2006, om 7:19 heeft Sean McCauliff het volgende geschreven:

I have a schema file where I define two complex types and one of the
complex types defines an element with the type of the other complex
type.  When I write an instance file the enclosed element is in an
empty namespace instead of being defined in the name space of the type
or of the enclosing element.  See instance_a.xml and schema_a.xsd
below.

schema_a.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
          targetNamespace="http://eslug.net";
          xmlns="http://eslug.net";

 <xsd:complexType name="bType">
<xsd:attribute name="anotherattr" type="xsd:string" use="required" />
  </xsd:complexType>

 <xsd:complexType name="aType">
    <xsd:sequence>
<xsd:element name="b" type="bType" minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="someattr" type="xsd:string" />
 </xsd:complexType>

 <xsd:element name="a" type="aType" />

</xsd:schema>

instance_a.xml
<blah:a xmlns:blah="http://eslug.net"; someattr="blah"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xsi:schemaLocation=
            "http://eslug.net file:schema_a.xsd"

 <!-- element b, below does not need to have the "blah:" ns prefix
inorder to be valid.
       It is in the empty namespace.
  -->
 <b anotherattr="blah" />
</blah:a>


If I change the schema so that the bType is defined as an element
instead.  Then "b" is not in the http://eslug.net namespace.

schema_b.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
          targetNamespace="http://eslug.net";
          xmlns="http://eslug.net";

 <xsd:element name="b">
   <xsd:complexType >
<xsd:attribute name="anotherattr" type="xsd:string" use="required" />
   </xsd:complexType>
 </xsd:element>

 <xsd:element name="a" >
   <xsd:complexType >
      <xsd:sequence>
        <xsd:element ref="b" maxOccurs="unbounded" />
      </xsd:sequence>
      <xsd:attribute name="someattr" type="xsd:string" />
   </xsd:complexType>
 </xsd:element>


</xsd:schema>

instance_b.xml
<blah:a xmlns:blah="http://eslug.net"; someattr="blah"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xsi:schemaLocation=
            "http://eslug.net file:schema_b.xsd"

 <!-- b is now in the correct namespace. -->
 <blah:b anotherattr="blah" />
</blah:a>

I would rather use schema a, but elements of "bType" only seem to show
up in the empty namespace forcing me to use schema_b.

Is this a bug or there some misunderstanding with how namespaces are
assigned to compexTypes in xml schema?

Thanks,
-Sean

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx





Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe