Skip to content

Commit

Permalink
Reconcile/rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
kubycsolutions committed Nov 27, 2023
1 parent c338e2b commit 4aa150b
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public TransformThread(int thrdNum)
StreamSource xslSource = new StreamSource(xslSourceFileName);
xslSource.setSystemId(xslSourceURI);

// Initialize the tranformer
// Initialize the transformer
m_transformer =
TransformerFactory.newInstance().newTransformer(xslSource);
m_thread = new Thread(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void validate()
}
catch (TransformerException te)
{
// The TransformerException wraps someting other than a SAXParseException
// The TransformerException wraps something other than a SAXParseException
// warning or error, either of which should be "caught" by the Handler.
System.out.println("Not a SAXParseException warning or error: " + te.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,64 +44,65 @@
*/
public class ExternalConnection
{
public static void main(String[] args)
public static void main(String[] args)
throws TransformerException, TransformerConfigurationException,
FileNotFoundException, IOException
FileNotFoundException, IOException
{

// Create a connection to the database server
// Up the connection pool count for testing
DefaultConnectionPool cp = new DefaultConnectionPool();
cp.setDriver("org.apache.derby.jdbc.EmbeddedDriver");
cp.setURL("jdbc:derby:sampleDB");
//cp.setUser("sa");
//cp.setPassword("");
cp.setMinConnections(10);
cp.setPoolEnabled(true);

// Now let's register our connection pool so we can use
// in a stylesheet
ConnectionPoolManager pm = new ConnectionPoolManager();
pm.registerPool("extpool", cp);


// Use the static TransformerFactory.newInstance() method to instantiate
// a TransformerFactory. The javax.xml.transform.TransformerFactory
// system property setting determines the actual class to instantiate --
// org.apache.xalan.transformer.TransformerImpl.
TransformerFactory tFactory = TransformerFactory.newInstance();

// Grab the Name of the Stylesheet from the commad line
if (args.length == 0)
{
System.out.println("You must provide the path and name to a stylesheet to process");
System.exit(0);
}

String stylesheet = args[0];
System.out.println("Transforming Stylesheet " + stylesheet);

// Use the TransformerFactory to instantiate a Transformer that will work with
// the stylesheet you specify. This method call also processes the stylesheet
// into a compiled Templates object.
Transformer transformer = tFactory.newTransformer(
new StreamSource(stylesheet));

// For this transformation, all the required information is in the stylesheet, so generate
// a minimal XML source document for the input.
// Note: the command-line processor (org.apache.xalan.xslt.Process) uses this strategy when
// the user does not provide an -IN parameter.
StringReader reader =
new StringReader("<?xml version=\"1.0\"?> <doc/>");

// Use the Transformer to apply the associated Templates object to an XML document
// and write the output to a file.
transformer.transform(
new StreamSource(reader),
new StreamResult(new FileOutputStream("dbtest-out.html")));

System.out.println("************* The result is in dbtest-out.html *************");

cp.setPoolEnabled(false);

// Create a connection to the database server
// Up the connection pool count for testing
DefaultConnectionPool cp = new DefaultConnectionPool();
cp.setDriver("org.apache.derby.jdbc.EmbeddedDriver");
cp.setURL("jdbc:derby:sampleDB");
//cp.setUser("sa");
//cp.setPassword("");
cp.setMinConnections(10);
cp.setPoolEnabled(true);

// Now let's register our connection pool so we can use
// in a stylesheet
ConnectionPoolManager pm = new ConnectionPoolManager();
pm.registerPool("extpool", cp);


// Use the static TransformerFactory.newInstance() method to instantiate
// a TransformerFactory. The javax.xml.transform.TransformerFactory
// system property setting determines the actual class to instantiate --
// org.apache.xalan.transformer.TransformerImpl.
TransformerFactory tFactory = TransformerFactory.newInstance();

// Grab the Name of the Stylesheet from the command line
if (args.length == 0)
{
System.out.println("You must provide the path and name to a stylesheet to process");
System.exit(0);
}

String stylesheet = args[0];
System.out.println("Transforming Stylesheet " + stylesheet);

// Use the TransformerFactory to instantiate a Transformer that will work with
// the stylesheet you specify. This method call also processes the stylesheet
// into a compiled Templates object.
Transformer transformer = tFactory.newTransformer(
new StreamSource(stylesheet));

// For this transformation, all the required information is in the
// stylesheet, so generate a minimal XML source document for the
// input. Note: the command-line processor
// (org.apache.xalan.xslt.Process) uses this strategy when the user
// does not provide an -IN parameter.
StringReader reader =
new StringReader("<?xml version=\"1.0\"?> <doc/>");

// Use the Transformer to apply the associated Templates object to
// an XML document and write the output to a file.
transformer.transform(
new StreamSource(reader),
new StreamResult(new FileOutputStream("dbtest-out.html")));

System.out.println("************* The result is in dbtest-out.html *************");

cp.setPoolEnabled(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fi
#argument when running under JDK 1.4 this should also work for JDK 1.5

#The XML Apis are going to be either in the LIB dir for a source
#release or in the root direcctory for a binary release.
#release or in the root directory for a binary release.


if [ -f ../../../build/xalan.jar ] ; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fi
#argument when running under JDK 1.4 this should also work for JDK 1.5

#The XML Apis are going to be either in the LIB dir for a source
#release or in the root direcctory for a binary release.
#release or in the root directory for a binary release.


if [ -f ../../../build/xalan.jar ] ; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
}
e = e.parentElement;
// call the correct funtion to change the collapse/expand state and display
// call the correct function to change the collapse/expand state and display
if (e.className == "e")
ch(e);
if (e.className == "k")
Expand Down Expand Up @@ -291,4 +291,4 @@
</DIV></DIV>
</xsl:template>

</xsl:stylesheet>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This JSP uses PMA to set param1 in the
* foo.xsl stylesheet before using the
* stylesheet to transform foo.xml
* and outputing the result.
* and outputting the result.
*
* Invoke the jsp from the appropriate
* context for your servlet/jsp server.
Expand Down
6 changes: 3 additions & 3 deletions stylebook/sources/xalan/history.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3286,7 +3286,7 @@ are unlikely to be equal. Saving them in a plain Vector has a
lower cost than saving them in DTMStringPool. Only prefixed QNames
are saved in DTMStringPool after this change.

Need to make changes in a few interfaces to accommadate this change.
Need to make changes in a few interfaces to accommodate this change.
<br/><br/></li><li><ref>Committed by </ref>mkwan@apache.org<ref> on </ref>2003/03/13<br/><ref>Modified: </ref> xml-xalan/java/src/org/apache/xml/utils FastStringBuffer.java<br/><ref>Committer's log entry: </ref>
XSLTC_DTM performance work
Small improvement in FastStringBuffer.sendSAXCharacters() when the whole
Expand Down Expand Up @@ -4798,7 +4798,7 @@ alternatives.<br/><br/></li><li><ref>Committed by </ref>jkesselm@apache.org<ref>
transforms so that when the transformer is reused, we were using nodesets from
the previous transform which were using a different DTM. Note that we want keep
any variables that have been set externally by the user (using
Transformer.setParameter()).<br/><br/></li><li><ref>Committed by </ref>mmidy@apache.org<ref> on </ref>01/28/2002<br/><ref>Modified: </ref>java/src/org/apache/xpath/res XPATHErrorResources.java<br/><ref>Committer's log entry: </ref>bug 4762: Fixed the duplicate error message in XPATH.<br/><br/></li><li><ref>Committed by </ref>jkesselm@apache.org<ref> on </ref>01/28/2002<br/><ref>Modified: </ref>java/src/org/apache/xalan/transformer TransformerImpl.java<br/><ref>Committer's log entry: </ref>Bugzilla 4054: Retain previously set output properties when adding new ones.<br/><br/></li><li><ref>Committed by </ref>mmidy@apache.org<ref> on </ref>01/28/2002<br/><ref>Modified: </ref>java/src/org/apache/xalan/transformer TransformerImpl.java<br/><ref>Committer's log entry: </ref>Bug 5872. We were using a constructor of TranformerException without the
Transformer.setParameter()).<br/><br/></li><li><ref>Committed by </ref>mmidy@apache.org<ref> on </ref>01/28/2002<br/><ref>Modified: </ref>java/src/org/apache/xpath/res XPATHErrorResources.java<br/><ref>Committer's log entry: </ref>bug 4762: Fixed the duplicate error message in XPATH.<br/><br/></li><li><ref>Committed by </ref>jkesselm@apache.org<ref> on </ref>01/28/2002<br/><ref>Modified: </ref>java/src/org/apache/xalan/transformer TransformerImpl.java<br/><ref>Committer's log entry: </ref>Bugzilla 4054: Retain previously set output properties when adding new ones.<br/><br/></li><li><ref>Committed by </ref>mmidy@apache.org<ref> on </ref>01/28/2002<br/><ref>Modified: </ref>java/src/org/apache/xalan/transformer TransformerImpl.java<br/><ref>Committer's log entry: </ref>Bug 5872. We were using a constructor of TransformerException without the
locator information. Changed to code to use a locator if info is available.<br/><br/></li><li><ref>Committed by </ref>dleslie@apache.org<ref> on </ref>01/30/2002<br/><ref>Modified: </ref>java/src/org/apache/xalan/lib NodeInfo.java<br/><ref>Committer's log entry: </ref>Changed "system id" to "public identifier" in javadoc
comments for publicId() methods.<br/><br/></li><li><ref>Committed by </ref>jkesselm@apache.org<ref> on </ref>01/30/2002<br/><ref>Modified: </ref>java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM.java<br/><ref>Committer's log entry: </ref>Bugzilla 2617, part 1: Construct the data structures and access them
correctly.
Expand Down Expand Up @@ -6512,7 +6512,7 @@ Frame slot was available. Unfortunately, this also indicated that the item was
passed as a parameter which it wasn't. This fix changes isParamVar into to
fields, isAvailable which indicates that the slot is available and
isFromWithParam indicating the Frame slot came from an xsl:with-param or a
top-level parameter passed in via the tranformerImpl.setParameter() API.
top-level parameter passed in via the transformerImpl.setParameter() API.
I have tested this change against the conformance suite and had no
regression. I've also submitted a test case which fails on the existing
codebase but works okay after this fix.
Expand Down
2 changes: 1 addition & 1 deletion stylebook/sources/xalan/xsltc_usage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ parser</link>.</p>
<li>Perform the transformation, using a StreamSource object for the XML
input and a StreamResult object to hold the transformation output.</li>
</ol>
<p>Both a <code>Templates</code> object and a <code>Tranformer</code> object are
<p>Both a <code>Templates</code> object and a <code>Transformer</code> object are
processed representations of a stylesheet, but you cannot use a
<code>Templates</code> object to perform transformations. Instead,
you can use a <code>Templates</code> object to create new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ElemExsltFuncResult extends ElemVariable
static final long serialVersionUID = -3478311949388304563L;
/*
* To keep the binary compatibility put those three private global
* variables back, although they are never used in this verison
* variables back, although they are never used in this version
*/
// A flag indicating whether the return result is set
private boolean m_isResultSet = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public class TransformerImpl extends Transformer
*/
private boolean m_isTransformDone = false;

/** Flag to to tell if the tranformer needs to be reset. */
/** Flag to tell if the transformer needs to be reset. */
private boolean m_hasBeenReset = false;

/** NEEDSDOC Field m_shouldReset */
Expand Down Expand Up @@ -2262,7 +2262,7 @@ public boolean applyTemplateToNode(ElemTemplateElement xslInstruction, // xsl:a
// since much (most? all?) of the processing has been inlined.
// (It would be nice if there was a single entry point that
// worked for both... but the interpretive system works by
// having the Tranformer execute the children, while the
// having the Transformer execute the children, while the
// compiled obviously has to run its own code. It's
// also unclear that "execute" is really the right name for
// that entry point.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private static String getLocalName(Node node) {
}

public void parse(InputSource unused) throws IOException, SAXException {
parse(_dom);
parse();
}

public void parse() throws IOException, SAXException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public TemplatesImpl() { }

/**
* Overrides the default readObject implementation since we decided
* it would be cleaner not to serialize the entire tranformer
* it would be cleaner not to serialize the entire transformer
* factory. [ ref bugzilla 12317 ]
* We need to check if the user defined class for URIResolver also
* implemented Serializable
Expand Down Expand Up @@ -407,4 +407,4 @@ public DOM getStylesheetDOM() {
public void setStylesheetDOM(DOM sdom) {
_sdom.set(sdom);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,20 @@ public synchronized XMLReader getXMLReader() throws SAXException {

/**
* Mark the cached XMLReader as available. If the reader was not
* actually in the cache, do nothing.
* for this thread, mark it as no longer being in use.
*
* @param reader The XMLReader that's being released.
*/
public synchronized void releaseXMLReader(XMLReader reader) {
if(reader == null) {
return;
}
// If the reader that's being released is the cached reader
// for this thread, remove it from the m_isUse list.
if (m_readers.get() == reader && reader != null) {
m_inUse.remove(reader);
m_readers.set(null)
m_inUse.put(reader, Boolean.FALSE);
}
m.inUse.remove(reader);
}
}

0 comments on commit 4aa150b

Please sign in to comment.