Alain-Serge
Usenet Archive
- Joined
- Jul 29, 2004
- Messages
- 1
- Reaction score
- 0
Hello,
I'm trying to create a XML document from a string comming from a C++ program but I got an exception saying:
org.xml.sax.SAXParseException: Element type "DataFromWebServer" is not declared
Here "DataFromWebServer" is the name of document root node. Here is the code:
char cbuf = new char[2000];
//Get the data from the socket.
m_inputStream.read(cbuf);
String strdata = new String(cbuf);
//Qt Bug fix: Clean up the strdata.
String strFinalData = strdata.trim;
System.out.println(strFinalData);//For debug
InputSource in = new InputSource ((InputStream) new
ByteArrayInputStream (strFinalData.getBytes));
XmlDocument xmlDocument =
XmlDocument.createXmlDocument(in, true);
///////////Here is what I got from
System.out.println(strFinalData)///////////
<?xml version = '1.0' encoding = 'UTF-8'?>
<DataFromWebServer>
<AddresseNode>
<Addresse>6</Addresse>
</AddresseNode>
<DatatypeNode>
<Datatype>25</Datatype>
</DatatypeNode>
<DataNode>
<data>6</data>
</DataNode>
</DataFromWebServer>
///////////Here is complete error message////////////////////////////
org.xml.sax.SAXParseException: Element type "DataFromWebServer" is not declared. at org.apache.crimson.parser.Parser2.error(Parser2.java:3354) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1502) at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667) at org.apache.crimson.parser.Parser2.parse(Parser2.java:337) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448) at org.apache.crimson.tree.XmlDocument.createXmlDocument(XmlDocument.java:315) at COrusSocketThread.run(COrusSocketThread.java:137) at java.lang.Thread.run(Thread.java:534)
Thanks for your help
Alain-Serge
I'm trying to create a XML document from a string comming from a C++ program but I got an exception saying:
org.xml.sax.SAXParseException: Element type "DataFromWebServer" is not declared
Here "DataFromWebServer" is the name of document root node. Here is the code:
char cbuf = new char[2000];
//Get the data from the socket.
m_inputStream.read(cbuf);
String strdata = new String(cbuf);
//Qt Bug fix: Clean up the strdata.
String strFinalData = strdata.trim;
System.out.println(strFinalData);//For debug
InputSource in = new InputSource ((InputStream) new
ByteArrayInputStream (strFinalData.getBytes));
XmlDocument xmlDocument =
XmlDocument.createXmlDocument(in, true);
///////////Here is what I got from
System.out.println(strFinalData)///////////
<?xml version = '1.0' encoding = 'UTF-8'?>
<DataFromWebServer>
<AddresseNode>
<Addresse>6</Addresse>
</AddresseNode>
<DatatypeNode>
<Datatype>25</Datatype>
</DatatypeNode>
<DataNode>
<data>6</data>
</DataNode>
</DataFromWebServer>
///////////Here is complete error message////////////////////////////
org.xml.sax.SAXParseException: Element type "DataFromWebServer" is not declared. at org.apache.crimson.parser.Parser2.error(Parser2.java:3354) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1502) at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667) at org.apache.crimson.parser.Parser2.parse(Parser2.java:337) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448) at org.apache.crimson.tree.XmlDocument.createXmlDocument(XmlDocument.java:315) at COrusSocketThread.run(COrusSocketThread.java:137) at java.lang.Thread.run(Thread.java:534)
Thanks for your help
Alain-Serge