Skip to main content
Solved

Validating a GML file against a schema using XMLValidator


Forum|alt.badge.img

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?

 

Best answer by deanatsafe

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

View original
Did this help you find an answer to your question?

6 replies

takashi
Influencer
  • August 8, 2017

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.


deanatsafe
Safer
Forum|alt.badge.img+6
  • Safer
  • Best Answer
  • August 8, 2017

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


Forum|alt.badge.img
  • Author
  • August 11, 2017
deanatsafe wrote:

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.

 


rylanatsafe
Safer
Forum|alt.badge.img+13
  • Safer
  • August 11, 2017
iboates wrote:
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!

 


webservicessia
Contributor
Forum|alt.badge.img+1
iboates wrote:
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


kailinatsafe
Safer
Forum|alt.badge.img+21
iboates wrote:
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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings