Index ¦ Archives ¦ Atom

Uploading XML File to MarkLogic Server using IE

I ran into a problem uploading an XML file into Internet Explorer today. When uploading the file into MarkLogic Server using Firefox, the file content-type was "text/xml". I expected this from IE, but found that it was "application/octet-stream". I didn't know exactly what "octet-stream" meant at the time but I feel like I should have understood what that meant. It basically converted each character in the XML document into it's hexadecimal equivalent and then sent that converted string to the server.

So, how does one go about converting that back to the XML node that I need in MarkLogic?

First, cast the contents as xs:hexBinary. Then, create a binary node with those contents and finally, use xdmp:quote() to create a string and then finally xdmp:unquote() to convert this back to an xml node.

xdmp:unquote(xdmp:quote(binary { xs:hexBinary($content) } ) )

Done. Thanks to this post for helping me find the solution. I've tried to explain it as I understand it.

© Steve Spigarelli. Built using Pelican. Theme by Giulio Fidente on github.