抱歉英语不好。感谢@Anton 提供有用的问题解决方案:
我的 XML 节点:
<MediaObject Title='name' MediaObjectID='14' X1='42,00' Y1='3,00' X2='72,00' Y2='31,00' MediaType='video'/>
<MediaObject Title='name' MediaObjectID='15' X1='3,00' Y1='3,00' X2='34,00' Y2='31,00' MediaType='video'/>
如果你在 div 中使用 xml 节点,浏览器会转换它:
<mediaobject title='name' mediaobjectid='14' x1='42,00' y1='3,00' x2='72,00' y2='31,00' mediatype='video'>
<mediaobject title='name' mediaobjectid='15' x1='3,00' y1='3,00' x2='34,00' y2='31,00' mediatype='video'></mediaobject></mediaobject>
浏览器更改节点并将节点名称和属性转换为小写。
解决方案:使用 xml 作为值,如下所示并阅读它。因此浏览器不添加节点,也不将节点名称/属性更改为小写。不要忘记使用带有“'”的属性值:
<input type="hidden" name="xmldata" id="xmldata" value="<Contents><Content PreviousContentID='30' PreviousContentName='aaa' NextContentID='28' NextContentName='aaa'><Page Number='3' RelativePath='images/res1.jpg' AbsolutePath='a.net'><MediaObject Title='aaa' MediaObjectID='58' X1='38,64' Y1='50,37' X2='54,06' Y2='54,25' MediaType='link'></MediaObject><MediaObject Title='aaa' MediaObjectID='58' X1='8,43' Y1='2,27' X2='33,12' Y2='24,31' MediaType='link'></MediaObject></Page></Content></Contents>">
如果你想在 div 中使用:使用小写的节点名称和属性,不要使用这样的行:
<mediaobject title='name' mediaobjectid='14' x1='42,00' y1='3,00' x2='72,00' y2='31,00' mediatype='video'/>
将其更改为:
<mediaobject title='name' mediaobjectid='14' x1='42,00' y1='3,00' x2='72,00' y2='31,00' mediatype='video'></mediaobject>