List Info

Thread: RE: XMLBeans and SchemaTron




RE: XMLBeans and SchemaTron
user name
2007-04-11 08:02:04

Radu,

 

XMLBeans support XML Schemas so, if we have a way to embed schematron tags within XSD, so my problem is solved. I think I found it..BTW,

It’s the same solution that I found earlier in this note(schematron tags into <appinfo> context), see sample XSD below:

 

Marcelo:  Seems that we are good to proceed this way. We only need to check if this solution will catch up all our scenarios.

 

<?xml version=&quot;1.0&quot;?>
<xsd:schema xmlnssd="http://www.w3.org/2001/XMLSchema&quot;
 &nbsp; &nbsp; &nbsp;  targetNamespace=";http://www.demo.org&quot;
 &nbsp; &nbsp; &nbsp;  xmlns=&quot;http://www.demo.org&quot; 
 &nbsp; &nbsp; &nbsp; &nbsp;xmlns:sch=";http://www.ascc.net/xml/schematron"
 &nbsp; &nbsp; &nbsp;  elementFormDefault=&quot;qualified">;
 &nbsp;  <xsd:annotation&gt;
 &nbsp; &nbsp; &nbsp;  <xsd:appinfo>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; <sch:title>Schematron validation</sch:title>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; <sch:ns prefix=&quot;d" uri="http://www.demo.org&quot;/>
 &nbsp; &nbsp; &nbsp;  </xsd:appinfo>
 &nbsp;  </xsd:annotation&gt;
 &nbsp;  <xsd:element name=";Demo">
 &nbsp;  &nbsp; &nbsp; <xsd:annotation>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; <xsd:appinfo>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <sch:pattern name=";Check A greater than B">;
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; <sch:rule context=&quot;demo"&gt;
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  <sch:assert test=";d:A > d:B" 
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; diagnostics=&quot;lessThan">
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  A should be greater than B.
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  </sch:assert>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; </sch:rule>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; </sch:pattern>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <sch:diagnostics&gt;
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; <sch:diagnostic id="lessThan&quot;>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  Error! A is less than B 
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp;A = <sch:value-of select=&quot;d:A";/>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  B = <sch:value-of select=&quot;d:B";/>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; </sch:diagnostic&gt;
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; </sch:diagnostics&gt;
 &nbsp; &nbsp; &nbsp; &nbsp;   ; </xsd:appinfo>
 &nbsp; &nbsp; &nbsp;  </xsd:annotation&gt;
 &nbsp; &nbsp; &nbsp;  <xsd:complexType&gt;
 &nbsp; &nbsp; &nbsp; &nbsp;   ; <xsd:sequence>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <xsd:element name=";A" type=";xsd:integer"/>;
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <xsd:element name=";B" type=";xsd:integer"/>;
 &nbsp; &nbsp; &nbsp; &nbsp;   ; </xsd:sequence>
 &nbsp; &nbsp; &nbsp;  </xsd:complexType&gt;
 &nbsp;  </xsd:element>
</xsd:schema>

 

Reference: http://www.xfront.com/ExtendingSchemas.html

 

 

Atenciosamente

