首页 新闻 搜索 专区 学院

xml报错

0
悬赏园豆:15 [已解决问题] 解决于 2008-07-01 09:21
<H2><I><FONT size=4>前几天运行还是好的 今天一运行就报这样的错。请大家帮忙看看</FONT></I></H2> <P>&nbsp;</P> <H2><I><FONT size=4>意外的 XML 声明。XML 声明必须是文档中的第一个节点并且在它之前不允许出现空白字符。 行 2,位置 3。</FONT></I> </H2><FONT face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><B>说明: </B>执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 <BR><BR><B>异常详细信息: </B>System.Xml.XmlException: 意外的 XML 声明。XML 声明必须是文档中的第一个节点并且在它之前不允许出现空白字符。 行 2,位置 3。<BR><BR><B>源错误:</B> <BR><BR> <TABLE width="100%" bgColor=#ffffcc> <TBODY> <TR> <TD><CODE>执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。</CODE> </TD></TR></TBODY></TABLE></FONT>
zmxmiss的主页 zmxmiss | 初学一级 | 园豆:134
提问于:2008-06-30 16:41
< >
分享
最佳答案
1
请把问题再说的详细些,比如你的XML文件是用程序写出来的,还是已经存在是类似配置文件的用途即是人为手工写出来的,要不就会向网友玉开和丁学一样是猜问题回答了。 1、如果是人为的写的XML,那么请检查文件是否被改动了,是否出现了XML头标记错误,正确的开头标记为:<?xml version="1.0" encoding="utf-8"?>,注意每一个字符不要多任何一个无用的字符也不能少了某个字符,使得本来正确的变的不正确了。 2、如果是代码编写XML文件,看看写XML文件中定义的变量赋值是否被改动了,尤其是头标记的赋值,然后断点检测每个变量值的变化,应该能找到问题所在。 建议:其实最好是将与此报错的XML文件有关代码粘贴出来。
刚刚 | 老鸟四级 |园豆:3151 | 2008-07-01 05:05
其他回答(4)
1
xml声明之前有空字符;有可能是Bom声明。去掉空字符应该就可以了。
玉开 | 园豆:8822 (大侠五级) | 2008-06-30 16:50
0
也可能是程序出错了,所以返回的是被抛出的错误信息而非正确的XML文件 一般碰到这种问题,直接在浏览器里右键查看源代码,一般都可以发现问题所在
丁学 | 园豆:18530 (专家六级) | 2008-06-30 19:38
0

同样的问题.有解决办法吗?

 

 

