how to validate XML against one given xsd file

Discussion in 'XML' started by jacksuyu@gmail.com, Feb 4, 2005.

  1. Guest

    For example the XML looks like:

    <SOAP-ENV:Body>

    <samlp:Response InResponseTo="abcd"
    IssueInstant="2005-02-03T20:18:06Z" MajorVersion="1" MinorVersion="0"
    ResponseID="abcd">

    <samlp:Status>
    <samlp:StatusCode Value="samlp:Success"/>
    </samlp:Status>

    <saml:Assertion AssertionID="12343" InResponseTo="1234"
    IssueInstant="2005-02-03T20:18:06Z" Issuer="http://www.fmr.com"
    MajorVersion="1" MinorVersion="0" id="id-gLxbrihSvyx3"
    xsi:type="lib:AssertionType">

    <saml:Conditions>

    <saml:AudienceRestrictionCondition>
    <saml:Audience>abcd</saml:Audience>
    </saml:AudienceRestrictionCondition>
    </saml:Conditions>




    the XSD file is:



    <?xml version="1.0" encoding="UTF-8" ?>
    <schema targetNamespace="urn:eek:asis:names:tc:SAML:1.0:assertion"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    xmlns:saml="urn:eek:asis:names:tc:SAML:1.0:assertion"
    xmlns="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="unqualified" attributeFormDefault="unqualified"
    version="1.1">
    <import namespace="http://www.w3.org/2000/09/xmldsig#"
    schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"
    />
    <annotation>
    <documentation>Document identifier:
    oasis-sstc-saml-schema-assertion-1.1 Location:
    http://www.oasis-open.org/committees/documents.php?wg_abbrev=security
    Revision history: V1.0 (November, 2002): Initial standard schema. V1.1
    (September, 2003): * Note that V1.1 of this schema has the same XML
    namespace as V1.0. Rebased ID content directly on XML Schema types
    Added DoNotCacheCondition element and
    DoNotCacheConditionType</documentation>
    </annotation>
    <simpleType name="DecisionType">
    <restriction base="string">
    <enumeration value="Permit" />
    <enumeration value="Deny" />
    <enumeration value="Indeterminate" />
    </restriction>
    </simpleType>
    <element name="AssertionIDReference" type="NCName" />
    <element name="Assertion" type="saml:AssertionType" />
    <complexType name="AssertionType">
     
    , Feb 4, 2005
    #1
    1. Advertising

  2. Fabien R Guest

    wrote in message news:<>...
    > For example the XML looks like:
    >
    > <SOAP-ENV:Body>
    >
    > <samlp:Response InResponseTo="abcd"
    > IssueInstant="2005-02-03T20:18:06Z" MajorVersion="1" MinorVersion="0"
    > ResponseID="abcd">
    >
    > <samlp:Status>
    > <samlp:StatusCode Value="samlp:Success"/>
    > </samlp:Status>
    >
    > <saml:Assertion AssertionID="12343" InResponseTo="1234"
    > IssueInstant="2005-02-03T20:18:06Z" Issuer="http://www.fmr.com"
    > MajorVersion="1" MinorVersion="0" id="id-gLxbrihSvyx3"
    > xsi:type="lib:AssertionType">
    >
    > <saml:Conditions>
    >
    > <saml:AudienceRestrictionCondition>
    > <saml:Audience>abcd</saml:Audience>
    > </saml:AudienceRestrictionCondition>
    > </saml:Conditions>
    >
    >
    >
    >
    > the XSD file is:
    >
    >
    >
    > <?xml version="1.0" encoding="UTF-8" ?>
    > <schema targetNamespace="urn:eek:asis:names:tc:SAML:1.0:assertion"
    > xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    > xmlns:saml="urn:eek:asis:names:tc:SAML:1.0:assertion"
    > xmlns="http://www.w3.org/2001/XMLSchema"
    > elementFormDefault="unqualified" attributeFormDefault="unqualified"
    > version="1.1">
    > <import namespace="http://www.w3.org/2000/09/xmldsig#"
    > schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"
    > />
    > <annotation>
    > <documentation>Document identifier:
    > oasis-sstc-saml-schema-assertion-1.1 Location:
    > http://www.oasis-open.org/committees/documents.php?wg_abbrev=security
    > Revision history: V1.0 (November, 2002): Initial standard schema. V1.1
    > (September, 2003): * Note that V1.1 of this schema has the same XML
    > namespace as V1.0. Rebased ID content directly on XML Schema types
    > Added DoNotCacheCondition element and
    > DoNotCacheConditionType</documentation>
    > </annotation>
    > <simpleType name="DecisionType">
    > <restriction base="string">
    > <enumeration value="Permit" />
    > <enumeration value="Deny" />
    > <enumeration value="Indeterminate" />
    > </restriction>
    > </simpleType>
    > <element name="AssertionIDReference" type="NCName" />
    > <element name="Assertion" type="saml:AssertionType" />
    > <complexType name="AssertionType">

    On my linux platform, I use:
    xmllint --schema <mySchema.xsd> <myXml.xml>

    -
    Fabien
     
    Fabien R, Feb 8, 2005
    #2
    1. Advertising

  3. Guest

    Thanks..
     
    , Feb 15, 2005
    #3
    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,528
    Jens M. Felderhoff
    Jul 11, 2003
  2. Rushi
    Replies:
    3
    Views:
    865
    Rushi
    Dec 9, 2005
  3. ric_deez
    Replies:
    0
    Views:
    1,107
    ric_deez
    Apr 3, 2006
  4. Laszlo Nagy
    Replies:
    5
    Views:
    578
    =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=
    Dec 15, 2006
  5. hrishy
    Replies:
    2
    Views:
    369
    Frank Millman
    Oct 3, 2008
Loading...

Share This Page