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.
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.