Example of an XML document with an inline xml schema

Discussion in 'XML' started by WideBoy, Dec 12, 2005.

  1. WideBoy

    WideBoy Guest

    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
    WideBoy, Dec 12, 2005
    #1
    1. Advertising

  2. 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:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
    Henry S. Thompson, Dec 13, 2005
    #2
    1. Advertising

  3. WideBoy

    Wide Boy Guest

    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



    *** Sent via Developersdex http://www.developersdex.com ***
    Wide Boy, Dec 13, 2005
    #3
  4. Wide Boy writes:

    > 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:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
    Henry S. Thompson, Dec 14, 2005
    #4
  5. 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" <> wrote in messagenews:k2Anf.8$...> 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>>>> *** Sent via Developersdex http://www.developersdex.com ***
    xmlBlueprint Team, Dec 21, 2005
    #5
  6. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/inlschma.asp

    --
    Stan Kitsis
    Program Manager, XML Technologies
    Microsoft Corporation

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

    "WideBoy" <> wrote in message
    news:...
    > 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
    >
    Stan Kitsis [MSFT], Dec 21, 2005
    #6
  7. WideBoy

    WideBoy Guest

    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
    WideBoy, Dec 22, 2005
    #7
  8. WideBoy

    WideBoy Guest

    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
    WideBoy, Dec 22, 2005
    #8
  9. 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.


    "WideBoy" <> wrote in message
    news:...
    > 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
    >
    Stan Kitsis [MSFT], Dec 22, 2005
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page