[jdom-interest] Namespace issues, et al.
bob mcwhirter
bob at werken.com
Sun Feb 23 14:33:23 PST 2003
1) The targetNamespace in the <xsd:schema> defines the
namespace for the elements defined. Thus, <request> is in the
http://www.temporal-wave.com/spec/ namespace.
2) The definition for <request> specifies a local attribute
named 'session'.
3) You example doc uses a default namespace of http://www.temporal-wave.com/spec/
so the unadorned <request> tag is in the correct namespace, and the
unprefexed @session attribute is correct.
So, yes, you have a document that matches your schema.
This doesn't affect the namespacing of the attributes. The @session attribute
can't be willy-nilly glued to any other element. It's defined as a local
attribute on the <request> element. It has no namespace.
When you say you can't build this in JDOM, what exactly happens? Should
be perfectly easy to read/build/write documents like this.
-bob
On Sun, 23 Feb 2003, Malachi de AElfweald wrote:
> I am confused as well. My Schema (based off the one at w3schools) does not
> explicitely mention the namespace except for
> in the root element. I am not using xpath in it directly... the top of my
> schema:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.temporal-wave.com/spec"
> xmlns="http://www.temporal-wave.com/spec"
> elementFormDefault="qualified">
> <xsd:element name="objex">
> <xsd:complexType>
> <xsd:choice>
> <xsd:element name="request">
> <xsd:complexType>
> <xsd:choice>
> <xsd:element name="jedi" type="jediReq"/>
> <xsd:element name="jconnection" type="jconnectionReq"/>
> </xsd:choice>
> <xsd:attribute name="session" type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="response">
> <xsd:complexType>
> <xsd:choice>
> <xsd:element name="selectList" type="selectListResp"/>
> <xsd:element name="confirmation" type="confirmationResp"/>
> <xsd:element name="record" type="recordResp"/>
> <xsd:element name="call" type="callResp"/>
> </xsd:choice>
> <xsd:attribute name="session" type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> </xsd:choice>
> </xsd:complexType>
> </xsd:element>
> ..... pages more here.....
>
> and an example XML conforming to said Schema:
> <?xml version="1.0" encoding="UTF-8"?>
> <objex xmlns="http://www.temporal-wave.com/spec"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.temporal-wave.com/spec jbase.xsd">
> <request session="1234567890987654321">
> <jedi name="myData">
> <read recordKey="data001" blockedRead="true" attributeNum="3"/>
> </jedi>
> </request>
> </objex>
More information about the jdom-interest
mailing list