Example of an XML document with an inline xml schema

W

WideBoy

Hi All,

I'm looking for a little example of an xml document which is validated
using an inline xml schema. I'm a bit of a newbie, and I'm finding
this to be a bit of a mind bender, so an example or some pointers which
show me how to achieve this would be much appreciated.

I look forward to any help or advice any one can offer.

Naran
 
H

Henry S. Thompson

Here's a trivial example

<arbitrarytag xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="#local">
<xs:schema id="local">
<xs:element name="root" type="xs:integer"/>
</xs:schema>
<root>35a</root>
</arbitrarytag>

At least XSV [1] will process this in the desired way.

ht

[1] http://www.ltg.ed.ac.uk/~ht/xsv-status.html
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 
W

Wide Boy

Hi Henry,

Thanks for your example, unfortunately it fails to validate in Altova's
XMLSpy. The failure message says:
Unable to load schema with target namespace "" from "#local"

Any ideas what this is trying to tell me and how I might fix it?

Regards,

Naran
 
H

Henry S. Thompson

Wide said:
Thanks for your example, unfortunately it fails to validate in Altova's
XMLSpy. The failure message says:
Unable to load schema with target namespace "" from "#local"
Any ideas what this is trying to tell me and how I might fix it?

Complain to Altova.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 
X

xmlBlueprint Team

replace #local with an URL to your xml schema, e.g.:

<rss version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.thearchitect.co.uk/schemas/rss-2_0.xsd">If your XML Schema has a namespace, you must use schemaLocation instead ofnoNamespaceSchemaLocation.- gerben www.xmlblueprint.com"Wide Boy" <[email protected]> wrote in messagenews:[email protected]...> Hi Henry,>> Thanks for your example, unfortunately it fails to validate in Altova's> XMLSpy. The failure message says:> Unable to load schema with target namespace "" from "#local">> Any ideas what this is trying to tell me and how I might fix it?>> Regards,>> Naran>>>>
 
W

WideBoy

Sorry, but this is not an option available to me as I'm trying to
generate an inline schema?
But #local clearly doesn't work with XMLSpy - any other ideas would be
most welcome.

Regards,

Naran
 
W

WideBoy

Stan,

I tried using and testing the resource on the page you refer to, but
unfortunately, it too does not seem to work within XMLSpy? It seems
XMLSpy does not like an XML doc that starts with <root> after the XML
PI. In addition it doesn't seem to like the other suggestions
mentioned at this url. So still waiting for something works or even
some one to tell me that this sort of thing can not be done in XML
schema. This would be v. strange and a retrograde step especially as
this is possible in DTDs, so what gives?

Any ideas or suggestions would be much appreciated.

Regards,

Naran
 
S

Stan Kitsis [MSFT]

Naran,

Just because one of the tools thinks something is invalid, doesn't mean it
is. As Henry Thompson said in his earlier post, complain to the tool vendor
about the problems. When it comes to schema-related questions, Henry is
usually the ultimate authority - after all, he's one of the main people
behind the W3C Schema spec.

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top