<?xml version="1.0" encoding="gb2312"?>
<databasetask>
    <!--GPRS_Eric_SGSN  oracle小时粒度-->
   <task id="0x21200027" name="GPRS_Eric_SGSN_H" dbname="oracle.10.221.127.60" timeorigin="database" timeslicelength="3600" tablename="IPNET.GPRS_ERIC_SGSN" comment="">
    <procedure sequence="1" comment="">
      <properties>
        <proceduretype>select</proceduretype>
      </properties>
         <timeaxisref refid='2' />
      <sqls>
             <!--
           <sql>select '$STARTTIME',NetElement,Max2GAttached,sum(GprsAttached2G),sum(GprsAttachedFail2G),sum(GprsAttachedSucc2G),round(avg(GprsAttachedRate2G),2),Max3GAttached,sum(GprsAttached3G),sum(GprsAttachedSucc3G),round(avg(GprsAttachedRate3G),2),sum(ActivePDP2G),sum(PDP2GActiveAttempt),sum(PDP2GActiveSucc),sum(PDP2GActiveFail2728),sum(PDP2GActiveFail29),sum(PDP2GActiveFail3233),round(avg(PDP2GActiveRate),2),sum(ActivePDP3G),sum(PDP3GActiveAttempt),sum(PDP3GActiveSucc),sum(PDP3GActiveFail2728),sum(PDP3GActiveFail29),sum(PDP3GActiveFail3233),round(avg(PDP3GActiveRate),2),sum(SGSNfrom3Gto2G),sum(SGSNfrom3Gto2GSucc),round(avg(SGSNfrom3Gto2GRate),2),sum(IntraRaUpdateSucc2G),sum(IntraRaUpdate2G),sum(InterRaUpdateSucc2G),sum(InterRaUpdate2G),round(avg(RaUpdateRate2G),2),sum(IntraUpdateSucc3G),sum(IntraUpdate3G),sum(InterUpdateSucc3G),sum(InterUpdate3G),round(avg(RaUpdateRate3G),2),sum(SGSNGBUplink),sum(SGSNGBDownlink),sum(GTPUINDATAOCTIU),sum(GTPUOUTDATAOCTIU) from GPRS_Eric_SGSN where START_TIME &gt;=to_date('$STARTTIME','yyyy-mm-dd hh24:mi:ss') and START_TIME &lt;to_date('$ENDTIME','yyyy-mm-dd hh24:mi:ss') group by NetElement having Max2GAttached+Max3GAttached=max(Max2GAttached+Max3GAttached)</sql>
             -->
           <sql>
            select x.*,y.max2g,max3g from(select '2010-10-14 09:00:00',NetElement,sum(GprsAttached2G),sum(GprsAttachedFail2G),sum(GprsAttachedSucc2G),round(avg(GprsAttachedRate2G), 2),sum(GprsAttached3G),sum(GprsAttachedSucc3G),round(avg(GprsAttachedRate3G), 2),sum(ActivePDP2G),sum(PDP2GActiveAttempt),sum(PDP2GActiveSucc),sum(PDP2GActiveFail2728),sum(PDP2GActiveFail29),sum(PDP2GActiveFail3233),round(avg(PDP2GActiveRate), 2),sum(ActivePDP3G),sum(PDP3GActiveAttempt),sum(PDP3GActiveSucc),sum(PDP3GActiveFail2728),sum(PDP3GActiveFail29),sum(PDP3GActiveFail3233),round(avg(PDP3GActiveRate), 2),sum(SGSNfrom3Gto2G),sum(SGSNfrom3Gto2GSucc),round(avg(SGSNfrom3Gto2GRate), 2),sum(IntraRaUpdateSucc2G),sum(IntraRaUpdate2G),sum(InterRaUpdateSucc2G),sum(InterRaUpdate2G),round(avg(RaUpdateRate2G), 2),sum(IntraUpdateSucc3G),sum(IntraUpdate3G),sum(InterUpdateSucc3G),sum(InterUpdate3G),round(avg(RaUpdateRate3G), 2),sum(SGSNGBUplink),sum(SGSNGBDownlink),sum(GTPUINDATAOCTIU),sum(GTPUOUTDATAOCTIU) from GPRS_Eric_SGSN where START_TIME >=to_date('2010-10-14 09:00:00', 'yyyy-mm-dd hh24:mi:ss') and START_TIME < to_date('2010-10-14 10:00:00', 'yyyy-mm-dd hh24:mi:ss') group by NetElement) x,(select '2010-10-14 09:00:00',b.NetElement,b.Max2GAttached as max2g,b.Max3GAttached as max3g from (select NetElement, max(summax) msm from (select NetElement,Max2GAttached,Max3GAttached,Max2GAttached + Max3GAttached summax from GPRS_Eric_SGSN where START_TIME >=to_date('2010-10-14 09:00:00', 'yyyy-mm-dd hh24:mi:ss') and START_TIME <to_date('2010-10-14 10:00:00', 'yyyy-mm-dd hh24:mi:ss')) group by NetElement) a,(select NetElement,Max2GAttached,Max3GAttached,Max2GAttached + Max3GAttached summax from GPRS_Eric_SGSN where START_TIME >= to_date('2010-10-14 09:00:00', 'yyyy-mm-dd hh24:mi:ss') and START_TIME <to_date('2010-10-14 10:00:00', 'yyyy-mm-dd hh24:mi:ss')) b where a.NetElement = b.NetElement and a.msm=b.summax)y where x.NetElement = y.NetElement
            </sql>
      </sqls>
       <distributor>
        <output type='router' eventids="0x10d00003" seqids="abdefgijklmnopqrstuvwxyzABCDEFGHIJKLMNOPch"/>
      </distributor>
    </procedure>
  </task>
        <timeaxis>
               
                <axis refid='3'>
                        <mends>
                                <mend seqid="1" starttime="2009-08-17 06:00:00" endtime ="2009-08-17 06:05:00" segment="1"/>
                        </mends>
                                <nexthop  segment="3" offset="300" reference=""/>
                </axis>

                <axis refid='1'>
                        <mends>
                                <mend seqid="1" starttime="2009-08-04 07:00:00" endtime ="2009-08-05 07:00:00" segment="1"/>
                        </mends>
                        <nexthop  segment="1" offset="86400" reference=""/>
                </axis>
               
               
                <axis refid='2'>
                        <mends>
                                <mend seqid="1" starttime="2010-10-14 09:00:00" endtime ="2010-10-14 14:00:00" segment="1"/>
                        </mends>
                        <nexthop  segment="3" offset="3600" reference=""/>
                </axis>
               
        </timeaxis>

       
       
       

</databasetask>

land_zhj | 园豆:199 (初学一级) | 2010-10-18 17:54
0

我刚刚也遇到同样问题,配置文件web.config开头必须是<?xml version="1.0" encoding="utf-8"?>顶格,不能有空格,换行等等。

云中尚飞 | 园豆:202 (菜鸟二级) | 2012-12-10 12:58
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册