-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
write_eml() will preserve text wrapped in <![CDATA[ and ]]> (expected), but the behaviour is not consistent:
library(EML)
text_1 <- "My text is <a href=\"https://example.com\">html</a>." # Does not work
text_2 <- "<em></em>My text is <a href=\"https://example.com\">html</a>." # Works
text_3 <- "My text is <em>html</em>." # Works
eml <- list(
dataset = list(
abstract = list(
para = list(
paste0("<![CDATA[", text_1, "]]>"),
paste0("<![CDATA[", text_2, "]]>"),
paste0("<![CDATA[", text_3, "]]>")
)
)
)
)
EML::write_eml(eml, "test.xml")Resulting XML:
<?xml version="1.0" encoding="UTF-8"?>
<eml:eml xmlns:eml="https://eml.ecoinformatics.org/eml-2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:stmml="http://www.xml-cml.org/schema/stmml-1.2" packageId="ed7f9836-d2ae-4a04-9473-d377db387c54" system="uuid" xsi:schemaLocation="https://eml.ecoinformatics.org/eml-2.2.0 https://eml.ecoinformatics.org/eml-2.2.0/eml.xsd">
<dataset>
<abstract>
<para><![CDATA[My text is <a href="https://example.com">html</a>.]]></para>
<para><![CDATA[<em></em>My text is <a href="https://example.com">html</a>.]]></para>
<para><![CDATA[My text is <em>html</em>.]]></para>
</abstract>
</dataset>
</eml:eml>
Metadata
Metadata
Assignees
Labels
No labels