Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: No, I Don't Want No Namespace!

From: George Cristian Bina <george@---------.--->
To: Tyson Tate <tytate@-----.-------.--->
Date: 11/23/2005 5:22:00 AM
Hi Tyson,

Just change

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:cdm="http://www.xyzcorp.com/ctypes"
xmlns="http://www.xyzcorp.com/Vessel"
targetNamespace="http://www.xyzcorp.com/Vessel"
elementFormDefault="unqualified" attributeFormDefault="unqualified">


to

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:cdm="http://www.xyzcorp.com/ctypes"
xmlns="http://www.xyzcorp.com/Vessel"
targetNamespace="http://www.xyzcorp.com/Vessel"
elementFormDefault="qualified" attributeFormDefault="unqualified">

--------------------^^^^^^^^^

Your VesselBase element is declared locally and if you set the 
elementFormDefault to unqualified then all the local element 
declarations go to no namespace instead of target namespace and in your 
XML document the VesselBase element is in the 
http://www.xyzcorp.com/Vessel (target) namespace. To have the local 
elements in the target namespace you need to have the element form set 
to qualified.

Best Regards,
George	
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com


Tyson Tate wrote:
> 
> I'm having something of a cryptic namespace problem and I simply can't 
> seem to worm my way out of it. Basically, I've been given XML files that 
> I can not modify and I wrote a schema to match them. The xml files look 
> something like the following:
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Vessel xmlns="http://www.xyzcorp.com/Vessel" 
> xmlns:cdm="http://www.xyzcorp.com/cdmtypes" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xsi:schemaLocation="www.xyzcorp.com/Vessel
> C:\path\to\schema\Vessel2.xsd">
>     <VesselBase>
>         <TrimStability>
> ............
> 
> 
> The related schema looks like so:
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
> xmlns:cdm="http://www.xyzcorp.com/ctypes" 
> xmlns="http://www.xyzcorp.com/Vessel" 
> targetNamespace="http://www.xyzcorp.com/Vessel" 
> elementFormDefault="unqualified" attributeFormDefault="unqualified">
>     <xs:import namespace="http://www.xyzcorp.com/ctypes" 
> schemaLocation="ctypes.xsd"/>
>     <xs:element name="Vessel" type="VesselType">
>     </xs:element>
>     <xs:complexType name="VesselType">
>         <xs:sequence>
>             <xs:element name="VesselBase" type="VesselBaseType"/>
>         </xs:sequence>
>     </xs:complexType>
> .............
> 
> 
> My problem is that it doesn't validate. XMLSpy 2005 gives me this 
> wonderfully useful error message: "Unexpected element 'VesselBase' in 
> element 'Vessel'. Expected: VesselBase" (Isn't that helpful?) Using an 
> in-house Java 1.5-based validation tool (uses the Java-supplied XML 
> classes), I get: "XML Fatal Error: On line 2, column 329, the following 
> fatal error occurred: cvc-elt.1: Cannot find the declaration of element 
> 'Vessel'."
> 
> Based on that second error message, I'm assuming this is a namespace 
> issue. Am I wrong? Despite having worked with XML for months now, I 
> still can't get namespaces straight. Very frustrating. :-/
> 
> Thanks in advance,
> Tyson Tate
> Developer, CADRC
> 
> 

From mike@s... Wed Nov 23 13:17:18 2005
Received: from lisa.w3.org ([128.30.52.41])
	by frink.w3.org with esmtp (Exim 4.


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent