logo       

Related Msgs: audio.musicbrai...    enbd.general/20...    ietf.idr/2002-0...    java.ant-contri...    gnu.make.genera...    qplus.devel/200...    video.freevo.cv...    os.netbsd.ports...    yellowdog.gener...    xfree86.cvs/200...    search.nutch.us...    freedesktop.xse...    programming.swi...    capabilities.ge...    telephony.pbx.a...    mail.sylpheed.c...    db.firebase.por...    boot-loaders.u-...    recreation.radi...    netbsd.bugs/200...    web.zope.plone....    user-groups.lin...   

Re: XML Schema + Namespace Issues: msg#00073

Subject: Re: XML Schema + Namespace Issues
Thanks for everyone's detailed answers, this is very helpful!

-Sean

On 10/20/06, Stanimir Stamenkov <stanio@xxxxxxxxxxxxx> wrote:
/Sean McCauliff/:

> 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.
[...]
> 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.

Element "b" _is_ in the "http://eslug.net"; namespace - all
top-level/global components have the 'targetNamespace' of the schema
they are defined in.

> 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>
[...]
> 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?

You may take a look at "3 Advanced Concepts I: Namespaces, Schemas &
Qualification" <http://www.w3.org/TR/xmlschema-0/#NS>, "3.1 Target
Namespaces & Unqualified Locals", "3.2 Qualified Locals". So as far
as I understand you just need to set
|elementFormDefault="qualified"| on the <schema> element.

You may also see how the {target namespace} of an element
declaration (for example) is determined from its representation
<http://www.w3.org/TR/xmlschema-1/#element-element>:

> If the <element> element information item has <schema> as its
> parent, the corresponding schema component is as follows:
>
> {target namespace}    The ·actual value· of the targetNamespace
> [attribute] of the parent <schema> element information item, or
> ·absent· if there is none.
> [...]
>
> otherwise if the <element> element information item has
> <complexType> or <group> as an ancestor and the ref [attribute] is
> absent...
>
> {target namespace}    If form is present and its ·actual value· is
> qualified, or if form is absent and the ·actual value· of
> elementFormDefault on the <schema> ancestor is qualified, then the
> ·actual value· of the targetNamespace [attribute] of the parent
> <schema> element information item, or ·absent· if there is none,
> otherwise ·absent·.

--
Stanimir

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



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo