\starttext

\enabletrackers[xml.parse]
%\enabletrackers[xml.path] 
%\enabletrackers[xml.profile] -- exclusive
%\enabletrackers[xml.entities]

\startluacode

local xmp = xml.load("xmp-default.xml")

-- 1. replace empty <rdf:li/>; (results in "dc:CREATOR1" without <rdf:li> tags)
xml.replace(xmp,"xml://rdf:Description/dc:creator/rdf:Seq/rdf:li","<rdf:li>dc:CREATOR1</rdf:li>")
-- 2. inject XML sequence; (how?)
--xml.inject (xmp,"xml:///rdf:Description/dc:creator/rdf:Seq","<rdf:li>dc:CREATOR1</rdf:li>")

-- delete the first <rdf:li> entry
--xml.delete(xmp,"xml://rdf:Description/dc:creator/rdf:Seq/rdf:li")
-- 3. insert element into <rdf:Seq>; (only after/before, but not into empty)
--xml.insert (xmp,"xml:///rdf:Description/dc:creator/rdf:Seq","<rdf:li>dc:CREATOR2</rdf:li>")


xml.save(xmp,"xmp.xml")

\stopluacode
\null

\stoptext
