XML Schema validation with schematron

This is a discussion on "XML Schema validation with schematron" within the Other Programming Languages section. This forum, and the thread "XML Schema validation with schematron are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Other Programming Languages

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Apr 28th, 2006, 11:00
New Member
Join Date: Apr 2006
Location: Lisbon, Portugal
Age: 27
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question XML Schema validation with schematron

hi all,
I'm new with XML language and I'm analysing if it worth the work to use or not this file format for specific meta data.
I'm want to use XML Schemas and instance (.xml) to represent metadada information upon a given system... since my analysis and specification is quite complex I'm posting a little example of my problem (which is very lower than the original )
I allready anderstand a little bit of xml format and xml schemas but not xml schematron
my problem here (so far...) is to validate not a xml instance but make a validation upon a xml schema: i must use a xml schematron right?
the example is quite simple:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> 
   <xs:element name="XPTO"> 
      <xs:annotation> 
         <xs:documentation>XML Schema example</xs:documentation> 
      </xs:annotation> 
      <xs:complexType> 
         <xs:sequence> 
            <xs:element name="Set1"> 
               <xs:complexType> 
                  <xs:sequence> 
                     <xs:element name="Element" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> 
                  </xs:sequence> 
               </xs:complexType> 
            </xs:element> 
            <xs:element name="Set2"> 
               <xs:complexType> 
                  <xs:sequence> 
                     <xs:element name="Element" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> 
                  </xs:sequence> 
               </xs:complexType> 
            </xs:element> 
            <xs:element name="Set3"> 
               <xs:complexType> 
                  <xs:sequence> 
                     <xs:element name="Element" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> 
                  </xs:sequence> 
               </xs:complexType> 
            </xs:element> 
         </xs:sequence> 
      </xs:complexType> 
   </xs:element> 
</xs:schema>
this schema allows 3 mandatory set, each of them can have a list of none or infinite string...

what i want to validate here is that each list must be exclusive: none of the element that appear on one of the set can appear on any other one of the instance!
for example:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?> 
<XPTO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Documents and Settings\André G. Marques\Desktop\myExample\xpto.xsd"> 
   <Set1> 
      <Element>"aaa"</Element> 
      <Element>"bbb"</Element> 
      <Element>"ccc"</Element> 
      <Element>"ddd"</Element> 
   </Set1> 
   <Set2> 
      <Element>"aaa"</Element> 
      <Element>"bbb1"</Element> 
   </Set2> 
   <Set3> 
      <Element>"aaa"</Element> 
      <Element>"ddd2"</Element> 
   </Set3> 
</XPTO>
is not valid since it got the string element "aaa" repeated at least in 2 list...
The logic is quite simple...
all i have to do is validate/check the elements of the first with the element of the others, doing this recursively, it is not necesary to perform the last valoidation i.e. the last set will never validate with the others since it have been allready checked
but i really don't know how it can be done....
is it possible to validate? must i use schematron??
best regards,
aGM
Reply With Quote

Reply

Tags
xml, schema, validation, schematron

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS validation VanessaJW Web Page Design 17 May 24th, 2007 19:59
CSE for validation nextgen Scripts and Online Services 3 Jan 30th, 2007 03:41
Validation help Powderhound Web Page Design 13 Nov 4th, 2006 20:53
Xsd Xml Schema - Same Element With Different Properties myghty Other Programming Languages 0 Aug 6th, 2006 12:30
nesting in XML schema - help needed sh33p1985 Other Programming Languages 0 Jan 18th, 2006 19:53


All times are GMT. The time now is 08:48.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

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