can the xml reader be configured so it validates the input against a relaxNG schema?
I have this running in a separate node after the the data is read in, but I thought it might be nice if the reader could just do this step as part of the read process.
Hello,
in XMLExtract component you can set set features for xml validation (see xmlFeatures attribute of XMLExtract component).
We have also plan to implement validation against xsd schema. This feature should be available in CloverETL 3.
It’s not clear to me how you can set that in the features, I thought those were only boolean valued properties. So I am not sure what I’d set with the value of the URL to the schema to be used for validation.
Could you provide a small snippet that would illustrate this?
Hello,
it seams that the validation doesn’t work in XMLExtract; I’ve reported an issue for it (http://bug.cloveretl.org/view.php?id=2045).
But the same features work with XPathReader. See following node:
<Node fileURL="${DATAIN_DIR}/after-commit.ts" id="XML_XPATH_READER0" type="XML_XPATH_READER" xmlFeatures="http://apache.org/xml/features/nonvalidating/load-external-dtd:=true;http://xml.org/sax/features/validation:=true;">
<attr name="mapping"><![CDATA[<Context xpath="/TestScenario/FunctionalTest" outPort="0">
<Mapping cloverField="bar" xpath="./@ident"/>
<Mapping cloverField="baz" xpath="./@graphFile"/>
</Context>]]></attr>
</Node>
In the after-commit.ts file I have the link to dtd file:
<!DOCTYPE TestScenario SYSTEM "testscenario.dtd">
When I have a tag which is not allowed by definition file I get a message to console:
Error on line 8 column 25
SXXP0003: Error reported by XML parser: Element type "MyTag" must be declared.
Error on line 13 column 22
SXXP0003: Error reported by XML parser: The content of element type "FunctionalTest" must
match "(FlatFile|DBTableToTable|DBTableToXMLFile|DeleteFile|DeleteTable|SQLStatement|Property|RegEx|ExcludeRegEx)*".