Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » TextNode does not contain the TargetNamespace
TextNode does not contain the TargetNamespace [message #58674] Tue, 22 March 2005 15:46 Go to next message
Eclipse UserFriend
Originally posted by: runinpanic.gmx.de

Hello

I have the following situation:

Using this Schema (the relevant part only):

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="tests_localised_Schema"
targetNamespace="tests_localised_Schema">

<xs:complexType name="ct.alpha">
<xs:sequence minOccurs="1" maxOccurs="5">
<xs:element name="uno" type="st.uno" />
<xs:element name="duo" type="st.duo" />
<xs:element name="tres" type="ct.tres" />
</xs:sequence>
<xs:attribute name="opt" type="xs:token" />
</xs:complexType>

<xs:simpleType name="st.uno">
<xs:restriction base="xs:string">
<xs:enumeration value="hinz" />
<xs:enumeration value="kunz" />
</xs:restriction>
</xs:simpleType>


.... and reading a jDOM-object that is created using this Schema.


When getting the first TextNode (a jDOM "Text" object representing
"st.uno") I try to get the targetNamespace of the object using:

if (jdomObj instanceof Text) {
namespace = ((Text)jdomObj)
.getParentElement()
.getNamespaceURI();
}

The String "namespace" is empty ("").

Then I saw that this jDOM-object got its namespace from this code:

public ElementDeclaration(XSDElementDeclaration edecl, ...) {
...
String targetns = edecl.getTargetNamespace();
resultEle.setNamespace(Namespace.getNamespace(targetns));
...
Text txt = new Text(temp);
resultEle.addContent(txt);

checking the XSDElementDeclaration edecl I saw, that it did not hold a
targetNamespace (targetNamespace= null) but following the
"eContainer"-Attribute of "edecl" up to the complexType "ct.alpha"
taught me that the targetNamespace exists only in an upper level

edecl= XSDElementDeclarationImpl (id=33)
targetNamespace= null
eContainer= XSDParticleImpl (id=116)
eContainer= XSDModelGroupImpl (id=142)
eContainer= XSDParticleImpl (id=151)
eContainer= XSDComplexTypeDefinitionImpl (id=158)
name= "ct.alpha"
targetNamespace= "tests_localised_Schema"


My question:

Is this correct? Is the targetNamespace not inherited from complexTypes
to hierarchically lower TextNodes?
Re: TextNode does not contain the TargetNamespace [message #58700 is a reply to message #58674] Tue, 22 March 2005 16:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Hajo,

I'm not sure what you are referring to with jDOM-object, and the code
you show that creates a Text node doesn't look familiar either. I don't
think Text nodes are supposed to have a namespace in DOM, so maybe your
question isn't valid. In any event, in your schema, the element
declarations are local declarations, and, by default, their form is
unqualified, so they will have null target namespace as defined in the
XML Schema specification regardless of the namespace of the schema or of
their containing complex type.


Hajo Hoffmann wrote:

>Hello
>
>I have the following situation:
>
>Using this Schema (the relevant part only):
>
><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="tests_localised_Schema"
> targetNamespace="tests_localised_Schema">
>
><xs:complexType name="ct.alpha">
> <xs:sequence minOccurs="1" maxOccurs="5">
> <xs:element name="uno" type="st.uno" />
> <xs:element name="duo" type="st.duo" />
> <xs:element name="tres" type="ct.tres" />
> </xs:sequence>
> <xs:attribute name="opt" type="xs:token" />
></xs:complexType>
>
><xs:simpleType name="st.uno">
> <xs:restriction base="xs:string">
> <xs:enumeration value="hinz" />
> <xs:enumeration value="kunz" />
> </xs:restriction>
></xs:simpleType>
>
>
>... and reading a jDOM-object that is created using this Schema.
>
>
>When getting the first TextNode (a jDOM "Text" object representing
>"st.uno") I try to get the targetNamespace of the object using:
>
> if (jdomObj instanceof Text) {
> namespace = ((Text)jdomObj)
> .getParentElement()
> .getNamespaceURI();
> }
>
>The String "namespace" is empty ("").
>
>Then I saw that this jDOM-object got its namespace from this code:
>
> public ElementDeclaration(XSDElementDeclaration edecl, ...) {
> ...
> String targetns = edecl.getTargetNamespace();
> resultEle.setNamespace(Namespace.getNamespace(targetns));
> ...
> Text txt = new Text(temp);
> resultEle.addContent(txt);
>
>checking the XSDElementDeclaration edecl I saw, that it did not hold a
>targetNamespace (targetNamespace= null) but following the
>"eContainer"-Attribute of "edecl" up to the complexType "ct.alpha"
>taught me that the targetNamespace exists only in an upper level
>
> edecl= XSDElementDeclarationImpl (id=33)
> targetNamespace= null
> eContainer= XSDParticleImpl (id=116)
> eContainer= XSDModelGroupImpl (id=142)
> eContainer= XSDParticleImpl (id=151)
> eContainer= XSDComplexTypeDefinitionImpl (id=158)
> name= "ct.alpha"
> targetNamespace= "tests_localised_Schema"
>
>
>My question:
>
>Is this correct? Is the targetNamespace not inherited from complexTypes
>to hierarchically lower TextNodes?
>
>
Re: TextNode does not contain the TargetNamespace [message #58723 is a reply to message #58700] Tue, 22 March 2005 17:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: runinpanic.gmx.de

Okay ...

maybe i should not have mentioned the jDOM-object.

The essence of my problem lies in the XSDElementDeclaration:

> > edecl= XSDElementDeclarationImpl (id=33)
name= "uno"
> > targetNamespace= null
> > eContainer= XSDParticleImpl (id=116)
> > eContainer= XSDModelGroupImpl (id=142)
> > eContainer= XSDParticleImpl (id=151)
> > eContainer= XSDComplexTypeDefinitionImpl (id=158)
> > name= "ct.alpha"
> > targetNamespace= "tests_localised_Schema"

Why does the upper "targetNamespace" not contain
"tests_localised_Schema" while the lower one does? I hope the origin of
this structure is clear.

Why is the actual form of the Schema unqualified?
I double-triple-quadruple-checked it with Xerces :-/

Regards
Hajo Hoffmann


In article <d1pmug$95s$1@news.eclipse.org>, Ed Merks <merks@ca.ibm.com>
wrote:

> Hajo,
>
> I'm not sure what you are referring to with jDOM-object, and the code
> you show that creates a Text node doesn't look familiar either. I don't
> think Text nodes are supposed to have a namespace in DOM, so maybe your
> question isn't valid. In any event, in your schema, the element
> declarations are local declarations, and, by default, their form is
> unqualified, so they will have null target namespace as defined in the
> XML Schema specification regardless of the namespace of the schema or of
> their containing complex type.
>
>
> Hajo Hoffmann wrote:
>
> >Hello
> >
> >I have the following situation:
> >
> >Using this Schema (the relevant part only):
> >
> ><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns="tests_localised_Schema"
> > targetNamespace="tests_localised_Schema">
> >
> ><xs:complexType name="ct.alpha">
> > <xs:sequence minOccurs="1" maxOccurs="5">
> > <xs:element name="uno" type="st.uno" />
> > <xs:element name="duo" type="st.duo" />
> > <xs:element name="tres" type="ct.tres" />
> > </xs:sequence>
> > <xs:attribute name="opt" type="xs:token" />
> ></xs:complexType>
> >
> ><xs:simpleType name="st.uno">
> > <xs:restriction base="xs:string">
> > <xs:enumeration value="hinz" />
> > <xs:enumeration value="kunz" />
> > </xs:restriction>
> ></xs:simpleType>
> >
> >
> >... and reading a jDOM-object that is created using this Schema.
> >
> >
> >When getting the first TextNode (a jDOM "Text" object representing
> >"st.uno") I try to get the targetNamespace of the object using:
> >
> > if (jdomObj instanceof Text) {
> > namespace = ((Text)jdomObj)
> > .getParentElement()
> > .getNamespaceURI();
> > }
> >
> >The String "namespace" is empty ("").
> >
> >Then I saw that this jDOM-object got its namespace from this code:
> >
> > public ElementDeclaration(XSDElementDeclaration edecl, ...) {
> > ...
> > String targetns = edecl.getTargetNamespace();
> > resultEle.setNamespace(Namespace.getNamespace(targetns));
> > ...
> > Text txt = new Text(temp);
> > resultEle.addContent(txt);
> >
> >checking the XSDElementDeclaration edecl I saw, that it did not hold a
> >targetNamespace (targetNamespace= null) but following the
> >"eContainer"-Attribute of "edecl" up to the complexType "ct.alpha"
> >taught me that the targetNamespace exists only in an upper level
> >
> > edecl= XSDElementDeclarationImpl (id=33)
> > targetNamespace= null
> > eContainer= XSDParticleImpl (id=116)
> > eContainer= XSDModelGroupImpl (id=142)
> > eContainer= XSDParticleImpl (id=151)
> > eContainer= XSDComplexTypeDefinitionImpl (id=158)
> > name= "ct.alpha"
> > targetNamespace= "tests_localised_Schema"
> >
> >
> >My question:
> >
> >Is this correct? Is the targetNamespace not inherited from complexTypes
> >to hierarchically lower TextNodes?
> >
> >
Re: TextNode does not contain the TargetNamespace [message #58749 is a reply to message #58723] Tue, 22 March 2005 17:31 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------080604090006030407000905
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hajo,

The specification defines the value of the targetNamespace for a local
element declaration like this:

An element declaration as in the first case above, with the
exception of its {target namespace} <#e-target_namespace> and
{scope} <#e-scope> properties, which are as below:

Element Declaration <#Element_Declaration_details>* Schema Component*
Property Representation
{target namespace} <#e-target_namespace> If |form| is present and
its
Re: TextNode does not contain the TargetNamespace [message #594550 is a reply to message #58674] Tue, 22 March 2005 16:47 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Hajo,

I'm not sure what you are referring to with jDOM-object, and the code
you show that creates a Text node doesn't look familiar either. I don't
think Text nodes are supposed to have a namespace in DOM, so maybe your
question isn't valid. In any event, in your schema, the element
declarations are local declarations, and, by default, their form is
unqualified, so they will have null target namespace as defined in the
XML Schema specification regardless of the namespace of the schema or of
their containing complex type.


Hajo Hoffmann wrote:

>Hello
>
>I have the following situation:
>
>Using this Schema (the relevant part only):
>
><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="tests_localised_Schema"
> targetNamespace="tests_localised_Schema">
>
><xs:complexType name="ct.alpha">
> <xs:sequence minOccurs="1" maxOccurs="5">
> <xs:element name="uno" type="st.uno" />
> <xs:element name="duo" type="st.duo" />
> <xs:element name="tres" type="ct.tres" />
> </xs:sequence>
> <xs:attribute name="opt" type="xs:token" />
></xs:complexType>
>
><xs:simpleType name="st.uno">
> <xs:restriction base="xs:string">
> <xs:enumeration value="hinz" />
> <xs:enumeration value="kunz" />
> </xs:restriction>
></xs:simpleType>
>
>
>... and reading a jDOM-object that is created using this Schema.
>
>
>When getting the first TextNode (a jDOM "Text" object representing
>"st.uno") I try to get the targetNamespace of the object using:
>
> if (jdomObj instanceof Text) {
> namespace = ((Text)jdomObj)
> .getParentElement()
> .getNamespaceURI();
> }
>
>The String "namespace" is empty ("").
>
>Then I saw that this jDOM-object got its namespace from this code:
>
> public ElementDeclaration(XSDElementDeclaration edecl, ...) {
> ...
> String targetns = edecl.getTargetNamespace();
> resultEle.setNamespace(Namespace.getNamespace(targetns));
> ...
> Text txt = new Text(temp);
> resultEle.addContent(txt);
>
>checking the XSDElementDeclaration edecl I saw, that it did not hold a
>targetNamespace (targetNamespace= null) but following the
>"eContainer"-Attribute of "edecl" up to the complexType "ct.alpha"
>taught me that the targetNamespace exists only in an upper level
>
> edecl= XSDElementDeclarationImpl (id=33)
> targetNamespace= null
> eContainer= XSDParticleImpl (id=116)
> eContainer= XSDModelGroupImpl (id=142)
> eContainer= XSDParticleImpl (id=151)
> eContainer= XSDComplexTypeDefinitionImpl (id=158)
> name= "ct.alpha"
> targetNamespace= "tests_localised_Schema"
>
>
>My question:
>
>Is this correct? Is the targetNamespace not inherited from complexTypes
>to hierarchically lower TextNodes?
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: TextNode does not contain the TargetNamespace [message #594560 is a reply to message #58700] Tue, 22 March 2005 17:16 Go to previous message
Eclipse UserFriend
Originally posted by: runinpanic.gmx.de

Okay ...

maybe i should not have mentioned the jDOM-object.

The essence of my problem lies in the XSDElementDeclaration:

> > edecl= XSDElementDeclarationImpl (id=33)
name= "uno"
> > targetNamespace= null
> > eContainer= XSDParticleImpl (id=116)
> > eContainer= XSDModelGroupImpl (id=142)
> > eContainer= XSDParticleImpl (id=151)
> > eContainer= XSDComplexTypeDefinitionImpl (id=158)
> > name= "ct.alpha"
> > targetNamespace= "tests_localised_Schema"

Why does the upper "targetNamespace" not contain
"tests_localised_Schema" while the lower one does? I hope the origin of
this structure is clear.

Why is the actual form of the Schema unqualified?
I double-triple-quadruple-checked it with Xerces :-/

Regards
Hajo Hoffmann


In article <d1pmug$95s$1@news.eclipse.org>, Ed Merks <merks@ca.ibm.com>
wrote:

> Hajo,
>
> I'm not sure what you are referring to with jDOM-object, and the code
> you show that creates a Text node doesn't look familiar either. I don't
> think Text nodes are supposed to have a namespace in DOM, so maybe your
> question isn't valid. In any event, in your schema, the element
> declarations are local declarations, and, by default, their form is
> unqualified, so they will have null target namespace as defined in the
> XML Schema specification regardless of the namespace of the schema or of
> their containing complex type.
>
>
> Hajo Hoffmann wrote:
>
> >Hello
> >
> >I have the following situation:
> >
> >Using this Schema (the relevant part only):
> >
> ><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns="tests_localised_Schema"
> > targetNamespace="tests_localised_Schema">
> >
> ><xs:complexType name="ct.alpha">
> > <xs:sequence minOccurs="1" maxOccurs="5">
> > <xs:element name="uno" type="st.uno" />
> > <xs:element name="duo" type="st.duo" />
> > <xs:element name="tres" type="ct.tres" />
> > </xs:sequence>
> > <xs:attribute name="opt" type="xs:token" />
> ></xs:complexType>
> >
> ><xs:simpleType name="st.uno">
> > <xs:restriction base="xs:string">
> > <xs:enumeration value="hinz" />
> > <xs:enumeration value="kunz" />
> > </xs:restriction>
> ></xs:simpleType>
> >
> >
> >... and reading a jDOM-object that is created using this Schema.
> >
> >
> >When getting the first TextNode (a jDOM "Text" object representing
> >"st.uno") I try to get the targetNamespace of the object using:
> >
> > if (jdomObj instanceof Text) {
> > namespace = ((Text)jdomObj)
> > .getParentElement()
> > .getNamespaceURI();
> > }
> >
> >The String "namespace" is empty ("").
> >
> >Then I saw that this jDOM-object got its namespace from this code:
> >
> > public ElementDeclaration(XSDElementDeclaration edecl, ...) {
> > ...
> > String targetns = edecl.getTargetNamespace();
> > resultEle.setNamespace(Namespace.getNamespace(targetns));
> > ...
> > Text txt = new Text(temp);
> > resultEle.addContent(txt);
> >
> >checking the XSDElementDeclaration edecl I saw, that it did not hold a
> >targetNamespace (targetNamespace= null) but following the
> >"eContainer"-Attribute of "edecl" up to the complexType "ct.alpha"
> >taught me that the targetNamespace exists only in an upper level
> >
> > edecl= XSDElementDeclarationImpl (id=33)
> > targetNamespace= null
> > eContainer= XSDParticleImpl (id=116)
> > eContainer= XSDModelGroupImpl (id=142)
> > eContainer= XSDParticleImpl (id=151)
> > eContainer= XSDComplexTypeDefinitionImpl (id=158)
> > name= "ct.alpha"
> > targetNamespace= "tests_localised_Schema"
> >
> >
> >My question:
> >
> >Is this correct? Is the targetNamespace not inherited from complexTypes
> >to hierarchically lower TextNodes?
> >
> >
Re: TextNode does not contain the TargetNamespace [message #594567 is a reply to message #58723] Tue, 22 March 2005 17:31 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080604090006030407000905
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hajo,

The specification defines the value of the targetNamespace for a local
element declaration like this:

An element declaration as in the first case above, with the
exception of its {target namespace} <#e-target_namespace> and
{scope} <#e-scope> properties, which are as below:

Element Declaration <#Element_Declaration_details>* Schema Component*
Property Representation
{target namespace} <#e-target_namespace> If |form| is present and
its


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:TextNode does not contain the TargetNamespace
Next Topic:Problem validating a reference to xsd:schema
Goto Forum:
  


Current Time: Thu Apr 25 09:52:39 GMT 2024

Powered by FUDForum. Page generated in 0.03517 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top