XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Steve CutbushSubject: Imports / Includes / Namespaces and oagis
Author: Steve Cutbush
Date: 08 Jun 2004 03:35 AM
Hi all.

I having some difficulties getting my head around namespaces & Stylus,
and am hoping someone can help me out!

We are resonably new to XML, so I have downloaded the oagis schema to
get me started.

I'm basically using the schema definitions as a basis for developing our
own schema. My goal is to create a schema in MY namespace that extends the
oagis base.

I have created a new schema file "v1.xsd" that operates in the oagis namespace,
and defines a new complex type that "includes" two of the oagis schema files, and
basically joins two complex elements (ItemDetail and SupplierReference).

I have then created a second schema file (v2.xsd). This one Imports v1.xsd,
and defines a new element that refers to the "combination" element created in v1.xsd.

All these schema's validate in Stylus (4.6 103v) just fine, however
when I try to build an XML document around this schema I run into all
sorts issues. (Most of the namespace issues have been resolved by using
the two schema's mentioned above).

Given the very simple XML doc:

<?xml version='1.0' ?>
<owgItems xsi:noNamespaceSchemaLocation="xln://intranet/bma/schema/Itemsv3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<owgItem>
<itemDetails><ItemId><Id>P453119</Id></ItemId></itemDetails>
<supplierReferences/>
</owgItem>
</owgItems>

Where owgItem is my joined complex element, I get the following validation
errors:

Untitled6.xml:4,24: Unknown element 'ItemId'
Untitled6.xml:4,28: Unknown element 'Id'
Untitled6.xml:4,63: Element 'ItemId' is not valid for content model: '(ItemId?,Type?,Variation?,Status?,UOM?,UOMType?,OwnershipCode?,SerialNumberSpecification?,((LotNumberSpecification?,LotSizeMultiplier?,MinimumLotSizeQuantity?,MaximumLotSizeQuantity?))?,OrganizationalUnit?,GLEntitySource?,GLNominalAccount?,LastModifiedDateTime?,UnitPackaging?,Property*,Note*,RoutingDisposition?,HazardousMaterial?,UOMGroupId?,AlternateUOM*,Value*,((DocumentReferences?,Attachments?))?)'

I cannot work out why it says that ItemID is unknown, yet then goes on to enumerate the
content model. In some previous incarnations of this I've even had
Stylus autocompleting my tags, yet then complaining that it doesn't know about them!

Am I battling a stylus bug, or a fundamental namespace understanding issue?

Can anyone suggest a better way of handling this?

Should I just rename the oagis schema with my own version & namespace?
(I kind of thought that that would be bad!)

Thanks in anticipation,

Steve Cutbush
Analyst Programmer
Orlando Wyndham Group.

Posttop
(Deleted User) Subject: Imports / Includes / Namespaces and oagis
Author: (Deleted User)
Date: 08 Jun 2004 08:58 AM
Hi Steve,

>[..]
>I have created a new schema file "v1.xsd" that operates in
>the oagis namespace, and defines a new complex type
>that "includes" two of the oagis schema files, and
>basically joins two complex elements (ItemDetail and
>SupplierReference).
>
>I have then created a second schema file (v2.xsd). This
>one Imports v1.xsd, and defines a new element that
>refers to the "combination" element created in v1.xsd.
>
>[..]
>Given the very simple XML doc:
>
><?xml version='1.0' ?>
><owgItems xsi:noNamespaceSchemaLocation="xln://intranet/bma/schema/Itemsv3.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <owgItem>
> <itemDetails>
> <ItemId><Id>P453119</Id></ItemId>
> </itemDetails>
> <supplierReferences/>
> </owgItem>
></owgItems>
>
>Where owgItem is my joined complex element, I get the following validation errors:
>
>Untitled6.xml:4,24: Unknown
>element 'ItemId'
>Untitled6.xml:4,28: Unknown
>element 'Id'

From what I see, the schema in v2.xsd has no targetNamespace, while v1.xsd creates elements and types in the OAGIS namespace.
This means that you need to place the elements from the OAGIS schema into the right namespace, or they will not be considered as valid children of owgItem.
For instance,

<owgItems xsi:noNamespaceSchemaLocation="xln://intranet/bma/schema/Itemsv3.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:oagis="http://www.openapplications.org/oagis">
<owgItem>
<itemDetails>
<oagis:ItemId><oagis:Id>P453119</oagis:Id></oagis:ItemId>
</itemDetails>
<supplierReferences/>
</owgItem>
</owgItems>

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.