Crm 2011 Fetch XMl - 无效的XML问题,如何修复?

Yaq*_*mad 3 xml fetchxml dynamics-crm-2011

我正在使用fetch xml来修复ms crm 2011实体的值.它抛出INVALID XML错误,示例xml如下:

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
    <entity name='xyz_registrationanswer'>
         <attribute name='xyz_registrationid' />
         <attribute name='xyz_name' />
         <filter type='and'> 
            <condition attribute='xyz_name' operator='in' >  
                <value>Do you want to subscribe to 1 & 2?</value>         
            </condition> 
        </filter> <order attribute='xyz_name' descending='false' />
    </entity>
</fetch>
Run Code Online (Sandbox Code Playgroud)

通过调查问题,我发现原因是1和2之间的&符号:

<value>Do you want to subscribe to 1 & 2?</value> 
Run Code Online (Sandbox Code Playgroud)

1-有人可以帮我解决这个问题吗?

2-什么是其他非法字符,以便我可以处理它们?

问候.

Tea*_*Dev 5

XML中有五个"非法"字符必须编码为实体:

<as<
> as>
'as'
"as"
&as&

这是HttpUtility.HtmlEncode()有效的.

还有其他的,例如变音字符,在HTML中使用时应编码,但对于Unicode XML,只有五个绝对必须要处理.