[
Lists Home |
Date Index |
Thread Index
]
This helps very much. Thank you. I really hate that this is a catch-22. I
can't do this because it is in a different namespace from the UBL standard
namespace, and I can't do it in the same namespace as the UBL standard
namespace because it violates NDR and customization guidelines.
Any creative ideas?
-----Original Message-----
From: G. Ken Holman [mailto:gkholman@CraneSoftwrights.com]
Sent: Friday, April 21, 2006 3:57 PM
To: xml-dev@lists.xml.org
Subject: Re: [xml-dev] Newbie Schema Restriction Question
At 2006-04-21 14:51 -0400, Schneider, John Adam CAR wrote:
>I'm deriving types from UBL, some of which have elements which are required
>by the specification.
Your problem isn't UBL related, it is an issue with the derivation
you are attempting.
>I would like to derive the element types using
>restriction, and use the derived types instead of the base types. For
>example, I'd like to derive MyLineItemType from restriction of the UBL
>LineItemType and use MyLineItemType as an element within MyOrderLineType,
>which is derived from a restriction of the UBL OrderLineType. However, when
>I do this, I get the following error from the JAXB xjc utility:
>
>[ERROR] rcase-RecurseLax.2: There is not a complete functional mapping
>between t
>he particles.
> line 20 of
>file:/D:/Documents%20and%20Settings/chgtg6h/workspace/Order%20Inter
>face/src/xsd/annotated/test/Child.xsd
>
>[ERROR] derivation-ok-restriction.5.4.2: Error for type 'ChildType'. The
>partic
>le of the type is not a valid restriction of the particle of the base.
> line 20 of
>file:/D:/Documents%20and%20Settings/chgtg6h/workspace/Order%20Inter
>face/src/xsd/annotated/test/Child.xsd
That is telling you that your restriction is invalid.
>Here are the Schema files which I am using to test my requirements:
>
>Parent.xsd:
>...
> targetNamespace="parent"
>...
> <xsd:element name="Element" type="ElementType"/>
>...
> <xsd:complexType name="ParentType">
> <xsd:sequence>
> <xsd:element ref="Element" minOccurs="1"
maxOccurs="1"></xsd:element>
Okay ... so in parent:ParentType is made up of elements named
{parent}ElementType.
>Child.xsd:
>...
> targetNamespace="child"
>...
> <xsd:element name="Element" type="RestrictedElementType"
>...
> <xsd:complexType name="ChildType">
> <xsd:complexContent>
> <xsd:restriction base="parent:ParentType">
> <xsd:sequence>
> <xsd:element ref="Element" minOccurs="1"
Here you are indicating that the restricted content is made up of
elements named {child}ElementType.
>Why can't I do this?
Because these element names are in different namespaces, they are not
considered the same particle. So, an instance of your ChildType
type, which has {child}ElementType children, isn't a valid instance
of the {parent}ParentType you are deriving from.
>In this situation, the element "Element" in
>"ChildType" has a type which is valid derivation of the "ElementType" in my
>parent schema.
I don't see it as valid ... the child elements are in a different namespace.
>In the OO paradigm which I am familiar with, this is perfectly legal.
I think you are missing the namespace issue ... you've named your
child elements with a different namespace, which makes them different
even though the "local names" are the same.
>For example, here is essentially the same situation in Java:
I disagree ... the local names are the same, but in your W3C Schema
expressions you are using different namespaces, thus you are using
different qualified names.
I hope this helps.
.. . . . . . . ken
--
Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16
Also for XSLT/XSL-FO training: Minneapolis, MN 2006-07-31/08-04
Also for XML/XSLT/XSL-FO training:Birmingham,England 2006-05-22/25
Also for XSLT/XSL-FO training: Copenhagen,Denmark 2006-05-08/11
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>
The list archives are at http://lists.xml.org/archives/xml-dev/
To subscribe or unsubscribe from this list use the subscription
manager: <http://www.oasis-open.org/mlmanage/index.php>
|