You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Chris Cuilla <ch...@cuilla.com> on 2003/04/08 17:55:42 UTC

(REVISED) multiple namespaces in a single document

[ NOTE: Minor revisions to previous post. I am now using Xerces 2.4.0. ]

I am using Xerces 2.4.0 to parse a document that is validated by an XML 
Schema.

My document looks like this:

<jx:Model
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns:jx="http://www.jxbeans.org/JXBeans-1_0"
		xmlns:wz="http://www.jxbeans.org/JXModeler-1_0"
		xsi:schemaLocation="http://www.jxbeans.org/JXBeans-1_0
					http://www.jxbeans.org/schema/JXBeans-1_0.xsd
					http://www.jxbeans.org/JXModeler-1_0
					http://www.jxbeans.org/schema/JXModeler-1_0.xsd"
		>

	<jx:Bean jx:ID="a">

		<!-- OTHER NAMESPACE ELEMENT HERE -->

		<wz:Location>
			<wz:X>1</wz:X>
			<wz:Y>1</wz:Y>
		</wz:Location>

		<!-- END OTHER NAMESPACE ELEMENT -->

		<jx:Class>org.jxbeans.SimpleDocumentGenerator</jx:Class>

		<jx:EventListener>
			<jx:Name>documentReady</jx:Name>
			<jx:Value>b</jx:Value>
		</jx:EventListener>
	</jx:Bean>

	<jx:Bean jx:ID="b" jx:IsFinal="true">
		<jx:Class>org.jxbeans.serializer.Serializer</jx:Class>

		<jx:Property>
			<jx:Name>fileName</jx:Name>
			<jx:Value>tests/A.xml</jx:Value>
		</jx:Property>
	</jx:Bean>

</jx:Model>

I have set the following features:

		http://xml.org/sax/features/namespaces
		http://apache.org/xml/features/validation/schema

Everything works fine if I do NOT include the "wz" elements. However, 
when I do, I get the following error:

cvc-complex-type.2.4.a: Invalid content starting with element 
'wz:Location'. One of '{"http://www.jxbeans.org/JXBeans-1_0":Class}' is 
expected.

What am I doing wrong here?

Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: (REVISED) multiple namespaces in a single document

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
In the schema for the element jx:Bean
(http://www.jxbeans.org/schema/JXBeans-1_0.xsd) there is a content model
(Class, EventListener*, Property*)
which does not allow any other elements.  You would need to change the
schema to permit whatever additional elements you want before the Class
element, regardless of what namespace they come from.  If you mention the
elements or types in the namespace corresponding to the prefix in the wz
namespace in the schema, you will need to include an import element which
imports that namespace.

Jeff

----- Original Message -----
From: "Chris Cuilla" <ch...@cuilla.com>
To: <xe...@xml.apache.org>
Sent: Tuesday, April 08, 2003 8:55 AM
Subject: (REVISED) multiple namespaces in a single document


> [ NOTE: Minor revisions to previous post. I am now using Xerces 2.4.0. ]
>
> I am using Xerces 2.4.0 to parse a document that is validated by an XML
> Schema.
>
> My document looks like this:
>
> <jx:Model
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:jx="http://www.jxbeans.org/JXBeans-1_0"
> xmlns:wz="http://www.jxbeans.org/JXModeler-1_0"
> xsi:schemaLocation="http://www.jxbeans.org/JXBeans-1_0
> http://www.jxbeans.org/schema/JXBeans-1_0.xsd
> http://www.jxbeans.org/JXModeler-1_0
> http://www.jxbeans.org/schema/JXModeler-1_0.xsd"
> >
>
> <jx:Bean jx:ID="a">
>
> <!-- OTHER NAMESPACE ELEMENT HERE -->
>
> <wz:Location>
> <wz:X>1</wz:X>
> <wz:Y>1</wz:Y>
> </wz:Location>
>
> <!-- END OTHER NAMESPACE ELEMENT -->
>
> <jx:Class>org.jxbeans.SimpleDocumentGenerator</jx:Class>
>
> <jx:EventListener>
> <jx:Name>documentReady</jx:Name>
> <jx:Value>b</jx:Value>
> </jx:EventListener>
> </jx:Bean>
>
> <jx:Bean jx:ID="b" jx:IsFinal="true">
> <jx:Class>org.jxbeans.serializer.Serializer</jx:Class>
>
> <jx:Property>
> <jx:Name>fileName</jx:Name>
> <jx:Value>tests/A.xml</jx:Value>
> </jx:Property>
> </jx:Bean>
>
> </jx:Model>
>
> I have set the following features:
>
> http://xml.org/sax/features/namespaces
> http://apache.org/xml/features/validation/schema
>
> Everything works fine if I do NOT include the "wz" elements. However,
> when I do, I get the following error:
>
> cvc-complex-type.2.4.a: Invalid content starting with element
> 'wz:Location'. One of '{"http://www.jxbeans.org/JXBeans-1_0":Class}' is
> expected.
>
> What am I doing wrong here?
>
> Chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org