Skip to content

Commit

Permalink
feat: escape more xml strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Remcoman committed Nov 10, 2023
1 parent 5b7b5d6 commit 7ea5835
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 18 deletions.
34 changes: 25 additions & 9 deletions src/lib/format-factsheet-xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,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 +140,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 +177,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 +238,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 +418,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
34 changes: 25 additions & 9 deletions src/lib/format-inspire-metadata-xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,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 @@ -116,9 +120,11 @@ 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
}</gco:CharacterString>
<gco:CharacterString>
<![CDATA[
${layer.inspireMetadata.abstract}
]]>
</gco:CharacterString>
</gmd:abstract>
<gmd:status>
Expand All @@ -136,7 +142,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 @@ -169,7 +179,11 @@ 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('')}
Expand Down Expand Up @@ -387,9 +401,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 7ea5835

Please sign in to comment.