You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mm...@apache.org on 2001/02/12 20:31:16 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/processor StylesheetPIHandler.java TransformerFactoryImpl.java
mmidy 01/02/12 11:31:16
Modified: java/src/org/apache/xalan/processor StylesheetPIHandler.java
TransformerFactoryImpl.java
Log:
Patch for Dmitri IIyin to use the specified URIResolver.
Revision Changes Path
1.11 +47 -6 xml-xalan/java/src/org/apache/xalan/processor/StylesheetPIHandler.java
Index: StylesheetPIHandler.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/StylesheetPIHandler.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- StylesheetPIHandler.java 2001/01/24 18:35:14 1.10
+++ StylesheetPIHandler.java 2001/02/12 19:31:13 1.11
@@ -66,6 +66,7 @@
import javax.xml.transform.Source;
import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.URIResolver;
import org.apache.xml.utils.SystemIDResolver;
@@ -89,6 +90,37 @@
/** A list of SAXSource objects that match the criteria. */
Vector m_stylesheets = new Vector();
+
+ // Add code to use a URIResolver. Patch from Dmitri Ilyin.
+
+ /**
+ * The object that implements the URIResolver interface,
+ * or null.
+ */
+ URIResolver m_uriResolver;
+
+ /**
+ * Get the object that will be used to resolve URIs in href
+ * in xml-stylesheet processing instruction.
+ *
+ * @param resolver An object that implements the URIResolver interface,
+ * or null.
+ */
+ public void setURIResolver(URIResolver resolver)
+ {
+ m_uriResolver = resolver;
+ }
+
+ /**
+ * Get the object that will be used to resolve URIs in href
+ * in xml-stylesheet processing instruction.
+ *
+ * @return The URIResolver that was set with setURIResolver.
+ */
+ public URIResolver getURIResolver()
+ {
+ return m_uriResolver;
+ }
/**
* Construct a StylesheetPIHandler instance that will search
@@ -123,9 +155,8 @@
if (sz > 0)
{
- SAXSource ssource
- = new SAXSource((InputSource) m_stylesheets.elementAt(sz-1));
- return ssource;
+ Source source = (Source) m_stylesheets.elementAt(sz-1);
+ return source;
}
else
return null;
@@ -156,6 +187,7 @@
boolean alternate = false; // (yes|no) "no"
StringTokenizer tokenizer = new StringTokenizer(data, " \t=", true);
boolean lookedAhead = false;
+ Source source = null;
String token = "";
while (tokenizer.hasMoreTokens())
@@ -212,8 +244,17 @@
}
href = href.substring(1, href.length() - 1);
try
- {
- href = SystemIDResolver.getAbsoluteURI(href, m_baseID);
+ {
+ // Add code to use a URIResolver. Patch from Dmitri Ilyin.
+ if (m_uriResolver != null)
+ {
+ source = m_uriResolver.resolve(href, m_baseID);
+ }
+ else
+ {
+ href = SystemIDResolver.getAbsoluteURI(href, m_baseID);
+ source = new SAXSource(new InputSource(href));
+ }
}
catch(TransformerException te)
{
@@ -293,7 +334,7 @@
return;
}
- m_stylesheets.addElement(new InputSource(href));
+ m_stylesheets.addElement(source);
}
}
}
1.24 +6 -0 xml-xalan/java/src/org/apache/xalan/processor/TransformerFactoryImpl.java
Index: TransformerFactoryImpl.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/TransformerFactoryImpl.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- TransformerFactoryImpl.java 2001/01/31 20:54:36 1.23
+++ TransformerFactoryImpl.java 2001/02/12 19:31:14 1.24
@@ -317,6 +317,12 @@
// the parse.
StylesheetPIHandler handler = new StylesheetPIHandler(baseID, media,
title, charset);
+
+ // Use URIResolver. Patch from Dmitri Ilyin
+ if (m_uriResolver != null)
+ {
+ handler.setURIResolver(m_uriResolver);
+ }
try
{