JSTL & Apache Crimson

Hi, I have been experiencing problems whilst attempting to use the JSTL Standard Tag Library with the Apache Crimson XML Parser in the classpath. I have tried running the JSTL JSP page without Crimson in the classpath and it works fine. However when included in the classpath and I attempt to view the page I get the error below. According to this page:
http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/GettingStarted.html
the "Standard Taglib requires a JAXP 1.1 or 1.2 compliant parser". It goes on to list Crimson as an example of this. However the Crimson pages states that it supports "JAXP 1.1 minus the javax.xml.transform package."
I would simply use another XML parser, except that I am using the Google API Jar which uses Crimson, thus I cannot remove it from the classpath if I wish to continue using the Google API.
If anyone has any idea how I might solve this problem I'd be keen to hear them,
Thanks very much,
Ross Butler
org.apache.jasper.JasperException: <h3>Validation error messages from TagLibraryValidator for c</h3>
null: java.lang.IllegalStateException: can't declare any more prefixes in this context
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:72)
org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1549)
org.apache.jasper.compiler.Validator.validate(Validator.java:1495)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:157)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

the "Standard Taglib requires a JAXP 1.1 or 1.2
compliant parser". It goes on to list Crimson as an
example of this. However the Crimson pages states
that it supports "JAXP 1.1 minus the
javax.xml.transform package." So what? An XML parser just parses an XML document into some internal representation of the XML. It doesn't do transformations. So what you say there doesn't appear to be relevant to me. It is an example of that.
I would simply use another XML parser, except that I
am using the Google API Jar which uses Crimson, thus
I cannot remove it from the classpath if I wish to
continue using the Google API.Why not? Does the Google API (I'm not familiar with it) say it MUST use Crimson? I think it's likely that it's distributed with Crimson for the convenience of users who don't have any XML parser (Java 1.3 and earlier users). So if it comes with a separate crimson.jar (or whatever) then just toss that out and see what happens. I didn't notice that being one of the tests you did.
And if you find that Google API doesn't work with the built-in parser in your JRE, it's possible to specify the parser your environment should use by setting the system property javax.xml.parsers.SAXParserFactory to the full name of Crimson's SAX parser factory and likewise the system property javax.xml.parsers.DocumentBuilderFactory. (You can't do this just for your web application, though, you want your entire web application server to use the same parser or strange things may happen. Like the strange things you are seeing.)

