wood burning stoves 2.0
The moose likes XML and Related Technologies and the fly likes SAX Parser with Xalan Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "SAX Parser with Xalan" Watch "SAX Parser with Xalan" New topic

SAX Parser with Xalan

Devang B patel

Joined: Oct 20, 2000
Posts: 6
I am using XML applications.
I am using Xalan parser for Xml file transformation.
job1 : Create XML document dynamically with data from
job2 : Transform generated XML file with xsl to get
HTML file output.
job 1 is working fine with jaxp parser
job 2 is working fine with xalan parser
I am creating xml file dynamically by fetching data
from database.
When I am using Xalan parser class path setting I am
not able to generate XML document
But by adding jaxp parser in the classpath I am able
to generete the document. But now if I am tring to
transform it I am getting the runtime exception that
"Namespace not supported by the parser".
How can I get both of the functions working properly
with either of the parser.
Thanx in Advance,
John Coyne

Joined: Jan 24, 2001
Posts: 1
You need to make sure the parser JAXP is SAX 2.0 and DOM 2.0 compliant. I had a similar problem not to long ago. I fixed it by making sure the "parser" (JAXP in your case) is first in the classpath. BTW I believe there is a parser already in the xalan/xerces packages and you shouldn't need JAXP. (I think it is already included in those packages) Hope this helps
Junaid Bhatra
Ranch Hand

Joined: Jun 27, 2000
Posts: 213
When using JAXP, try turning on namespace-awareness using setNameSpaceAware(true) when you configure the JAXP factory, javax.xml.parsers.SAXParserFactory. The default is set to false when you use Sun's parser & factory-implementaion com.sun.xml.parser.SAXParserFactoryImpl.
Also if you use a different parser with JAXP, you may run into classpath problems if the parser supports more features than SAX 1.0 (JAXP parser only supports 1.0). In that case try adjusting the class-path as John suggested.
I agree. Here's the link: http://aspose.com/file-tools
subject: SAX Parser with Xalan
It's not a secret anymore!