Skip to content

Commit

Permalink
Wrap XML content in CDATA tags
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoerdbeentjes committed Jul 16, 2024
1 parent 6dffb03 commit 679fac9
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 21 deletions.
40 changes: 30 additions & 10 deletions src/lib/format-factsheet-xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ export const format = ({ id, layerInfo, layer, factsheet }) => /* xml */ `
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>${layer.name}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${layer.name}
]]>
</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
Expand All @@ -118,7 +122,11 @@ export const format = ({ id, layerInfo, layer, factsheet }) => /* xml */ `
</gmd:citation>
<!-- TG Requirement C.9: metadata/2.0/req/common/resource-abstract: A non-empty brief narrative summary of the content of the described data set, data set series or service shall be provided. It shall be encoded using the gmd:abstract element with a Non-empty Free Text Element content in the language of the metadata. The multiplicity of this element is 1. -->
<gmd:abstract>
<gco:CharacterString>${factsheet.samenvatting}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${factsheet.samenvatting}
]]>
</gco:CharacterString>
</gmd:abstract>
<gmd:status>
Expand All @@ -136,7 +144,11 @@ export const format = ({ id, layerInfo, layer, factsheet }) => /* xml */ `
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:organisationName>
<gco:CharacterString>${item.organisationName}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${item.organisationName}
]]>
</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
Expand Down Expand Up @@ -169,7 +181,11 @@ export const format = ({ id, layerInfo, layer, factsheet }) => /* xml */ `
.map(
(thema) =>
`<gmd:keyword>
<gco:CharacterString>${thema.title}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${thema.title}
]]>
</gco:CharacterString>
</gmd:keyword>`
)
.join('')}
Expand Down Expand Up @@ -226,9 +242,11 @@ export const format = ({ id, layerInfo, layer, factsheet }) => /* xml */ `
<gmd:resourceConstraints>
<gmd:MD_LegalConstraints>
<gmd:useLimitation>
<gco:CharacterString>${
factsheet.gebruiksbeperkingen
}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${factsheet.gebruiksbeperkingen}
]]>
</gco:CharacterString>
</gmd:useLimitation>
</gmd:MD_LegalConstraints>
</gmd:resourceConstraints>
Expand Down Expand Up @@ -404,9 +422,11 @@ export const format = ({ id, layerInfo, layer, factsheet }) => /* xml */ `
<gmd:lineage>
<gmd:LI_Lineage>
<gmd:statement>
<gco:CharacterString>${
factsheet.algemeneBeschrijvingVanHerkomst
}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${ factsheet.algemeneBeschrijvingVanHerkomst}
]]>
</gco:CharacterString>
</gmd:statement>
</gmd:LI_Lineage>
</gmd:lineage>
Expand Down
35 changes: 24 additions & 11 deletions src/lib/format-inspire-metadata-xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ export const format = ({ id, layerInfo, layer }) => /* xml */ `
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>${layer.name}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${layer.name}
]]>
</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
Expand All @@ -124,9 +128,10 @@ export const format = ({ id, layerInfo, layer }) => /* xml */ `
</gmd:citation>
<!-- TG Requirement C.9: metadata/2.0/req/common/resource-abstract: A non-empty brief narrative summary of the content of the described data set, data set series or service shall be provided. It shall be encoded using the gmd:abstract element with a Non-empty Free Text Element content in the language of the metadata. The multiplicity of this element is 1. -->
<gmd:abstract>
<gco:CharacterString>${
layer.inspireMetadata.abstract}${layer.inspireMetadata.description ? ` - ${layer.inspireMetadata.description}` : ''
}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${layer.inspireMetadata.abstract}${layer.inspireMetadata.description ? ` - ${layer.inspireMetadata.description}` : ''}
]]></gco:CharacterString>
</gmd:abstract>
<gmd:status>
Expand All @@ -144,7 +149,11 @@ export const format = ({ id, layerInfo, layer }) => /* xml */ `
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:organisationName>
<gco:CharacterString>${item.organisationName}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${item.organisationName}
]]>
</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
Expand Down Expand Up @@ -177,14 +186,17 @@ export const format = ({ id, layerInfo, layer }) => /* xml */ `
.map(
(keyword) =>
`<gmd:keyword>
<gco:CharacterString>${keyword.title}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${keyword.title}
]]>
</gco:CharacterString>
</gmd:keyword>`
)
.join('')}
<gmd:thesaurusName>
<gmd:CI_Citation>
<gmd:title>
<!-- TODO: url? -->
<gmx:Anchor xlink:href="http://www.eionet.europa.eu/gemet/inspire_themes">${
layer.inspireMetadata.thesaurusname
}</gmx:Anchor>
Expand Down Expand Up @@ -256,7 +268,6 @@ export const format = ({ id, layerInfo, layer }) => /* xml */ `
<gmd:equivalentScale>
<gmd:MD_RepresentativeFraction>
<gmd:denominator>
<!-- TODO: is this correct? -->
<gco:Integer>None</gco:Integer>
</gmd:denominator>
</gmd:MD_RepresentativeFraction>
Expand Down Expand Up @@ -398,9 +409,11 @@ export const format = ({ id, layerInfo, layer }) => /* xml */ `
<gmd:lineage>
<gmd:LI_Lineage>
<gmd:statement>
<gco:CharacterString>${
layer.inspireMetadata.lineageStatement
}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${layer.inspireMetadata.lineageStatement}
]]>
</gco:CharacterString>
</gmd:statement>
</gmd:LI_Lineage>
</gmd:lineage>
Expand Down

0 comments on commit 679fac9

Please sign in to comment.