Similar Messages

  • Apache Crimson not compatible with JSTL?

    Hi, I have been experiencing problems whilst attempting to use the JSTL Standard Tag Library with the Apache Crimson XML Parser in the classpath. I have tried running the JSTL JSP page without Crimson in the classpath and it works fine. However when included in the classpath and I attempt to view the page I get the error below. According to this page:
    http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/GettingStarted.html
    the "Standard Taglib requires a JAXP 1.1 or 1.2 compliant parser". It goes on to list Crimson as an example of this. However the Crimson pages states that it supports "JAXP 1.1 minus the javax.xml.transform package."
    I would simply use another XML parser, except that I am using the Google API Jar which uses Crimson, thus I cannot remove it from the classpath if I wish to continue using the Google API.
    If anyone has any idea how I might solve this problem I'd be keen to hear them,
    Thanks very much,
    Ross Butler
    org.apache.jasper.JasperException: <h3>Validation error messages from TagLibraryValidator for c</h3>
    null: java.lang.IllegalStateException: can't declare any more prefixes in this context
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:72)
    org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1549)
    org.apache.jasper.compiler.Validator.validate(Validator.java:1495)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:157)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

    You should not add j2ee.jar to the WEB-INF folder. I think you should move it to "C:\Program Files\Apache Group\Tomcat 4.1\lib\j2ee.jar".
    Also, it might help to read section 9.7.2 in the servlet 2.3 specification (as stated in the error). You can download the spec here: http://www.jcp.org/aboutJava/communityprocess/final/jsr053/

  • URGENT: JAXP Provider org.apache.crimson.jaxp.SAXParserFactoryImpl not foun

    Hi all
    I am having this strage problem. I am using JAXP Apis to do XSLT transformation and everything works fine.
    But when I try the samething with
    -Djava.security.manager option and
    -Djava.security.policy==$WL_HOME/weblogic.policy option set it doesn't work. Stranger still the error it gives:
    javax.xml.transform.TransformerException: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.crimson.jaxp.SAXParserFactoryImpl not found
    This the command that works:
    $JAVA_HOME/java -classpath $WL_CLASSPATH -Dintegration.config=$WL_HOME/integration.cfg com.swl.integration.translation.SendPRThread 24972 451
    This one does NOT work:
    $JAVA_HOME/java -ms64m -mx64m -verbosegc -classpath $WL_CLASSPATH -Djava.security.manager -Djava.security.policy=$WL_HOME/weblogic.policy -Dintegration.config=$WL_HOME/integration.cfg com.swl.integration.translation.SendPRThread 24972 451
    I know it's something to do with Security manager/policy setting, but can't figure it out.
    Could anyone please help? It is very urgent.
    Thanks a lot
    Mak

    I have your solution... under Weblogic BEA were giving the same error, I resolved it with this code before the instantiation of SAXParserFactory:
    String key = "javax.xml.parsers.SAXParserFactory"
    String value = "org.apache.xerces.jaxp.SAXParserFactoryImpl";
    Properties props = System.getProperties();
         props.put(key, value);
         System.setProperties(props);

  • NullPointerException at org.apache.crimson.parser.Parser2.parseInternal

    I've tried to use JavaTM API for XML Processing (JAXP), particulary default SAX parser,
    which is embeded into JAXP.
    I downloaded jaxp-1_1.zip file from http://java.sun.com/xml/download.html, extacted it
    and included crimson.jar, jaxp.jar and xalan.jar to java CLASSPATH.
    After that I'd tried to parse XML document
    with following code
         // prepare SAX parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    DefaultHandler handler = new XMLHandler();
    try {
    // Create a JAXP SAXParser
    SAXParser saxParser = factory.newSAXParser();
    // url
    File file = new File( fileName );
    String url = file.toURL().toString();
    System.out.println( "URL: " + url );
    // parse
    saxParser.parse( url, handler );
    } catch (Exception ex) {
    ex.printStackTrace();
    throw ex;
    and obtained the message below
    java.lang.NullPointerException
         at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:523)
         at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
         at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
         at javax.xml.parsers.SAXParser.parse(SAXParser.java:346)
         at javax.xml.parsers.SAXParser.parse(SAXParser.java:232)
         at com.darout.bot.parser.PObjectsBuilder.parse(PObjectsBuilder.java:54)
         at TestSAXParser.main(TestSAXParser.java:22)
    Could you help me?

    I've found an error. It was in my handler implementation.
    But is it possible to trace a handler exception correctly?

  • Java.lang.ClassCastException: org.apache.crimson.tree.XmlDocument

    Hi all,
    i am new to java. I am trying to parse an xml document. the code is as follows:-
    Document document = null;
    DocumentBuilderFactory factory = ocumentBuilderFactory.newInstance();
    try {
         DocumentBuilder builder = factory.newDocumentBuilder();
         document = builder.parse( new File(xmlFile) );
    after this i am trying to traverse using treewalker :-
    Element docElem = document.getDocumentElement();
                   DocumentTraversal docTrav = (DocumentTraversal) document;
                   TreeWalker treeWalk = docTrav.createTreeWalker(docElem, NodeFilter.SHOW_ELEMENT, new ConfigNodeFilter(), false);
              Node node = treeWalk.nextNode();
    when i compile all is fine but while runnig it. i get the following error:-
    java.lang.ClassCastException: org.apache.crimson.tree.XmlDocument
    at - DocumentTraversal docTrav = (DocumentTraversal) document;.
    my import statements are as follows:-
    import java.io.File;
    import java.io.IOException;
    import java.net.InetAddress;
    import java.net.UnknownHostException;
    import java.util.Vector;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.traversal.DocumentTraversal;
    import org.w3c.dom.traversal.NodeFilter;
    import org.w3c.dom.traversal.TreeWalker;
    import org.xml.sax.SAXException;
    i am not able to understand why the error is coming.
    any help will be appreciated.

    "In DOMs which support the Traversal feature, DocumentTraversal will be implemented by the same objects that implement the Document interface. "
    My guess is that the DOM parser you are using doesn't support the DocumentTraversal interface which is why you can not cast to that class.

  • Namespaces / apache.crimson.parser / BASDA XML / HELP!!

    This is probably an easy question but I can't find anyone to help me.
    I am using the apache.crimson.parser to parse and validate an Xml doc against the BASDA eBIS-XML purchase order schema but i can't get the Namespaces right.
    I have this at present for the Xml doc;
    <Order xmlns ="urn:schemas-microsoft-com:xml-data"
    xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:schemas-microsoft-com:xml-data
    http://www.cs.aston.ac.uk/hillsm/project/eBIS-XML_Order_v3.01.xml">
    ....and this for the schema;
    <Schema name="eBIS-XML_Order_v3.01.xml"
    xmlns="urn:schemas-microsoft-com:xml-data"
    xmlns:dt="urn:schemas-microsoft-com:datatypes">
    Does anyone have any ideas??

    Steven,
    let me first note that I'm not familiar with the specific Schema you mention here (apparently from M$), and it would have been helpful to see at least part of it in your posting, because it seems abnormal that Microslob uses the conventional xsd namespace for schema declarations (although it wouldn't surprise me).
    Anyways, let's do a first version without the xsd name space.
    The declarations in your xml file are correct.
    In the schema file, the first error is, that schema is misspelled as Schema. Secondly, schema does not allow a name attribute (get rid of it). There is also no reference to the namespace "http://www.w3.org/2001/SMLSchema". So, the default namespace has to be changed to that. The targetNamespace attribute specifies that this schema applies to the specified name space. Putting it all together:
    <?xml version="1.0"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
                 targetNamespace="urn:schemas-microsoft-com:xml-data"
                 xmlns:dt="urn:schemas-microsoft-com:datatypes">
           <!-- let's have fun and declare an Order element that would work with just one
                  order element defined in the xml file. -->
           <element name="Order" type="string"/>
    </schema>So this would validate OK with this xml file (provided that ..../eBIS-XML_Order_v3.01.xml is the above schema file):
    <?xml version="1.0"?>
    <Order xmlns ="urn:schemas-microsoft-com:xml-data"
              xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="urn:schemas-microsoft-com:xml-data
              http://www.cs.aston.ac.uk/hillsm/project/eBIS-XML_Order_v3.01.xml">
    </Order>                     So, in this example, the default namespace in the schema is set to "http://www.w3.org/2001/XMLSchema" and the targetNamespace attribute points to the xml file's default name space.
    However, the standard way of doing things differs. You certainly should not (mis-)set the schema's default name space to "http://www.w3.org/2001/XMLSchema".
    I do not know in what way Microsoft limits you, but I strongly recommend something along these lines in order to not have regrets, headache and coffein and nicotine addiction lateron:
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns="urn:schemas-microsoft-com:xml-data"
                xmlns:dt="urn:schemas-microsoft-com:datatypes"
                targetNamespace="urn:schemas-microsoft-com:xml-data">
       <xsd:element name="Order" type="xsd:string"/>
    </xsd:schema>Also, in order to avoid confusion, Schema files should have the extension xsd - a minor sidepoint.
    Hope that helps,
    Leo.

  • Org.apache.crimson and 1.5

    I am trying to test an application in 1.5 and am getting compile errors for crimson references in classes someone else wrote.
    Looking at the JDK src, it looks like the apache packages are not bundeled in to the 1.5 beta.
    Wth the preface that I am mostly a Swing developer my questions are...
    I know it has to do with XML, but what specific functionality did crimson bring to the tale?
    Why did Sun remove the apache libs from the distribution?
    Is there anything in 1.5 to take crimsons place.
    Thanks for your time if you answer,
    Todd

    Looking at the JDK src, it looks like the apache
    packages are not bundeled in to the 1.5 beta.That's correct. The only contract is to supply an XML processor, not a specific one. Crimson is just one; Xerces is the most popular one out there. Looks like 1.5 includes a subset of Xerces (with a different package - com.sun.org.apache.xerces.internal).
    I know it has to do with XML, but what specific
    functionality did crimson bring to the tale?Nothing special. It was just a lightweight XML implementation.
    Why did Sun remove the apache libs from the distribution?
    Is there anything in 1.5 to take crimsons place.It's just replaced them with something they felt they could maintain better.
    You should not ever be referring to Crimson classes directly. You should ONLY use org.w3c.dom or org.w3c.sax classes directly, and use the advertised Factory APIs to create or manipulate Documents, Elements, etc.
    Your best bet is to rip out all references to org.apache.crimson, and use an elementary XML textbook to replace them with references to standard org.w3c.* classes.

  • Org.apache.crimson.tree.DomEx: INVALID_CHARACTER_ERR:

    I am using XML to create an element.
    It fails when I try to create with numbers.
    node = doc.createElement("111");
    why is that?

    So, you think it would be valid to have the following:
    <document>
      <1 1 1>some text</1 1 1>
    </document>That is what you are asking for. The String you specify in the createElement is the tagname. Tagnames cannot have spaces in them. I don't have a reference with me, but I don't think they can start with a numeric.
    How is "node" defined? Did you mean node = doc.createTextNode("1 1 1");
    That should work.
    Dave Patterson

  • Serious Bug: Crimson \ JSTL

    Hi, I have been experiencing problems whilst attempting to use the JSTL Standard Tag Library with the Apache Crimson XML Parser in the classpath. I have tried running the JSTL JSP page without Crimson in the classpath and it works fine. However when included in the classpath and I attempt to view the page I get the error below. According to this page:
    http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/GettingStarted.html
    the "Standard Taglib requires a JAXP 1.1 or 1.2 compliant parser". It goes on to list Crimson as an example of this. However the Crimson pages states that it supports "JAXP 1.1 minus the javax.xml.transform package."
    I would simply use another XML parser, except that I am using the Google API Jar which uses Crimson, thus I cannot remove it from the classpath if I wish to continue using the Google API.
    If anyone has any idea how I might solve this problem I'd be keen to hear them,
    Thanks very much,
    Ross Butler
    org.apache.jasper.JasperException: <h3>Validation error messages from TagLibraryValidator for c</h3>
    null: java.lang.IllegalStateException: can't declare any more prefixes in this context
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:72)
    org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1549)
    org.apache.jasper.compiler.Validator.validate(Validator.java:1495)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:157)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

    the "Standard Taglib requires a JAXP 1.1 or 1.2
    compliant parser". It goes on to list Crimson as an
    example of this. However the Crimson pages states
    that it supports "JAXP 1.1 minus the
    javax.xml.transform package." So what? An XML parser just parses an XML document into some internal representation of the XML. It doesn't do transformations. So what you say there doesn't appear to be relevant to me. It is an example of that.
    I would simply use another XML parser, except that I
    am using the Google API Jar which uses Crimson, thus
    I cannot remove it from the classpath if I wish to
    continue using the Google API.Why not? Does the Google API (I'm not familiar with it) say it MUST use Crimson? I think it's likely that it's distributed with Crimson for the convenience of users who don't have any XML parser (Java 1.3 and earlier users). So if it comes with a separate crimson.jar (or whatever) then just toss that out and see what happens. I didn't notice that being one of the tests you did.
    And if you find that Google API doesn't work with the built-in parser in your JRE, it's possible to specify the parser your environment should use by setting the system property javax.xml.parsers.SAXParserFactory to the full name of Crimson's SAX parser factory and likewise the system property javax.xml.parsers.DocumentBuilderFactory. (You can't do this just for your web application, though, you want your entire web application server to use the same parser or strange things may happen. Like the strange things you are seeing.)

  • JSTL & JAXP Incompatibility Issue

    Hi, I have been experiencing problems whilst attempting to use the JSTL Standard Tag Library with the Apache Crimson XML Parser in the classpath. I have tried running the JSTL JSP page without Crimson in the classpath and it works fine. However when included in the classpath and I attempt to view the page I get the error below. According to this page:
    http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/GettingStarted.html
    the "Standard Taglib requires a JAXP 1.1 or 1.2 compliant parser". It goes on to list Crimson as an example of this. However the Crimson pages states that it supports "JAXP 1.1 minus the javax.xml.transform package."
    I would simply use another XML parser, except that I am using the Google API Jar which uses Crimson, thus I cannot remove it from the classpath if I wish to continue using the Google API.
    If anyone has any idea how I might solve this problem I'd be keen to hear them,
    Thanks very much,
    Ross Butler
    org.apache.jasper.JasperException: <h3>Validation error messages from TagLibraryValidator for c</h3><p>null: java.lang.IllegalStateException: can't declare any more prefixes in this context</p>
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:72)
         org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1549)
         org.apache.jasper.compiler.Validator.validate(Validator.java:1495)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:157)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

    yes, you made a mistake somewhere. There is only one person who can figure out what: you. I suggest a good debugger like the one built into Eclipse to try and figure out where your mistake is.
    I know, it is frustrating when something doesn't work the way you expect it to do. It is part of the programming job to suck it up and figure out where you did something wrong. That can take some time, effort and lots of coffee.

  • How to use a parser with crimson XmlDocumentBuilder

    Hi,
    I'd be very grateful for any help on the following...
    I used to use the following code to parse an Xml document, using a SimpleElementFactory to create my own class Element nodes...
    XmlDocumentBuilder builder = new XmlDocumentBuilder();
    parser = new com.sun.xml.tree.ValidatingParser();
    parser.setDocumentHandler( builder );
    parser.parse( in );
    Docuent doc = buider.getDocument();
    This worked fine using the project X code. However after migrating to the crimson code I can't find a way to link my XmlDocumentBuilder with the parser.
    com.apache.crimson.parser.ValidatingParser seems to have no methods to link it to a com.apache.crimson.tree.XmlDocumentBuilder. If I follow a similar pattern to before the getDocument call returns null as the parser is not linked to the builder.
    Please could someone point out my obvious mistake!
    Many thanks

    Hello,
    I am using Crimson parser to parse an XML Document containing Czech characters. When I write the stuff read from the file, the output seems to be a corrupted one. It will be highly appreciable if someone can come up with any idea on where things might have gone wrong?
    The foll is the piece of code that reads and writes the XML.
    Writer xout = null;
    String inputXML     =     "content-chzech.xml";
    javax.xml.parsers.DocumentBuilderFactory xDbf     =     javax.xml.parsers.DocumentBuilderFactory.newInstance();
    javax.xml.parsers.DocumentBuilder     xDb     =     xDbf.newDocumentBuilder();
    Document xD                          =     xDb.newDocument();
    File xmlFile                          =      new File(inputXML);
    xD                              =      xDb.parse(xmlFile);
    XmlDocument xdoc                     = (XmlDocument) xD;
    xdoc.normalize();
    Writer writer = new BufferedWriter( new FileWriter( "parsedOutput.xml") );
    xdoc.write( writer);
    writer.close();

  • Weird! I thought crimson.jar/jaxp.jar were included in rt.jar for jsk 1.4!!

    I am trying a Wrox Books Example (Chapter 2 in Professional Java XML), and if I do this:
      java BookMain
    I get this error:
      Exception in thread "main" java.lang.NullPointerException
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:524)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
        at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:346)
        at wrox.book.BookMain.main(BookMain.java:34)
    But if I do this:
      java -Xbootclasspath:D:\jaxp\jaxp-1.1\crimson.jar;D:\jaxp\jaxp-1.1\jaxp.jar;D:\jdk1.4\jre\lib\rt.jar BookMain
    Then it works!!!
    What's up with that? Is there a later version of crimson in jaxp1.1 than jdk1.4? Is there a known bug?

    I found the same NullPointerException at the same place for the BookMain exercise. The solution (which took a while for me to determine) was to add a missing line in BookMain:
    factory.setNameSpaceAware(true);
    After that the code ran fine.
    I'm surprised that the parsers die in such a case (rather than raising an exception saying they don't understand the namespace-related XML).

  • Crimson Driver setting...

    hi all
    i am using version 1.4 and i have set the "org.xml.sax.driver", system property to "org.apache.crimson.parser.XMLReaderImpl"
    the program compiles,but i am not able to run the program...am getting the following error...
    java.lang.ClassNotFoundException: org.apache.crimson.parser.XMLReaderImpl
         at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
         at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
         at MySAXApp.main(MySAXApp.java:24)
    Exception in thread "main"
    can someone help me?
    thanks in advance...

    Try not setting that system property.

  • Crimson and DTDs

    Hi!
    I'm having problems with Crimson in combination with documents validated using an external DTD. I'm usinf JAXP 1.1. Basically I get an exception:
    Exception in thread "main" java.lang.NoSuchMethodError
         at org.apache.crimson.tree.XmlDocumentBuilder.startDTD(XmlDocumentBuilder.java:648)
         at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1118)
         at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:488)
         at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
         at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
         at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:179)
         at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:161)
    I'm using the following bit of code:
    DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
    builder = fac.newDocumentBuilder();
    doc = builder.parse(new File(filename));
    Is that a Crimson error or am I doing something wrong? Maybe I have messed up different versions of DOM, JAXP, ... libraries?!
    I'm doing that to compare different implementations, and it works fine with Xerces and my own one. I thought it is strange that exactly the JAXP default parser would fail on this task.
    Any thoughts?
    Mathias

    I had a problem like yours. Apparently, the "parse" method have a little problem with a "file" object as a parameter try this, it worked with me :
    File fl = new File(strFileName);
    doc = builder.parse(new FileInputStream(fl));
    San_A

  • Exception from crimson in Tomcat

    Hi,
    I am facing a very strange senario while using Tomcat3.2.4. When I ran a WebApp under the Tomcat, I got an exception, please see below:
    With the following stack trace: java.lang.NullPointerException at org.apache.crimson.tree.TextNode.cloneNode(TextNode.java:222) at org.apache.crimson.tree.ElementNode2.createCopyForImportNode(ElementNode2.java:167) at org.apache.crimson.tree.ElementNode2.createCopyForImportNode(ElementNode2.java:164) at org.apache.crimson.tree.XmlDocument.importNode(XmlDocument.java:1260) at idea.xmldocument.flatfile.XMLDataCache._$31523(XMLDataCache.java:492) at ...
    The strange thing is that I don't have any org.apache.crimson package in classpath, even in my whole computer.
    1. Before I started tomcat my classpath is empty.
    2. I only have "ant.jar", "jasper.jar", "servlet.jar", "webserver.jar" in the lib folder of my Tomcat.
    3. I only have xalan_2.0.1.jar and xerces_1.3.0.jar in the WEB-INF/lib folder of my web app.
    And the interesting thing is that when I moved xalan_2.0.1.jar and xerces_1.3.0 from WEB-INF/lib folder of my web app to lib folder of tomcat, the exception is not present any more.
    It is so weird.
    Does anyone have some idea? I would very appriecate.
    Thanks in adavance!
    Louis
    2002/10/17

    if you use JDK 1.4, then you have Crimson embedded into it as the default parser of JAXP.
    apparently you want to use Xerces instead of Crimson, so maybe you are creating nodes with JAXP/Crimson then try to use them with Xerces (or the contrary)...

