You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Srinivas Suram <sr...@pinnacleinfo-sys.com> on 2001/12/28 10:40:35 UTC

can any body help me (this Problem with crimson.jar)

  Hi,
Iam a Java developer woking in Pinnacle Info Solutions,Chennai,India on
server side of a palmtop based project.
I have to handle incoming requests(XML stream) coming over XML-RPC from
various devices.
Iam using sun's crimson parser using JAXP to parse XML documents.Iam using
SAX for parsing
When i get an XML String with UTF-16LE XMLReader is unable to parse and is
saying that the
"Document Root Element is missing".
The Xml String received from Client(WinCE)is as follows:
String sXml="< ? x m l   v e r s i o n = \"1.0\" ? >< t l m e s s a g e > <
t l v e r s i o n > 1 . 0 < / t l v e r s i o n > < t l a p pl i c a t i o n
> A P P I D 1 2 < / t l a p p l i c a t i o n > < t l c l i e nt I d > C E C
I D 1 < / t l c l i e n t I d > < / t l m e s s a g e >";
The String is converted to InputStream using:
InputStream is = new ByteArrayInputStream(sXml.getBytes());
Hashtable hT = XmlHandler.getParsedData(is);

Iam sending the code snippet of the method that is used to parse the Xml
InputStream

		public Hashtable getParsedData(InputStream is)
		{
	      XMLReader xmlReader = null;
		SAXParserFactory spf = SAXParserFactory.newInstance();
		SAXParser saxParser = spf.newSAXParser();
		// Get the encapsulated SAX XMLReader
            xmlReader = saxParser.getXMLReader();
		xmlReader.setContentHandler(new XMLHandler());
            InputSource ist = new InputSource(is);
		xmlReader.parse(ist);
		}

When i use Xerces.jar the SAX parser is able to parse the same Xml String
When i set the encoding as ist.setEncoding("UTF-16") an exception like
"Missing Byte Order Mark" is coming.

with regards
Srinivas.s