Customer Portal

relax schema validation of xml input?

Comments 3

  • Avatar
    avackova
    0
    Comment actions Permalink
    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.
  • Avatar
    mhgrove
    0
    Comment actions Permalink
    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?
  • Avatar
    avackova
    0
    Comment actions Permalink
    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)*".

Please sign in to leave a comment.