Solved

INSPIRE GML - How to change gml:id position?

  • 19 October 2017
  • 2 replies
  • 2 views

Userlevel 2
Badge +19

Greetings!

I'm using the INSPIRE GML reader to create a GML for the CadastralParcel theme.

My FeatureCollection tag looks like this:

<gml:FeatureCollection xmlns:xsi="..." xmlns:gml="" xmlns:cp="..." xmlns:base="..." gml:id="MY_ID" xsi:schemaLocation="...">

Is there a way to change the position of the gml:id attribute. I would like to obtain the following:

<gml:FeatureCollection gml:id="MY_ID" xmlns:xsi="..." xmlns:gml="" xmlns:cp="..." xmlns:base="..." xsi:schemaLocation="...">

Maybe I'm missing a setting of the Reader to do this.

My FME version is 2017.0

Thanks for any help provided!

icon

Best answer by deanatsafe 3 November 2017, 18:40

View original

2 replies

Badge +6
In XML terms, gml:id is an attribute that in this case belongs to the FeatureCollection element. According to the W3 XML specification, the order of attributes is not significant. Element order can be significant, depending on the schema, but attribute order never is.

 

"Note that the order of attribute specifications in a start-tag or empty-element tag is not significant." For more on this please refer to: https://www.w3.org/TR/REC-xml/#sec-starttags

 

Because of this our GML Writer does not provide any ability to control attribute order within element tags.

 

 

I would be interested as to why there was a desire to control attribute order in this case. Perhaps you are using an exact string match to determine whether the output is valid. If that is the case I would recommend using a more XML-centric, rather than text-centric approach. The XMLValidator transformer can test output against any given application schema and this calls the external Apache Xerces library so you can be sure there is objective confirmation that your output is valid. An example of INSPIRE GML validation can be found here: https://knowledge.safe.com/articles/775/inspire-gml-basic-writing-example.html

 

Userlevel 2
Badge +19
In XML terms, gml:id is an attribute that in this case belongs to the FeatureCollection element. According to the W3 XML specification, the order of attributes is not significant. Element order can be significant, depending on the schema, but attribute order never is.

 

"Note that the order of attribute specifications in a start-tag or empty-element tag is not significant." For more on this please refer to: https://www.w3.org/TR/REC-xml/#sec-starttags

 

Because of this our GML Writer does not provide any ability to control attribute order within element tags.

 

 

I would be interested as to why there was a desire to control attribute order in this case. Perhaps you are using an exact string match to determine whether the output is valid. If that is the case I would recommend using a more XML-centric, rather than text-centric approach. The XMLValidator transformer can test output against any given application schema and this calls the external Apache Xerces library so you can be sure there is objective confirmation that your output is valid. An example of INSPIRE GML validation can be found here: https://knowledge.safe.com/articles/775/inspire-gml-basic-writing-example.html

 

Thanks!

 

 

I know the order is not important, but the person who is going to use the GML wanted the ID to appear first (for convenience). I guess I could use some text editing transformer, but that could get messy very fast if I'm not carfeul. So I asked in case there was an option in the GML INSPIRE writer that I was missing.

 

 

The user will have to accept the default order of the attributes, then.

 

 

Reply