Skip to content

Commit 287cea7

Browse files
Trying to give Vlad proper credit for stuff I cherry-picked across and
apparently lost attribution on. This commit may result in crediting him for some work I did. I honestly don't care.
1 parent b674b75 commit 287cea7

File tree

5 files changed

+63
-9
lines changed

5 files changed

+63
-9
lines changed

samples/src/main/java/org/apache/xalan/samples/extensions/sql/extConnection/ExternalConnection.java

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
*/
4545
public class ExternalConnection
4646
{
47-
public static void main(String[] args)
47+
public static void main(String[] args)
4848
throws TransformerException, TransformerConfigurationException,
49-
FileNotFoundException, IOException
49+
FileNotFoundException, IOException
5050
{
5151

5252
// Create a connection to the database server
@@ -100,8 +100,62 @@ public static void main(String[] args)
100100
new StreamSource(reader),
101101
new StreamResult(new FileOutputStream("dbtest-out.html")));
102102

103-
System.out.println("************* The result is in dbtest-out.html *************");
104-
105-
cp.setPoolEnabled(false);
103+
System.out.println("************* The result is in dbtest-out.html *****
104+
// Create a connection to the database server
105+
// Up the connection pool count for testing
106+
DefaultConnectionPool cp = new DefaultConnectionPool();
107+
cp.setDriver("org.apache.derby.jdbc.EmbeddedDriver");
108+
cp.setURL("jdbc:derby:sampleDB");
109+
//cp.setUser("sa");
110+
//cp.setPassword("");
111+
cp.setMinConnections(10);
112+
cp.setPoolEnabled(true);
113+
114+
// Now let's register our connection pool so we can use
115+
// in a stylesheet
116+
ConnectionPoolManager pm = new ConnectionPoolManager();
117+
pm.registerPool("extpool", cp);
118+
119+
120+
// Use the static TransformerFactory.newInstance() method to instantiate
121+
// a TransformerFactory. The javax.xml.transform.TransformerFactory
122+
// system property setting determines the actual class to instantiate --
123+
// org.apache.xalan.transformer.TransformerImpl.
124+
TransformerFactory tFactory = TransformerFactory.newInstance();
125+
126+
// Grab the Name of the Stylesheet from the command line
127+
if (args.length == 0)
128+
{
129+
System.out.println("You must provide the path and name to a stylesheet to process");
130+
System.exit(0);
131+
}
132+
133+
String stylesheet = args[0];
134+
System.out.println("Transforming Stylesheet " + stylesheet);
135+
136+
// Use the TransformerFactory to instantiate a Transformer that will work with
137+
// the stylesheet you specify. This method call also processes the stylesheet
138+
// into a compiled Templates object.
139+
Transformer transformer = tFactory.newTransformer(
140+
new StreamSource(stylesheet));
141+
142+
// For this transformation, all the required information is in the
143+
// stylesheet, so generate a minimal XML source document for the
144+
// input. Note: the command-line processor
145+
// (org.apache.xalan.xslt.Process) uses this strategy when the user
146+
// does not provide an -IN parameter.
147+
StringReader reader =
148+
new StringReader("<?xml version=\"1.0\"?> <doc/>");
149+
150+
// Use the Transformer to apply the associated Templates object to
151+
// an XML document and write the output to a file.
152+
transformer.transform(
153+
new StreamSource(reader),
154+
new StreamResult(new FileOutputStream("dbtest-out.html")));
155+
156+
System.out.println("************* The result is in dbtest-out.html *************");
157+
158+
cp.setPoolEnabled(false);
159+
>>>>>>> 4aa150b2e (Reconcile/rebase)
106160
}
107161
}

samples/src/main/java/org/apache/xalan/samples/servlet/default.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,4 @@
291291
</DIV></DIV>
292292
</xsl:template>
293293

294-
</xsl:stylesheet>
294+
</xsl:stylesheet>

xalan/src/main/java/org/apache/xalan/xsltc/trax/DOM2SAX.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private static String getLocalName(Node node) {
146146
}
147147

148148
public void parse(InputSource unused) throws IOException, SAXException {
149-
parse(_dom);
149+
parse();
150150
}
151151

152152
public void parse() throws IOException, SAXException {

xalan/src/main/java/org/apache/xalan/xsltc/trax/TemplatesImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,4 +407,4 @@ public DOM getStylesheetDOM() {
407407
public void setStylesheetDOM(DOM sdom) {
408408
_sdom.set(sdom);
409409
}
410-
}
410+
}

xalan/src/main/java/org/apache/xml/utils/XMLReaderManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public synchronized XMLReader getXMLReader() throws SAXException {
147147

148148
/**
149149
* Mark the cached XMLReader as available. If the reader was not
150-
* actually in the cache, do nothing.
150+
* for this thread, mark it as no longer being in use.
151151
*
152152
* @param reader The XMLReader that's being released.
153153
*/

0 commit comments

Comments
 (0)