Menu

Praing error with JAXP

2005-07-12
2013-05-02
  • Stefano Lenzi

    Stefano Lenzi - 2005-07-12

    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

     
    • Satoshi Konno

      Satoshi Konno - 2005-07-12

      Hi Stefano,

      I haven't checked with JAXP yet, but the problem may be occurred
      due to lack of the XML define header, <?xml ... ?>.

       
    • Stefano Lenzi

      Stefano Lenzi - 2005-07-12

      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;
          }

       

Log in to post a comment.