[MarkLogic Dev General] Adding XML declaration

Florent Georges lists at fgeorges.org
Tue Aug 31 08:17:09 PDT 2010


Ron Hitchens wrote:

  Hi,

> The XML declaration is a processing instruction

  Really, the XML declaration is not a PI.  It looks like a PI,
it smells like a PI, but the XML recommendation says it is not a
PI, it is the XML declaration.  That is important because you can
not expect to have it in XDM (for instance like a lot of people
want to access CDATA sections in an XDM instance).

> let $prolog := '<?xml version="1.0" encoding="UTF-8"?>'
> let $newXML := element result { ...
> return ($prolog, $newXML)

  Well, if you ask you serializer to use the XML method, that
should result to &_lt;...?&_gt;<result> ...  If you try it within
CQ, you get this result when you ask for the "XML", but strangely
enough you get '<?...?><result> ...' when asking for the "Text"
(but this is neither a proper text nor xml method, by my reading
of the serialization recommendation).

  Regards,

-- 
Florent Georges
http://fgeorges.org/



      


More information about the General mailing list