Subjects
Home
Xalan extension functions
Fomatting question serializing DOM with pretty print
xalan with pull parser
Cannot find the declaration
Apache Xalan drop support to run on JRE 1 1 x
Why does Doctype change processing of a document
Node set to XML string via Java extensions in Xalan J: possible?
Templates/Transformers + thread safety???
Problem evaluating xpath with muliple prefix with different namespace
remove an arbitrary attribute from xsl output
Xalan3 XSLT 2 0 XPath 2 0 support?
Problem using compiled translets with Xalan !!
Xalan and jstl 1 1 problem with transform tag
NullPointer in DOM2DTM getLocalName
URIResolvers base parameter with xsltc and cascaded imports
Performance problem for Xalan J on intel dual core
Standard libraries in JAXP?
Serializing a DOM tree to XML file, customize entities replacement
Library Conflict Involving BCEL Library
A question on how users are using <xsl:message >
Kevin Cormier as a new Apache Xalan J committer
Struggling to iterate over tokenized string
Xalan count() trouble
Problem with recursive xpath
Error when switching to java 1 5
document( ' ')
Problem with Xalan2 7 0 transformation
cr/lf options
entity encoded XML
can xalan transform 2 xml using one xslt?
Xalan J JIRA defect review Monday October 16, 2006 from 2:00 to 3:30 pm ED
xsl transform with cdata section elements
xslt parameters not expanded
Weird behavior of XPath evaluate()
How to avoid <xsl:message > instruction prints stylesheet file informations ?
Cannot find SimpleTransform subdirectory after installing Xalan J
recover from document not found exceptions
jdk1 5 and Xalan jar differences?
Performance Issue
Error/Bug adding floating point numbers
XPathAPI: eval exp using nodes with default namespace
modifying xalan to output invalid XML
NullPointerException
mege two separate xml nodes into one
Is this a XALAN document identification bug?
is StylesheetRoot really java io Serializable ?
transform() fails for DOMSource but succeeds for StreamSource
Thoughts on Transformer parameter passing
HELP, Xalan and jstl 1 1 problem with transformer
Problem with XPath namespace axis?
string utils:replace deleting search string if replacement string is an HTML
help with enumeration values pls
xalan 2 5 1 vs 2 7 performance question
How to insert/update in XML document
HTML Serialization and Handling of Ampersands in HREF Attributes
XHTML link tag stripping
SystemId Unknown; Line #24; Column #49; java lang NullPointerException
xpath text() help
Apostrophe problem with xalan 2 7 0
How to set variables in XML document?
Links
Home
Oracle database error code ...
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
RE: (BUG?) org.apache.xpath.compiler.XPathParser.initXPath() goin
   g in to infi

RE: (BUG?) org.apache.xpath.compiler.XPathParser.initXPath() goin
   g in to infi

2003-03-13       - By Tim Cronin

this comment was right above the code...

// Patch for Christine's gripe. She wants her errorHandler to return from
// a fatal error and continue trying to parse, rather than throwing an
exception.
// Without the patch, that put us into an endless loop.
//
// %REVIEW% Is there a better way of doing this?
// %REVIEW% Are there any other cases which need the safety net?
//  (and if so do we care right now, or should we rewrite the XPath
// grammar engine and can fix it at that time?)

with
org.apache.xalan.xsltc.trax.TransformerFactoryImpl
you catch all the errors but it still throws the exception.

-----Original Message-----
From: Tim Cronin [mailto:tim@(protected)]
Sent: Thursday, March 13, 2003 12:13 PM
To: xalan-j-users@(protected)
Subject: (BUG?) org.apache.xpath.compiler.XPathParser.initXPath() going in
to infinite loop


I'm running a transformation against an xsl stylesheet

I've

I get Stack overflow exception and it spins through the following
org.apache.xpath.compiler.XPathParser.initXPath(XPathParser.java:191)

I believe this section of code is the culprit (note the comment...)

   catch (org.apache.xpath.XPathProcessorException e)
   {
  if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
  {
 // What I _want_ to do is null out this XPath.
 // I doubt this has the desired effect, but I'm not sure what else to do.
 // %REVIEW%!!!
 initXPath(compiler, "/..",  namespaceContext);
  }
  else
 throw e;
   }

