Reputation: 3451
I'm using the intrinsic function XML-PARSE with XML that looks like this:
<MSGBODYTXT>
<LN>One & two</LN>
</MSGBODYTXT>
By my count, the following string is 13 bytes long.
"One & two"
But when I take $ LENGTH OF(XML-TEXT) $ I get only 9 bytes.
What can I do to get the correct, 13-byte length?
Upvotes: 1
Views: 834
Reputation: 16928
The problem is that XML PARSE translates &
into the character it represents, an ampersand. If
you look at the CONTENT-CHARACTERS
associated with the <LN>
tag you will see: One & two
which
is 9 characters long, just as the LENGTH OF
operator on XML-TEXT
says it is.
Note that if you were to use XML GENERATE on data item LN
having the value One & two
it will generate as <LN>One & two</LN>
which is a symetrical operation.
Upvotes: 4