美文网首页
发送xml文件出现 org.xmlpull.v1.XmlPull

发送xml文件出现 org.xmlpull.v1.XmlPull

作者: Yo_5529 | 来源:发表于2020-10-14 19:04 被阅读0次

    发送xml文件出现 org.xmlpull.v1.XmlPullParserException: processing instruction can not have PITarget with reserveld xml name (position: START_DOCUMENT seen \n <?xml ... @2:13) \nprocessing instruction can not have PITarget with reserveld xml name (position: START_DOCUMENT seen \n <?xml ... @2:13) </ows:ExceptionText>\n问题

    在发送xml请求的时候,返回的是如下图所示的情况。

    l0aefK
    <?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <ows:ExceptionReport
        xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"
        xmlns:ows=\"http://www.opengis.net/ows\"
        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.0.0\" xsi:schemaLocation=\"http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd\">\n
        
        <ows:Exception exceptionCode=\"NoApplicableCode\">\n
            
            <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException: processing instruction can not have PITarget with reserveld xml name (position: START_DOCUMENT seen \\n      &lt;?xml ... @2:13) \nprocessing instruction can not have PITarget with reserveld xml name (position: START_DOCUMENT seen \\n      &lt;?xml ... @2:13) </ows:ExceptionText>\n
        
        </ows:Exception>\n
    
    </ows:ExceptionReport>
    

    解决方法

    看一下我们发送的xml请求

    <?xml version="1.0" ?>
    <wfs:Transaction
       version="2.0.02.0.2"
       service="WFS"
       xmlns="http://www.someserver.example.com/myns"
       xmlns:fes="http://www.opengis.net/fes/2.0"
       xmlns:wfs="http://www.opengis.net/wfs/2.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.opengis.net/wfs/2.0
                           http://schemas.opengis.net/wfs/2.0.02.0/wfs.xsd">
       <wfs:Update typeName="BuiltUpA_1M">
          <wfs:Property>
             <wfs:ValueReference>population</wfs:ValueReference>
             <wfs:Value>4070000</wfs:Value>
          </wfs:Property>
          <fes:Filter>
             <fes:ResourceId rid="BuiltUpA_1M.10131"/>
          </fes:Filter>
       </wfs:Update>
    </wfs:Transaction>
    

    可以看到xml文件的内容并没有进行闭合

    7Igizu

    可以删除首行解决

    <?xml version="1.0" ?>
    

    相关文章

      网友评论

          本文标题:发送xml文件出现 org.xmlpull.v1.XmlPull

          本文链接:https://www.haomeiwen.com/subject/vogwpktx.html