Skip to main content
Question

Debugging the XSD drive XML writer

  • September 27, 2021
  • 3 replies
  • 31 views

jhevenor
Forum|alt.badge.img

I attended last week's webinar on metadata and was happy to hear of the xsd-drive XML reader and writter. I've been attempting to modify the cap:alert demo to write a flavor of ISO19115.    

 

XML Validation: Starting schema validation for 'c:\...\output\tmp.xml'
The uri-map document 'C:\Program Files\FME\xml\urimap\gml_aixm.xml' is being used to map from URI to URI
The uri-map document 'C:\Program Files\FME\xml\urimap\gml_citygml.xml' is being used to map from URI to URI
The uri-map document 'C:\Program Files\FME\xml\urimap\gml_inspire.xml' is being used to map from URI to URI
The uri-map document 'C:\Program Files\FME\xml\urimap\gml_sosi.xml' is being used to map from URI to URI
The uri-map document 'C:\Program Files\FME\xml\urimap\gml_urimap.xml' is being used to map from URI to URI
XML Validation: Fatal Error in 'c:\...\output\tmp.xml' on line 1, column 39: 'invalid document structure'
XML Validation: '0' warning(s) found.
XML Validation: '1' fatal error(s) and '0' error(s) in 'c:\...\output\tmp.xml'
XSD_DRIVEN_XML writer: A fatal error has occurred. Check the logfile above for details
Translation FAILED with 3 error(s) and 1 warning(s) (1 feature(s) output)

From scanning the log I don't see why this failed (beyond invalid structure). When I look at the output, I just see the the first line '<?xml version="1.0" encoding="UTF-8"?>' and nothing else. 

 

I'm very new to FME and fairly rusty with my XML, so I have many questions. 

  1. Is there a place to see a more concrete reason why this is failing?
  2. The schema uses multiple namespaces (unlike the cap demo). Which do I need to include? Do I write them as xyx:someAttr when defining them the AttributeCreator?
  3. Can I write long nested XML paths like contact.CI_ResponsibleParty.organizationName?

 

I'm moving on the try the XMLTemplater in the meantime, but I'd love to figure out how this works.

 

Thanks!

3 replies

kailinatsafe
Safer
Forum|alt.badge.img+23
  • Safer
  • 720 replies
  • September 28, 2021

Hello @jhevenor​ , thanks for posting to the FME Community! Glad to hear you enjoyed the webinar. Would you be willing to share your workspace, app schemas and source data so I can repro this on my end? Let me know if you aren't able to share your data publically. Here to help, Kailin.


jhevenor
Forum|alt.badge.img
  • Author
  • 1 reply
  • September 28, 2021

Hi Kailin, thanks for the quick reply.

The schema is downloaded from here: https://portal.dgiwg.org/files/68100

 

I've attached the basic writer. I started with the xsd-driven xml writer tutorial with the writer pointing to the XSD in the zip at path `\\DMF_Schemas_Offline\\www.dgiwg.org\\xmlns\\dmf\\2.0\\iso-g2\\profile\\all\\all.xsd`, and changed the writer 'root element' to gmi:MI_Metadata.

 

Then I just tried to populate an attributeCreator for one of the required elements -- gmd:contact. I've tried creating these attributes with namespace and without, etc.

 

There's a sample metadata record found on github that I've referenced as it's easier to read than XSD. https://github.com/metadata101/iso19139.dgiwg/tree/master/src/main/plugin/iso19139.dgiwg/sample-data/01_d

 

I hope this all makes sense. As I say, I can run the tutorial and create cap:alert, but I don't see how to make the jump to these more complicated / mixed namespace scenarios. I'm hoping that there's just a 'read this and it will all make sense' type answer. Any help or direction is appreciated.

 


kailinatsafe
Safer
Forum|alt.badge.img+23
  • Safer
  • 720 replies
  • September 29, 2021

Hi Kailin, thanks for the quick reply.

The schema is downloaded from here: https://portal.dgiwg.org/files/68100

 

I've attached the basic writer. I started with the xsd-driven xml writer tutorial with the writer pointing to the XSD in the zip at path `\\DMF_Schemas_Offline\\www.dgiwg.org\\xmlns\\dmf\\2.0\\iso-g2\\profile\\all\\all.xsd`, and changed the writer 'root element' to gmi:MI_Metadata.

 

Then I just tried to populate an attributeCreator for one of the required elements -- gmd:contact. I've tried creating these attributes with namespace and without, etc.

 

There's a sample metadata record found on github that I've referenced as it's easier to read than XSD. https://github.com/metadata101/iso19139.dgiwg/tree/master/src/main/plugin/iso19139.dgiwg/sample-data/01_d

 

I hope this all makes sense. As I say, I can run the tutorial and create cap:alert, but I don't see how to make the jump to these more complicated / mixed namespace scenarios. I'm hoping that there's just a 'read this and it will all make sense' type answer. Any help or direction is appreciated.

 

Hello @jhevenor​  - I hope you don't mind. I decided to take this off the community, opened a support ticket on your behalf! You should see an email shortly. Best, Kailin.