[ 
https://issues.apache.org/jira/browse/SIS-399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Desruisseaux closed SIS-399.
-----------------------------------

> When renaming "xsi:type" value, may need to declare a new namespace
> -------------------------------------------------------------------
>
>                 Key: SIS-399
>                 URL: https://issues.apache.org/jira/browse/SIS-399
>             Project: Spatial Information Systems
>          Issue Type: Sub-task
>          Components: Metadata
>            Reporter: Martin Desruisseaux
>            Assignee: Martin Desruisseaux
>            Priority: Major
>              Labels: regression
>             Fix For: 1.0
>
>
> {{TransformingReader}} converts XML element and attribute names from legacy 
> standards to new standards, but there is one special case where instead of 
> the attribute name, we need to convert attribute value: the {{xsi:type}} 
> attribute. Example:
> {code:xml}
> <gmd:…>
>   <gmd:name xsi:type="gmd:PT_FreeText_PropertyType">
>     <gco:CharacterString>Some text in default language</gco:CharacterString>
>     <gmd:PT_FreeText>
>       <gmd:textGroup>
>         <gmd:LocalisedCharacterString locale="#locale-fra">Same text in 
> French</gmd:LocalisedCharacterString>
>       </gmd:textGroup>
>     </gmd:PT_FreeText>
>   </gmd:name>
> <gmd:…>
> {code}
> Conversion from legacy ISO 19139:2007 to new ISO 19115-3:2016 result in 
> something like (omitting non-pertinent prefixes for this discussion):
> {code:xml}
> <…:…>
>   <…:name xsi:type="lan:PT_FreeText_PropertyType">
>     <gco:CharacterString>Some text in default language</gco:CharacterString>
>     <lan:PT_FreeText>
>       <lan:textGroup>
>         <lan:LocalisedCharacterString locale="#locale-fra">Same text in 
> French</lan:LocalisedCharacterString>
>       </lan:textGroup>
>     </lan:PT_FreeText>
>   </…:name>
> <…:…>
> {code}
> {{gmd}} prefix has been replaced by {{lan}} prefix in various places, but 
> this is not a concern for elements like {{lan:PT_FreeText}} because the 
> {{XMLEvent}} created by {{TransformingReader}} already contain the full 
> namespace URI. The problem is in the {{xsi:type}} value, where we do not 
> specify the namespace ourselves. Attempts to unmarshal this converted XML 
> result in an error message complaining the the {{lan}} prefix has not been 
> bound. The workaround would be to replace the following fragment:
> {code:xml}
>   <…:… xsi:type="gmd:PT_FreeText_PropertyType">
> {code}
> by
> {code:xml}
>   <…:… xmlns:lan="http://standards.iso.org/iso/19115/-3/lan/1.0"; 
> xsi:type="gmd:PT_FreeText_PropertyType">
> {code}
> In other words, we need to insert a local {{Namespace}} event which was not 
> present in the original XML document. In the meantime, the workaround is to 
> add a {{xmlns:lan}} declaration in the root XML element of the document to 
> parse. This workaround is applied in the {{"2007/PositionalAccuracy.xml"}} 
> test file, and should be removed when this issue is fixed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to