错误信息:System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Xml.XmlException: Name cannot begin with the '1' character, hexadecimal value 0x31. Line 1, position 918.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
   at System.Xml.XmlTextReaderImpl.ParseQName(Boolean isQName, Int32 startOffset, Int32& colonPos)
   at System.Xml.XmlTextReaderImpl.ParseElement()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
   at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.LoadXml(String xml)
   at BasInfomation.BasWebService.IsExsist(String xml, Int32 tag)
   at BasInfomation.BasWebService.GetBasInfo(Int32 tag, String basInfo)
   --- End of inner exception stack trace ---
   在 System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   在 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   在 DataReport.WebInf.BasWebService.GetBasInfo(Int32 tag, String basInfo)
   在 DataReport.frmAutoUpdate.DataToXml(DataTable dtXml)
发生在:

 

错误解决:

 1、改头文件:sbXML.Append("<?xml version='1.0' encoding='utf-8'?>");为sbXML.Append("<?xml version='1.0' encoding='UTF-8'?>");

                  改过之后问题并没有解决,还是报该错误,纠结啊纠结啊。。。。

2、经过跟踪代码发现,并不是1中情况那样,而是取的数据中多了特殊符号(<  >等)如

    <MZZD>身体体表<10%烧伤</MZZD> <JBBM>T31.000</JBBM> <ZYZD>身体体表<10%烧伤</ZYZD>

    <和>号未经转义,就报上面的错误了,需要经过转义,下面是五个在XML文档中预定义好的实体:

&lt;
<
小于号
&gt;
>
大于号
&amp;
&
&apos;
'
单引号
&quot;
"
双引号
posted on 2014-02-12 11:44  梦想&现实  阅读(566)  评论(0编辑  收藏  举报