how to validate two XML against XSD?

Discussion in 'XML' started by Rushi, Dec 7, 2005.

  1. Rushi

    Rushi Guest

    Hi All,

    Is it possible to Validate XML against XSD using two different XML
    files.

    scenario:
    There are two different XML file, one file contain element and count
    information and other one contain name and other information like
    color, weight etc.....
    They are linked by XLink...

    Below are two files Testing-Element.xml and Testing-View.xml.

    Now element file contain element information like id and count. And
    linkbasefile (Testing-View.xml) contain display information.

    Now I want to generate a XML Schema, which will validate for a
    particular element count is less then 10 then color must be red
    otherwise color must be blue.

    Notice: there is no any import xml working here.

    <!-- Testing-Element.xml -->
    <?xml version="1.0" encoding="utf-8"?>
    <appinfo>
    <link:linkbaseRef xlink:type="simple" xlink:href="Testing-View.xml"
    xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" />
    </appinfo>
    <element id="ims_cat" count="15" />
    <element id="ims_dog" count="8" />
    <element id="ims_pig" count="10" />
    <element id="ims_hen" count="20" />


    <!-- Testing-View.xml -->
    <?xml version="1.0" encoding="utf-8"?>
    <linkbase xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xlink="http://www.w3.org/1999/xlink" >
    <labelLink xlink:type="extended"
    xlink:role="http://www.xbrl.org/2003/role/link">

    <loc xlink:type="locator" xlink:href="Testing-Element.xml#ims_cat"
    xlink:label="ims_cat1_lbl" />
    <label xlink:type="resource" xlink:label="ims_cat1_lbl"
    color="blue">Cats are available</label>

    <loc xlink:type="locator" xlink:href="Testing-Element.xml#ims_dog"
    xlink:label="ims_dog1_lbl" />
    <label xlink:type="resource" xlink:label="ims_dog1_lbl"
    xml:lang="en" color="red">Dogs are out of stock</label>
    </labelLink>
    </linkbase>

    Legends
    <loc> element: this will link view file to element file, check
    xlink:href attribute. And define the alias for element in
    xlink:label="ims_cat1_lbl"
    <label> element: this will link display property to alias id of
    element. (ie xlink:label="ims_cat1_lbl" of <loc> must be match with
    xlink:label="ims_cat1_lbl" of <label> to link them....

    I am repeating my quesiton
    Is it possible to Validate XML against XSD using two different XML
    files. using XLink, XPointer, XPath ...or whatever u want

    Thanks & Regards
    Rushikesh
     
    Rushi, Dec 7, 2005
    #1
    1. Advertising

  2. You need a pipeline which implements your semantics to produce a
    merged document, then schema-validates the results.

    Or you could use XInclude instead, in which case finding a tool which
    does the two-step XInclude/Schema validate pipeline is more likely.

    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 7, 2005
    #2
    1. Advertising

  3. Rushi

    Rushi Guest

    Hi Henry an All,

    Thanks a lot to showing gr8 interest in my query. Henry i really don't
    know what is this pipeline....

    Your suggestion to use XInclude is fair, but i'm not allow to change
    any syntax in those 2 XML files. I can create my own Schema to validate
    it.

    How do i do this. pls tell me briefly

    thanks
    Rushikesh

    Henry S. Thompson wrote:
    > You need a pipeline which implements your semantics to produce a
    > merged document, then schema-validates the results.
    >
    > Or you could use XInclude instead, in which case finding a tool which
    > does the two-step XInclude/Schema validate pipeline is more likely.
    >
    > 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]
     
    Rushi, Dec 8, 2005
    #3
  4. Rushi

    Rushi Guest

    Hi Henry an All,


    Thanks a lot to showing gr8 interest in my query. Henry i really don't
    know what is this pipeline....


    Your suggestion to use XInclude is fair, but i'm not allow to change
    any syntax in those 2 XML files. I can create my own Schema to validate

    it.


    How do i do this. pls tell me briefly....


    thanks
    Rushikesh
     
    Rushi, Dec 9, 2005
    #4
    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.
Similar Threads
  1. Jens M. Felderhoff

    Re: validate xml against xsd, xerces

    Jens M. Felderhoff, Jul 11, 2003, in forum: XML
    Replies:
    0
    Views:
    2,512
    Jens M. Felderhoff
    Jul 11, 2003
  2. Replies:
    2
    Views:
    742
  3. ric_deez
    Replies:
    0
    Views:
    1,091
    ric_deez
    Apr 3, 2006
  4. Laszlo Nagy
    Replies:
    5
    Views:
    567
    =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=
    Dec 15, 2006
  5. Andrew Thompson

    Validate XML against DTD? XSD OK. SSCCE.

    Andrew Thompson, Oct 3, 2007, in forum: Java
    Replies:
    5
    Views:
    2,865
    Roedy Green
    Oct 4, 2007
Loading...

Share This Page