special characters not respected by MXQuery

Todd Swope
2009-09-14
2013-06-05
  • Todd Swope
    Todd Swope
    2009-09-14

    I have a situation where I want to use MXQuery Update to inject some text which contains special characters, for instance 


    But after mxquery evaluates the expression, it is replacing this with a ' '. I would like for any special characters to be respected and not replaced automatically… is there a setting or something that can be set to allow this to happen?

    thanks!

     
  • Todd Swope
    Todd Swope
    2009-09-15

    this apears to be a non-issue… verified thru some junit tests, and appears to not be an issue with MXQuery evaluation.

     
  • John Newman
    John Newman
    2010-02-19

    Hi,

    swopet was a former colleague of mine working on the same project.  I am here to reopen this post as we are actually seeing it again now - but it's with insert only, not replace.

    If we replace an attribute with text that has multiple new lines, everything is preserved ok.

      <el Notes="some &#x0D;&#x0A; existing notes" />
            declare variable $newNote := "a note with &#x0D;&#x0A; multiple &#x0D;&#x0A;&#x0D;&#x0A; new lines";
    replace value of node target//el/@Notes with $newNote

    <el Notes="a note with &#x0D;&#x0A; multiple &#x0D;&#x0A;&#x0D;&#x0A; new lines" />

    perfect.  But if we do an insert
      <el />
    insert nodes attribute Notes {some notes with &#x0D;&#x0A; multiple &#x0D;&#x0A;&#x0D;&#x0A; new lines} into $target//el

    we end up with

    <el Notes="some notes with multiple new lines" />

    The new lines are replaced with a space and consecutive spaces are collapsed into one.  Any ideas why this is happening for insert only?  Is there a setting or different syntax for this?  Or does it look like a bug? I'd be happy to write up a simple junit test if that would help troubleshoot.  Please advise.

    Thanks,
    John