[jdom-interest] Namespace issues, et al.

Malachi de AElfweald malachi at tremerechantry.com
Sun Feb 23 14:44:38 PST 2003


Ok, I misunderstood you guys. I thought you were saying that I had to 
change all that
to <jbase:request jbase:session=""/>. The point I was trying to make is 
that it is perfectly valid
(though my personal Schema says not to allow it) for <jbase:request 
yourname:session=""/>. What I was
trying to say about the spec was that <request session=""/> puts 'session' 
into the namespace of the 'request'
element (as opposed to the 'yourname' namespace above), thus not needing to 
explicitely put jbase:session...

As far as your question, you can read it, but not create or validate it.

If you try to create that document, you get one of two scenarios...
1) every element says xmlns="http://www.temporal-wave.com/spec" (thus, lots 
of overhead over the network)
2) the top element says that, the next one says xmlns="", and then 
everything inside that doesn't show xmlns at all.

Thus, my original request to quit adding xmlns="", as that disables the 
current namespace and sets it to null. Thus,
every items inside that is invalid.

On the validation side... if I try to validate it as done on the JDOM FAQ 
(or on the various suggestions from the list),
I get a ClassCastException in Xerces. If I use Xerces directly, it 
correctly validates.  Read a few emails ago, there was
a link to the bug report I submitted to Apache....

Malachi



On Sun, 23 Feb 2003 17:33:23 -0500 (EST), bob mcwhirter <bob at werken.com> 
wrote:

>
> 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