Tilde in XML

Is the tilde a legal character in an XML SOAP message? I am getting SAXParseException: Content not allowed in prologue. I have included most of the SOAP message just in case I bark the wrong tree.

POST /... HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: 127.0.0.1:1234
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 1497
Authorization: Basic b3BlbnBkbTpvdHRvMTIz

<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
         <ns1:query soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://localhost">
            <where xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">type ~~ 'command'</where>

         </ns1:query>
      </soapenv:Body>
   </soapenv:Envelope>

      

+1


source to share


2 answers


I'm not sure about SOAP messages, but when processing XML files, one possible reason for this error message is that there is a BOM (order token byte) at the beginning of the file - some XML parsers cannot handle this unless they configured or not called correctly. Check it out (using a hex editor) and try what happens if you delete it.



In Python, for example, you need to open a UTF-8 encoded XML file using codecs.open(filename, "UTF-8")

, not just open(filename)

to make sure the BOM, if any, is processed correctly.

+2


source


Is the tilde a legal character in an XML SOAP message?



Yes. The error message points to another source of errors ("prologue"). Maybe the HTTP header is possibly part of the code sent to the SAX parser like in your example code?

+1


source







All Articles