I know that the text string between the start and end tags contains no XML, only text with no markup.
My plan is to put the text string between the open and close title tags as part of a larger text string that I want to convert to an XML document via xdmp:unquote . Sounds like I'll be whipping up my own function based on fn:replace. Steve On Jul 29, 2017, at 12:39 AM, Jason Hunter <jason.hun...@marklogic.com> wrote: Why do you have malformed xml like that? How do you reliably know what's tags and what's string? Your plan is to preprocess the text to make it well-formed xml so it can be unquoted? Sent from my iPhone On Jul 29, 2017, at 14:08, Steven Anderson <sander...@salesforce.com> wrote: Within the larger context, I have a string like this: <title>A title for <placeholder text> the product</title> that I'm then converting into an xml document node using xdmp:unquote. That makes xdmp:unquote barf, but if I do a fn:replace, on the specific characters it works. As I said, I can whip something up, but I assumed there was an obvious function for this. Steve On Jul 28, 2017, at 10:28 PM, Jason Hunter <jason.hun...@marklogic.com> wrote: In normal XQuery you don't need to do this. Are you sure you do? Maybe you just need: <foo>{ $value }</foo> The value will be properly escaped on output. Sent from my iPhone On Jul 29, 2017, at 13:01, Steven Anderson <sander...@salesforce.com> wrote: I could do that, but I just figured there'd be a xquery function do to it for all three special XML characters. It's easy enough to write one, but I just assumed that someone else would have needed it. On Jul 28, 2017, at 9:12 PM, Indrajeet Verma <indrajeet.ve...@gmail.com> wrote: Steve - Did you try using fn:replace? e.g. fn:replace(fn:replace($title, "<", "&lt;"), ">", "&gt;") On Sat, Jul 29, 2017 at 5:32 AM, Steve Anderson <steve.ander...@gmail.com> wrote: > I have a string like this: > > A title for <placeholder> the product > > and I'd like to replace it with > > A title for <placeholder> the product > > Basically, I want to make the a valid XML text node, fixing greater than, > less than, and ampersands. I thought I could make xdmp:quote do that, but, > perhaps because it's Friday afternoon, I can't find the right options to > make it work. > > Is there any easy solution I can't find? > > Steve > > > > _______________________________________________ > General mailing list > General@developer.marklogic.com > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > > _______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general