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 #594537] Tue, 22 March 2005 15:46
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?
Previous Topic:POLL: Looking for head count & feedback from Max OS X users (Attn: Mac Users / Developers / Depl
Next Topic:TextNode does not contain the TargetNamespace
Goto Forum:
  


Current Time: Tue Apr 23 09:06:50 GMT 2024

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

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

Back to the top