Skip to main content

I want to test my GML file against a schema to make sure that it is valid. To do this, I am using an XMLValidator transformer. I am not sure how it works.

When I add a reader for my GML file, it loads all the different feature types. I also selected my .xsd file containing my schema. Connecting these to the XMLValidator goes excruciatingly slowly and everything seems to fail anyway.

If I select my GML file as the "XML Filename" parameter for the XMLValidator, and then my .xsd file as the Schema Location (Validation type "Syntax and Schema", and then unconnect the Feature Type readers, it seems to work, but I have inspectors connected to the "Passed" and "Failed" ports on the XMLValidator and nothing seems to go through either of them, even though the workbench runs successfully. Am I using it right?

 

The XMLValidator requires to receive a feature to kick off processing, even if you have specified the target XML file as the parameter. Try connecting a Creator transformer to the input port of the XMLValidator.


Sounds like you are on the right track with the GML file as the XML filename. As Takashi said, the XMLValidator needs a feature to kick off the validation, which the Creator provides, one feature per test. Also, the basic idea of the XMLValidator is that it needs to validate an entire XML document, not just an element, fragment or feature, so that is why you typically have one feature from a Creator to drive this, and don't use it on every record in your GML workflow. If successful, you should see a feature output from the Passed port for each test. If it fails, a feature is output from the Failed port and an _xml_error{} list is added with error information on the type and location of each error. The following article has a screenshot of a typical XMLValidator workspace. See 'Validation' under: https://knowledge.safe.com/articles/775/inspire-gml-basic-writing-example.html


Sounds like you are on the right track with the GML file as the XML filename. As Takashi said, the XMLValidator needs a feature to kick off the validation, which the Creator provides, one feature per test. Also, the basic idea of the XMLValidator is that it needs to validate an entire XML document, not just an element, fragment or feature, so that is why you typically have one feature from a Creator to drive this, and don't use it on every record in your GML workflow. If successful, you should see a feature output from the Passed port for each test. If it fails, a feature is output from the Failed port and an _xml_error{} list is added with error information on the type and location of each error. The following article has a screenshot of a typical XMLValidator workspace. See 'Validation' under: https://knowledge.safe.com/articles/775/inspire-gml-basic-writing-example.html

Thanks for the answer. Where do the output errors get written? It says that it failed, apparently, but I don't see any errors, and the inspector i connected to the "Failed" port just shows me a table with a single row that has "0" in the "_creation_instance" column.

 


Thanks for the answer. Where do the output errors get written? It says that it failed, apparently, but I don't see any errors, and the inspector i connected to the "Failed" port just shows me a table with a single row that has "0" in the "_creation_instance" column.

 

@iboates - While in FME Data Inspector, select the feature (the single row with 0 value for _creation_instance) and observe the Feature Information table. There are a few _xml* attributes that the XMLValidator creates, but does not expose by default.

 

The reason for error should be visible there. Hope this helps!

 


Thanks for the answer. Where do the output errors get written? It says that it failed, apparently, but I don't see any errors, and the inspector i connected to the "Failed" port just shows me a table with a single row that has "0" in the "_creation_instance" column.

 

Same issue. No usefull message listed. See the screenshot below. Any other idea to list all the XMLValidator Failed errors (per type and raw)?image


Thanks for the answer. Where do the output errors get written? It says that it failed, apparently, but I don't see any errors, and the inspector i connected to the "Failed" port just shows me a table with a single row that has "0" in the "_creation_instance" column.

 

Hello @webservicessia​, sorry to hear you're having issues seeing the error messages! I don't think list elements are shown in the table view by default. If you would like to view individual list entries in Table View, we can use the 'Columns...' button to select lists and corresponding elements:

 

image 

Otherwise, you can use the FeatureInformation window to view:

 

image 

Let me know if you still need a hand! Happy to help, Kailin.


Reply