Hi all,
I'm trying to use JAXP as XML parser and now I get a ParseException:
org.xml.sax.SAXParseException: Content is not allowed in trailing section
The content that give the error is:
<e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0">
<e:property><PossibleConnectionTypes>IP_Routed</PossibleConnectionTypes></e:property>
<e:property><ConnectionStatus>Connected</ConnectionStatus></e:property>
<e:property><ExternalIPAddress>151.42.79.37</ExternalIPAddress></e:property>
<e:property><PortMappingNumberOfEntries>15</PortMappingNumberOfEntries></e:property>
</e:propertyset>
I'm not sure if the trouble is releted to my changes to CyberLink, but I think is releted to JAXP
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I'm trying to use JAXP as XML parser and now I get a ParseException:
org.xml.sax.SAXParseException: Content is not allowed in trailing section
The content that give the error is:
<e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0">
<e:property><PossibleConnectionTypes>IP_Routed</PossibleConnectionTypes></e:property>
<e:property><ConnectionStatus>Connected</ConnectionStatus></e:property>
<e:property><ExternalIPAddress>151.42.79.37</ExternalIPAddress></e:property>
<e:property><PortMappingNumberOfEntries>15</PortMappingNumberOfEntries></e:property>
</e:propertyset>
I'm not sure if the trouble is releted to my changes to CyberLink, but I think is releted to JAXP
Hi Stefano,
I haven't checked with JAXP yet, but the problem may be occurred
due to lack of the XML define header, <?xml ... ?>.
The problem is related to the packed sent by Real Device (U.S. Robotics USR9106)
I have sniffed the packet and the problem is that I get one extra empty line in my event packet.
So I have chenged the CyberLink code in this way:
org.cybergarage.soap.SOAPRequest:
private synchronized Node getRootNode()
{
if (rootNode != null)
return rootNode;
try {
byte content[] =
/*Line Changed*/
new String(getContent()).trim().getBytes();
ByteArrayInputStream contentIn = new ByteArrayInputStream(content);
Parser parser = SOAP.getXMLParser();
rootNode = parser.parse(contentIn);
}
catch (ParserException e) {
Debug.warning(e);
}
return rootNode;
}
The original method was:
org.cybergarage.soap.SOAPRequest:
private synchronized Node getRootNode()
{
if (rootNode != null)
return rootNode;
try {
byte content[] = new getContent();
ByteArrayInputStream contentIn = new ByteArrayInputStream(content);
Parser parser = SOAP.getXMLParser();
rootNode = parser.parse(contentIn);
}
catch (ParserException e) {
Debug.warning(e);
}
return rootNode;
}