Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > how to validate XML against one given xsd file

Reply
Thread Tools

how to validate XML against one given xsd file

 
 
jacksuyu@gmail.com
Guest
Posts: n/a
 
      02-04-2005

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="urnasis:names:tc:SAML:1.0:asser tion"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:saml="urnasis: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...bbrev=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">

 
Reply With Quote
 
 
 
 
Fabien R
Guest
Posts: n/a
 
      02-08-2005
wrote in message news:< roups.com>...
> 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="urnasis:names:tc:SAML:1.0:asser tion"
> xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
> xmlns:saml="urnasis: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...bbrev=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
 
Reply With Quote
 
 
 
 
jacksuyu@gmail.com
Guest
Posts: n/a
 
      02-15-2005
Thanks..

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sample code required to validate a xml file against XSD hrishy Python 2 10-03-2008 05:19 AM
Validate XML against a set of XSD files, with Python Laszlo Nagy Python 5 12-15-2006 09:25 AM
Using Python to validate XML against an XSD schema ric_deez Python 0 04-03-2006 09:27 PM
how to validate two XML against XSD? Rushi XML 3 12-09-2005 06:44 AM
Re: validate xml against xsd, xerces Jens M. Felderhoff XML 0 07-11-2003 02:29 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57