For example, the following xml works if there is no special characters in the value. But fails when I have & sign. I tried to wrap the value with CDATA syntax ( <![CDATA[CITY & COUNTY]]>
) but getting "Unexpected end of file while parsing CDATA has occurred. Line 44, position 122"
<Method ID="5">
<Field Type="Text" Name="Company" DisplayName="Company Name" FromBaseType="TRUE" >
<Default>Rob & Schnider Company</Default>
</Field>
</Method>
Additional Info (if needed): I am using SharePoint 2010 and it's web services to set default values for certain columns in a document library.
Actually, since I am using Nintex for workflow there is function which takes care of the special characters. All you do is wrap the value with the the function.
fn-XmlEncode
Encodes a string to make it safe for viewing in html.
Example
fn-XmlEncode({WorkflowVariable:Text})
There aren't very many. there are like 5 characters that you have to escape in your xml.
& & Ampersand sign
' ' Single quote
" " Double quote
> > Greater than
< < Less than
just change your &
to a &
, and it should work.
if you're parsing this with ac# XML library, it should know what to do with the escape sequences.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.