heres the stylesheet (it's invalid I'm trying to catch the errors

<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform <http://www.w3.org/1999/XSL/Transform>
">
 <xsl:template match="/">
   <div>
     <xsl:value-of select="/Properties/Group[@(protected)=Table
Heading']/Datum[@(protected)='Title']"/>
hello world...
   </div>
 </xsl:template>
</xsl:stylesheet>


here's my calling code (ValidationHandler implements
javax.xml.transform.ErrorListener)

 public static ValidationHandler validate(String xsl)
 {
   ValidationHandler vh = new ValidationHandler();

   try
   {
     // NOTE: strong tie to
org.apache.xalan.processor.TransformerFactoryImpl
     // if xsl processors change then Need to force this to be able to set
line number attribs...
     TransformerFactory tf = (TransformerFactory) new
org.apache.xalan.processor.TransformerFactoryImpl();


tf.setAttribute(org.apache.xalan.processor.TransformerFactoryImpl.FEATURE_SO
URCE_LOCATION, Boolean.TRUE);
     tf.setErrorListener(vh);
     tf.setURIResolver(new Resolver());

     XMLReader xr = XMLReaderFactory.createXMLReader();
     xr.setEntityResolver(new Resolver());

     Transformer transformer = tf.newTransformer(new SAXSource(xr, new
InputSource(new StringReader(xsl))));
   }
   catch (SAXException e)
   {
     DOMException de = new DOMException(DOMException.SYNTAX_ERR,
         "cannot validate Stylesheet");
     de.initCause(e);
     throw de;
   }
   catch (TransformerException e)
   {
     vh.error(e);
   }
   return vh;
 }



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>RE: small program on converting html/xhtml to xsl:fo needed</TITLE>

<META content="MSHTML 6.00.2800.1141" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=767182218-13032003>this
comment was right above the code...</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=767182218-13032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=767182218-13032003>&nbsp;// Patch for Christine's gripe. She wants her
errorHandler to return from<BR>&nbsp;// a fatal error and continue trying to
parse, rather than throwing an exception.<BR>&nbsp;// Without the patch, that
put us into an endless loop.<BR>&nbsp;//<BR>&nbsp;// %REVIEW% Is there a better
way of doing this?<BR>&nbsp;// %REVIEW% Are there any other cases which need
the
safety net?<BR>&nbsp;// &nbsp;(and if so do we care right now, or should we
rewrite the XPath<BR>&nbsp;//&nbsp;grammar engine and can fix it at that
time?)<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=767182218-13032003>with</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=767182218-13032003>org.apache.xalan.xsltc.trax.TransformerFactoryImpl<
/SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=767182218-13032003>you
catch all the errors but it still throws the exception.</SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
 <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
 size=2>-----Original Message-----<BR><B>From:</B> Tim Cronin
 [mailto:tim@(protected)]<BR><B>Sent:</B> Thursday, March 13, 2003 12:13
 PM<BR><B>To:</B> xalan-j-users@(protected)<BR><B>Subject:</B> (BUG?)
 org.apache.xpath.compiler.XPathParser.initXPath() going in to infinite
 loop<BR><BR></FONT></DIV>
 <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=657010818-13032003>I'm
 running a transformation against an xsl stylesheet</SPAN></FONT></DIV>
 <DIV><FONT face=Arial color=#0000ff size=2><SPAN
 class=657010818-13032003></SPAN></FONT>&nbsp;</DIV>
 <DIV><FONT face=Arial color=#0000ff size=2><SPAN
 class=657010818-13032003>I've</SPAN></FONT></DIV>
 <DIV><FONT face=Arial color=#0000ff size=2><SPAN
 class=657010818-13032003></SPAN></FONT>&nbsp;</DIV>
 <DIV><FONT face=Arial color=#0000ff size=2><SPAN
 class=657010818-13032003>I</SPAN></FONT><FONT face=Arial color=#0000ff
 size=2><SPAN class=657010818-13032003>&nbsp;get Stack overflow exception and
 it spins through the following</SPAN></FONT></DIV>
 <DIV><FONT face=Arial color=#0000ff
 size=2>org.apache.xpath.compiler.XPathParser.initXPath(XPathParser.java:191)<
