[MarkLogic Dev General] Creating text files

Ron Hitchens ron.hitchens at marklogic.com
Fri Feb 29 15:59:31 PST 2008


  You need the computed constructor for text nodes.  Try this:

    let $css-content := "h1{background:orange}"
    let $css-path := fn:concat("/css/",$user,".css")
    xdmp:document-insert($css-path, text { $css-content })

  All documents inserted must have a root node.  If the root
is an element, then it's treated as XML.  If it's a text node,
then it's a text (CLOB) document.  If it's a binary node, then
it's a binary BLOB.

On Feb 29, 2008, at 3:28 PM, <Paul.Williams at flatironssolutions.com>  
wrote:

> I'm planning on creating a page on our site where users can alter
> certain styles defined in a personal CSS file.  I'm hoping I can  
> create
> such a CSS file dynamically and store it in the DB for future  
> reference.
>
>
> All of my xquery experience has been to produce XML or XHTML  
> content, so
> I'm unsure about the best way to create a text file (i.e., the CSS)  
> and
> store it in the DB.  As a quick test, I tried the following...
>
> 	let $css-content := "h1{background:orange}"
> 	let $css-path := fn:concat("/css/",$user,".css")
> 	xdmp:document-insert($css-path, $css-content)
>
> As expected, I get: "arg2 is not of type node()".  So, how do you  
> create
> a stand-alone text node for something like this?  I'm sure there's a
> simple answer, isn't there?  Anyone got any suggestions?
>
> Thanks
> -- Paul
>
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general

---
Ron Hitchens {ron.hitchens at marklogic.com}  650-655-2351






More information about the General mailing list