Knowledgebase: MarkLogic Server
XML serialization and output options
27 October 2017 10:51 AM

XML serialization and output options

XML as stored in MarkLogic Server

MarkLogic Server starts by parsing and indexing the document contents, converting the document from serialized XML (what you see in a file) to a compressed binary fragment representation of the XML data model—strictly, the XQuery Data Model (XDM).  The data model differs from the serialized format. For example, when serialized in XML an attribute value may be surrounded by single or double quotes; in the data model that difference is not recorded.  Character references are stored internally as codepoints.

Therefore, when XML is returned from the database, the content will be the same, but serialization details may vary.  If it is required to return a file byte-for-byte then it can be stored in in MarkLogic server in its binary form.  However, binary documents are not indexed by MarkLogic, which means they cannot be directly searched.

XML as returned by MarkLogic Server

Though the original serialization information may not be stored in MarkLogic Server, there are a number of ways that output can be controlled when returning serialized XML from MarkLogic Server.

  1. The XQuery xdmp:output option can be used at the code level: xdmp:output.
  2. Output options may be used with xdmp:save when writing a file.
  3. Output options may be specified at the app-server level:  Controlling App Server Access, Output, and Errors.

 

(1 vote(s))
Helpful
Not helpful

Comments (0)