Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   annotations and additional rules (http://www.velocityreviews.com/forums/t602470-annotations-and-additional-rules.html)

pbk++ 03-28-2008 08:36 AM

annotations and additional rules
 
Hi dear fellows

I have to write set of classes analizing xml document. Doc should be
validated againt given scheme. I did it. Unfortunately doc should have
additional validation based on unformal rules hiden in
<xs:annotation><xs:documentation>, ie.

<xs:attribute name="Typ" use="required">
<xs:annotation>
<xs:documentation source="list">15</xs:documentation>
<xs:documentation source="rule">R39, R40</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="1" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>

Meaning of this rules is given in words:

R39 - IF /SAD/Zgloszenie/Rodzaj/@PodTyp = "C" THEN
/SAD/Zgloszenie/Rodzaj/@Typ ="H"
R40 - IF /SAD/Zgloszenie/Rodzaj/@PodTyp = "D" THEN
/SAD/Zgloszenie/Rodzaj/@Typ ="A"

Obviously there are much more complicated cases.

Validation of every rule will be implemented as function.


I don't know how to trigger validation (call functions) against this
additional rules.
Should I at the begining find all rules and go through the DOM and
validate them one by one? Maybe there is another, better solution?

What kind of parser would be better, SAX or DOM?

I'm using Xerces.

Please give me some hits.

--
Piotrek



All times are GMT. The time now is 05:47 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.