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>
source to share
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.
source to share