Schema Validation over the network

0 views
Skip to first unread message

moon...@gmail.com

unread,
Sep 18, 2007, 3:33:51 PM9/18/07
to XML Schema
I've got a question which I think should be easy, but I have not been
able to find any way to get it to work as of yet. What I would like
to do is to setup a webserver that has all of my schema documents.
Then I would like to be able to reference these schema documents on
the webserver from my xml documents. From what I've been able to get
working, it seems that the schemaLocation references the schema from a
local perspective.
Thanks,
Jeff

George Cristian Bina

unread,
Sep 19, 2007, 3:09:18 AM9/19/07
to XML-S...@googlegroups.com
Hi Jeff,

No, there is no such limitation in the XML Schema specification. It may
be possible that you have no access to the resources on the server, for
instance if you are behind a proxy or behind a firewall.
Note also that you should be able to use also XML Catalogs to resolve
the references to the online version of the schemas to local copies of
those files - that is useful when working offline and when the
connection with the server is slow.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina - http://aboutxml.blogspot.com/
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Jeff Moon

unread,
Sep 19, 2007, 2:56:17 PM9/19/07
to XML-S...@googlegroups.com
I control the server and I can get to the schemas if I type them into
my browser, so I don't think that the problem is a proxy or firewall.
It gives me an error:

Error at file /home/jmoon/xmlServer/test.xml, line 4, char 87
Message: Schema in http://ws14.design.amis.com/test.xsd has a
different target namespace from the one specified in the instance
document http://ws14.design.amis.com/.

If you can help on this I can send you the schema I'm using and such
if that would help. I basically just want to get it working with a
really simple example.

<library
xmlns="http://ws14.design.amis.com"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://ws14.design.amis.com/
http://ws14.design.amis.com/test.xsd">
</library>

Errors occurred, no output available

moon...@gmail.com

unread,
Sep 19, 2007, 3:02:58 PM9/19/07
to XML Schema
I'm using the xerces validator, if that adds anything to the
discussion.

On Sep 19, 12:56 pm, "Jeff Moon" <moontu...@gmail.com> wrote:
> I control the server and I can get to the schemas if I type them into
> my browser, so I don't think that the problem is a proxy or firewall.
> It gives me an error:
>
> Error at file /home/jmoon/xmlServer/test.xml, line 4, char 87

> Message: Schema inhttp://ws14.design.amis.com/test.xsdhas a


> different target namespace from the one specified in the instance

> documenthttp://ws14.design.amis.com/.


>
> If you can help on this I can send you the schema I'm using and such
> if that would help. I basically just want to get it working with a
> really simple example.
>
> <library
> xmlns="http://ws14.design.amis.com"
> xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"

> xs:schemaLocation="http://ws14.design.amis.com/http://ws14.design.amis.com/test.xsd">


> </library>
>
> Errors occurred, no output available
>
> On 9/19/07, George Cristian Bina <geo...@oxygenxml.com> wrote:
>
>
>
> > Hi Jeff,
>
> > No, there is no such limitation in the XML Schema specification. It may
> > be possible that you have no access to the resources on the server, for
> > instance if you are behind a proxy or behind a firewall.
> > Note also that you should be able to use also XML Catalogs to resolve
> > the references to the online version of the schemas to local copies of
> > those files - that is useful when working offline and when the
> > connection with the server is slow.
>
> > Best Regards,
> > George
> > ---------------------------------------------------------------------

> > George Cristian Bina -http://aboutxml.blogspot.com/


> > <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> >http://www.oxygenxml.com
>

George Bina

unread,
Sep 20, 2007, 4:23:23 AM9/20/07
to XML Schema
Hi Jeff,

You have a namespace mismatch, see

You declare library element to be in the http://ws14.design.amis.com
namespace while when you associate the schema with the document you
use xs:schemaLocation="http://ws14.design.amis.com/
http://ws14.design.amis.com/test.xsd", note the trailing / at the end
of the namespace. Check the target namespace in your schema file and
make sure you use that both for the element declaration and inside the
schemaLocation attribute.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina - http://aboutxml.blogspot.com/

Jeff Moon

unread,
Sep 20, 2007, 11:37:31 AM9/20/07
to XML-S...@googlegroups.com
Here's the current full setup. I'm still getting similar errors:
test.xml:http://ws14.design.amis.com/test.xsd">
</library>

test.xsd:
<?xml version="1.0"?>
<xsd:schema
xmlns="http://ws14.design.amis.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
version="1.0">
<xsd:element name="library" type="xsd:string"/>
</xsd:schema>

Output:
> DOMCount -s -n -v=always -f test.xml

Error at file /home/jmoon/xmlServer/test.xml, line 5, char 60
Message: Schema in http://ws14.design.amis.com/test.xsd has a


different target namespace from the one specified in the instance

document http://ws14.design.amis.com.

Error at file /home/jmoon/xmlServer/test.xml, line 5, char 60
Message: Unknown element 'library'

Errors occurred, no output available


Any more help would be appreciated. I'm sort of a newbie with xml validation.
Thanks!

George Bina

unread,
Sep 20, 2007, 2:26:03 PM9/20/07
to XML Schema
The schema does not define a target namespace, you need

<xsd:schema
xmlns="http://ws14.design.amis.com"

targetNamespace="http://ws14.design.amis.com"


xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
version="1.0">

etc.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina -http://aboutxml.blogspot.com/

Jeff Moon

unread,
Sep 20, 2007, 2:33:04 PM9/20/07
to XML-S...@googlegroups.com
Thanks a ton, George! That was great. It's working wonderfully!

On 9/20/07, George Bina <geo...@oxygenxml.com> wrote:
>

Reply all
Reply to author
Forward
0 new messages