annotations and additional rules

P

pbk++

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top