Maybe you are looking for

  • Azure Site Recovery for HA workloads?

    Can Azure Site recovery be used for HA workloads? To my understanding Azure Site Recovery leverages Hyper-V Replica. What if my on-premises clouds are hosting HA SQL AlwaysOn cluster workloads? Thanks!

  • How to make TRIM in 10.6.8 work for Aug 2009 macbook pro with 120 GB SSD?

    Just installed 10.6.8 on a August 2009 Macbook Pro with 120 GB SSD (which is Apple installed memory), and TRIM is not enabled.  When I installed 10.6.8 on an August 2010 Macbook Pro with 500 GB SSD (Apple installed), the TRIM became enabled without m

  • Dreamweaver 8 and Windows 7

    I got a grant and am studying Dreamweaver 8 at college, without realising it was so ancient!  I have a new Dell with Windows 7 at home and have read about  problems with using Dreamweaver 8. I want to get Dreamweaver to use at home, if I get a later

  • Can you lighten videos in Quicktime?

    I have some videos that, on my camera look fine, but when uploaded to the computer, are very dark. Is there any way I can lighten them up using Quicktime Pro?

  • Cisco IPS Manager 7.0.2

    Hi, I installed Cisco IPS Manager and it can see the AIP-SSM ips. But I do not see any real time logs and cannot create any report. What can cause this problem ? Thanks