Rafael T. Icibaci
IBM Middleware EAI Team
( + 55 11 2113-7685
È + 55 11 9299-7840
* ricibaci_ibmtimbrasil.com.br">ricibaci_ibmtimbrasil.com.br


From: Radu Preotiuc-Pietro [mailto:radupbea.com]
Sent: segunda-feira, 9 de abril de 2007 18:22
To: userxmlbeans.apache.org; Webber, David (NIH/OD) [C]
Cc: Marcelo Martins Pereira
Subject: RE: XMLBeans and SchemaTron

 

First time I hear abour JCam, so no.

 

What I suggest you do is the following:

 

If you can find a Schematron validator somewhere that can act as a "filter" for a SAX or StAX stream or that works over DOM, you can plug that in as a separate step and still use XMLBeans and Schema validation. XMLBeans supports all three of these standard APIs so maybe you can get around it this way.

 

The thing about it is that implementing a validation engine is a lot of work, so we had to limit ourselves to 1 and&nbsp;that had to be pretty much XMLSchema. Now, if someone who knows Schematron would be willing to contribute something in XmlBeans in that area it would be a welcome addition, but without a volunteer, it's unlikely to happen, I would say.

 

Anyway, if you do find such a "filter" validator, please do post back and let us know.

 

Radu

 


From: Rafael Tatsuya Icibaci [mailto:ricibaci_ibmtimbrasil.com.br]
Sent: Monday, April 09, 2007 12:08 PM
To: Webber, David (NIH/OD) [C]; userxmlbeans.apache.org
Cc: Marcelo Martins Pereira
Subject: RE: XMLBeans and SchemaTron

Yes, I need content validation. What we exactly want to do is: We have a requirement to use XMLBeans, also today we have a need to include conditional expressions in XSD files (e.g.: if we have a tag so we need to have the other as well). Schematron appears to be the solution, because we can set these conditions using XPath, but now the question is: If we are going to use XMLBeans and we will pass a XSD file to XMLbeans to validate, XMLBeans support SchemTron ? I can pass a .SCH file to XMLBeans ? or I have a way to include SchemTron tags into .XSD files ?? I found a sample of using SchemTron tags into .XSD(see below), but appears that this is only valid when schematron tags are inside of <xs:annotation> tag.

 

I’m checking out JCam, seems that it&#8217;s very similar to SchemaTron. XMLBeans support JCam ??

 

 

<?xml version=&quot;1.0&quot; encoding="UTF-8"?&gt;

<xs:schema xmlns="http://www.ascc.net/xml/schematron&quot;

 &nbsp;  xmlnss="http://www.w3.org/2001/XMLSchema&quot;

 &nbsp;  targetNamespace="http://www.rafael.com&quot; elementFormDefault=&quot;qualified"

 &nbsp;  attributeFormDefault=&quot;unqualified"&gt;

 &nbsp;  <xs:annotation>

 &nbsp; &nbsp; &nbsp;  <xs:appinfo>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; <schema xmlns=&quot;http://www.ascc.net/xml/schematron"&gt;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <title>Meds</title&gt;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <ns uri="http://www.rafael.com&quot; prefix=&quot;ns"/>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <pattern name=";Medications">

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; <rule context=&quot;ns:E18&quot;>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  &lt;assert test=";preceding::E18_02&quot;>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  If <name/&gt; is used you must list the Medications listed

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  &lt;/assert&gt;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  &lt;assert test=";preceding::E18_07&quot;>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  If <name/&gt; is used you must list the patient response

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  &lt;/assert&gt;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; </rule>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; <rule context=&quot;ns:Header">;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  &lt;report test=";count(ns:Record) > 0">;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  There are <value-of select = "count(ns:HeaderRecord)&quot;/> &lt;name/>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  &lt;/report&gt;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; </rule>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; </pattern>

 &nbsp; &nbsp; &nbsp;   &nbsp; &nbsp;</schema>

 &nbsp; &nbsp; &nbsp;  </xs:appinfo>

 &nbsp;  </xs:annotation>;

 

Atenciosamente

Rafael T. Icibaci
IBM Middleware EAI Team
( + 55 11 2113-7685
È + 55 11 9299-7840
* ricibaci_ibmtimbrasil.com.br">ricibaci_ibmtimbrasil.com.br


From: Webber, David (NIH/OD) [C] [mailto:webberdod.nih.gov]
Sent: sexta-feira, 6 de abril de 2007 13:02
To: userxmlbeans.apache.org
Cc: Rafael Tatsuya Icibaci
Subject: RE: XMLBeans and SchemaTron

 

Rafael,

 

If you need content validation services - check out the latest OASIS ;CAM tool

 

 

DW

 


From: Rafael Tatsuya Icibaci
Sent: Thu 4/5/2007 2:57 PM
To: userxmlbeans.apache.org
Subject: XMLBeans and SchemaTron

Hi all,

 

Anyone knows if XMLBeans support SchemaTron ?

Atenciosamente

Rafael T. Icibaci
IBM Middleware EAI Team
( + 55 11 2113-7685
È + 55 11 9299-7840
* ricibaci_ibmtimbrasil.com.br" target="_blank">ricibaci_ibmtimbrasil.com.br

 

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )