Skip to main content
Solved

INSPIRE GML - How to change gml:id position?


oscard
Influencer
Forum|alt.badge.img+21

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!

Best answer by deanatsafe

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

 

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

2 replies

deanatsafe
Safer
Forum|alt.badge.img+6
  • Safer
  • Best Answer
  • November 3, 2017
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

 


oscard
Influencer
Forum|alt.badge.img+21
  • Author
  • Influencer
  • November 6, 2017
deanatsafe wrote:
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


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