/FONT></DIV>
 <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff size=2>I
 believe this&nbsp;section&nbsp;of code is the culprit (note the
 comment...)</FONT></SPAN></DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2></FONT></SPAN>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2>&nbsp;&nbsp;&nbsp; catch (org.apache.xpath.XPathProcessorException
 e)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;
 if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))<BR>&nbsp;&nbsp;
 {<BR>&nbsp;&nbsp;// What I _want_ to do is null out this
 XPath.<BR>&nbsp;&nbsp;// I doubt this has the desired effect, but I'm not
sure
 what else to do.<BR>&nbsp;&nbsp;//
 %REVIEW%!!!<BR>&nbsp;&nbsp;initXPath(compiler, "/..",&nbsp;
 namespaceContext);<BR>&nbsp;&nbsp; }<BR>&nbsp;&nbsp; else<BR>&nbsp;&nbsp
;throw
 e;<BR>&nbsp;&nbsp;&nbsp; }</FONT></SPAN></DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2></FONT></SPAN>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2>heres the stylesheet (it's invalid I'm trying to catch the
 errors</FONT></SPAN></DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2></FONT></SPAN>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2>&lt;xsl:stylesheet version="1.0" xmlns:xsl="<A
 href="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL
/Transform</A>"&gt;<BR>&nbsp;
 &lt;xsl:template match="/"&gt;<BR>&nbsp;&nbsp;&nbsp;
 &lt;div&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsl:value-of
 select="/Properties/Group[@(protected)=Table
 Heading']/Datum[@(protected)='Title']"/&gt;<BR>hello world...<BR>&nbsp;&nbsp;&nbsp;
 &lt;/div&gt;<BR>&nbsp;
 &lt;/xsl:template&gt;<BR>&lt;/xsl:stylesheet&gt;</FONT></SPAN></DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2></FONT></SPAN>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2></FONT></SPAN>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2>here's my calling code (ValidationHandler implements
 javax.xml.transform.ErrorListener)</FONT></SPAN></DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2></FONT></SPAN>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2>&nbsp; public static ValidationHandler validate(String xsl)<BR>&nbsp;
 {<BR>&nbsp;&nbsp;&nbsp; ValidationHandler vh = new
 ValidationHandler();</FONT></SPAN></DIV>
 <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2>&nbsp;&nbsp;&nbsp; try<BR>&nbsp;&nbsp;&nbsp;
 {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // NOTE: strong tie to
 org.apache.xalan.processor.TransformerFactoryImpl<BR>&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;
 // if xsl processors change then Need to force this to be able to set line
 number attribs...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TransformerFactory tf =
 (TransformerFactory) new
 org.apache.xalan.processor.TransformerFactoryImpl();</FONT></SPAN></DIV>
 <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 tf.setAttribute(org.apache.xalan.processor.TransformerFactoryImpl.FEATURE
_SOURCE_LOCATION,
 Boolean.TRUE);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 tf.setErrorListener(vh);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 tf.setURIResolver(new Resolver());</FONT></SPAN></DIV>
 <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XMLReader xr =
 XMLReaderFactory.createXMLReader();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 xr.setEntityResolver(new Resolver());</FONT></SPAN></DIV>
 <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
 <DIV><SPAN class=657010818-13032003><FONT face=Arial color=#0000ff
 size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transformer transformer =
 tf.newTransformer(new SAXSource(xr, new InputSource(new
 StringReader(xsl))));<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; catch
 (SAXException e)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 DOMException de = new
 DOMException(DOMException.SYNTAX_ERR,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
 "cannot validate Stylesheet");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 de.initCause(e);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw
 de;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; catch (TransformerException
 e)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 vh.error(e);<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; return
 vh;<BR>&nbsp; }<BR></FONT></SPAN></DIV></BLOCKQUOTE></BODY></HTML>