You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2009/02/23 09:26:20 UTC
svn commit: r746922 - in
/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax:
AbstractSAXProducer.java AbstractSAXSerializer.java
util/TransformationUtils.java util/XMLUtils.java
Author: cziegeler
Date: Mon Feb 23 08:26:19 2009
New Revision: 746922
URL: http://svn.apache.org/viewvc?rev=746922&view=rev
Log:
Fix javadocs.
Modified:
cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXProducer.java
cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXSerializer.java
cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/TransformationUtils.java
cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/XMLUtils.java
Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXProducer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXProducer.java?rev=746922&r1=746921&r2=746922&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXProducer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXProducer.java Mon Feb 23 08:26:19 2009
@@ -28,12 +28,12 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.pipeline.component.Producer#setConsumer(org.apache.cocoon.pipeline.component.Consumer)
*/
public final void setConsumer(Consumer consumer) {
if (!(consumer instanceof SAXConsumer)) {
- throw new SetupException("XMLProducer requires an XMLConsumer.");
+ throw new SetupException("SAXProducer requires a SAXConsumer.");
}
this.setSAXConsumer((SAXConsumer) consumer);
Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXSerializer.java?rev=746922&r1=746921&r2=746922&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXSerializer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXSerializer.java Mon Feb 23 08:26:19 2009
@@ -41,9 +41,9 @@
}
/**
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.pipeline.component.Finisher#getContentType()
*/
public String getContentType() {
@@ -65,9 +65,9 @@
}
/**
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.pipeline.component.PipelineComponent#setConfiguration(java.util.Map)
*/
@Override
@@ -78,7 +78,7 @@
}
/**
- * @param The type of the content produced by this serializer.
+ * @param contentType The type of the content produced by this serializer.
*/
public void setContentType(String contentType) {
this.contentType = contentType;
@@ -86,7 +86,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.pipeline.component.PipelineComponent#setup(java.util.Map)
*/
@Override
@@ -95,9 +95,9 @@
}
/**
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.pipeline.component.Finisher#setOutputStream(java.io.OutputStream)
*/
public void setOutputStream(OutputStream outputStream) {
@@ -105,9 +105,9 @@
}
/**
- *
+ *
* {@inheritDoc}
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/TransformationUtils.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/TransformationUtils.java?rev=746922&r1=746921&r2=746922&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/TransformationUtils.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/TransformationUtils.java Mon Feb 23 08:26:19 2009
@@ -33,19 +33,19 @@
* This class contains utility methods to transform an XML string by using XSLT. It hides all the
* details of the Java TRaX API by using SAX pipeline components that are linked to each other. This
* means that the SAX events stream through the pipeline and are serialized at the end.
- *
+ *
* NOTE: Exception handling needs to be discussed and will probably change.
*/
public abstract class TransformationUtils {
/**
* Transform an XML string by using XSLT.
- *
+ *
* @param xmlString The String to be transformed.
* @param xsltUrls The {@link URL}s of all XSLT stylesheets that are used in the order they are
* passed to transform the passed XML string.
* @return The transformed result as {@link String}.
- *
+ *
* @throws Exception
*/
public static String transform(String xmlString, URL... xsltUrls) throws Exception {
@@ -55,7 +55,7 @@
/**
* Transform an XML string by using XSLT. This method also allows passing parameters to the
* stylesheets.
- *
+ *
* @param xmlString The String to be transformed.
* @param xsltParameters Parameters that are available in all XSLT stylesheets.
* @param xsltUrls The {@link URL}s of all XSLT stylesheets that are used in the order they are
@@ -70,9 +70,9 @@
/**
* Transform an XML string by using XSLT. This method allows defining the output properties.
- *
+ *
* @param xmlString The String to be transformed.
- * @param outputProperties XML output properties. See {@link http://www.w3.org/TR/xslt#output}.
+ * @param outputProperties XML output properties. See {@link "http://www.w3.org/TR/xslt#output"}.
* @param xsltUrls The {@link URL}s of all XSLT stylesheets that are used in the order they are
* passed to transform the passed XML string.
* @return The transformed result as {@link String}.
@@ -85,10 +85,10 @@
/**
* Transform an XML string by using XSLT. This method allows defining the output properties and
* also allows passing parameters to the stylesheets.
- *
+ *
* @param xmlString The String to be transformed.
* @param xsltParameters Parameters that are available in all XSLT stylesheets.
- * @param outputProperties XML output properties. See {@link http://www.w3.org/TR/xslt#output}.
+ * @param outputProperties XML output properties. See {@link "http://www.w3.org/TR/xslt#output"}.
* @param xsltUrls The {@link URL}s of all XSLT stylesheets that are used in the order they are
* passed to transform the passed XML string.
* @return The transformed result as {@link String}.
@@ -103,10 +103,10 @@
/**
* Transform an XML string by using XSLT and write the result into an {@link OutputStream}.
- *
+ *
* @param xmlString The String to be transformed.
* @param outputStream The result is written into this {@link OutputStream}.
- * @param xsltUrls The {@link URL}s of all XSLT stylesheets that are used in the order they are
+ * @param xsltURLs The {@link URL}s of all XSLT stylesheets that are used in the order they are
* passed to transform the passed XML string.
* @throws Exception
*/
@@ -117,11 +117,11 @@
/**
* Transform an XML string by using XSLT and write the result into an {@link OutputStream}.
* This method also allows passing parameters to the stylesheets.
- *
+ *
* @param xmlString The String to be transformed.
* @param outputStream The result is written into this {@link OutputStream}.
* @param xsltParameters Parameters that are available in all XSLT stylesheets.
- * @param xsltUrls The {@link URL}s of all XSLT stylesheets that are used in the order they are
+ * @param xsltURLs The {@link URL}s of all XSLT stylesheets that are used in the order they are
* passed to transform the passed XML string.
* @throws Exception
*/
@@ -133,11 +133,11 @@
/**
* Transform an XML string by using XSLT and write the result into an {@link OutputStream}.
* This method allows defining the output properties.
- *
+ *
* @param xmlString The String to be transformed.
* @param outputStream The result is written into this {@link OutputStream}.
- * @param outputProperties XML output properties. See {@link http://www.w3.org/TR/xslt#output}.
- * @param xsltUrls The {@link URL}s of all XSLT stylesheets that are used in the order they are
+ * @param outputProperties XML output properties. See {@link "http://www.w3.org/TR/xslt#output"}.
+ * @param xsltURLs The {@link URL}s of all XSLT stylesheets that are used in the order they are
* passed to transform the passed XML string.
* @throws Exception
*/
@@ -148,14 +148,14 @@
/**
* Transform an XML string and write the result into an {@link OutputStream}.
- *
+ *
* @param xmlString The String to be transformed.
* @param xsltParameters Parameters that are available in all XSLT stylesheets.
- * @param outputProperties XML output properties. See {@link http://www.w3.org/TR/xslt#output}.
+ * @param outputProperties XML output properties. See {@link "http://www.w3.org/TR/xslt#output"}.
* @param outputStream The result is written into this {@link OutputStream}.
* @param xsltUrls The {@link URL}s of all XSLT stylesheets that are used in the order they are
* passed to transform the passed XML string.
- *
+ *
* @throws Exception
*/
public static void transform(String xmlString, Map<String, Object> xsltParameters, Properties outputProperties,
Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/XMLUtils.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/XMLUtils.java?rev=746922&r1=746921&r2=746922&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/XMLUtils.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/XMLUtils.java Mon Feb 23 08:26:19 2009
@@ -41,6 +41,7 @@
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
+import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.XMLReaderFactory;
/**
@@ -53,7 +54,7 @@
/**
* Serialize the content of a {@link SAXBuffer} into an {@link OutputStream}.
- *
+ *
* @param outputStream OutputStream to use.
* @param saxBuffer A SaxBuffer containing the SAX events.
*/
@@ -75,9 +76,9 @@
/**
* Use a SAX parser and read the content of an {@link InputStream} into an {@link SAXConsumer}.
- *
+ *
* @param inputStream InputStream containing the content to be parsed.
- * @param xmlConsumer The XMLConsumer to use.
+ * @param contentHandler The ContentHandler to use.
* @throws IOException if the {@link InputStream} can't be used.
* @throws SAXException if the {@link InputStream} can't be parsed.
*/
@@ -88,9 +89,9 @@
/**
* Use a SAX parser and read the content of an {@link InputStream} into an {@link SAXConsumer}.
- *
+ *
* @param string A String to be parsed.
- * @param xmlConsumer The XMLConsumer to use.
+ * @param contentHandler The ContentHandler to use.
* @throws IOException if the {@link InputStream} can't be used.
* @throws SAXException if the {@link InputStream} can't be parsed.
*/
@@ -100,11 +101,11 @@
/**
* Stream a {@link URLConnection} into an {@link SAXConsumer} by using
- * {@link XMLUtils#toSax(InputStream, SAXConsumer)}. The {@link URLConnection} is closed after
+ * {@link XMLUtils#toSax(InputStream, ContentHandler)}. The {@link URLConnection} is closed after
* streaming.
- *
- * @param The {@link URLConnection} to be streamed.
- * @param An {@link SAXConsumer} as target.
+ *
+ * @param urlConnection The {@link URLConnection} to be streamed.
+ * @param contentHandler An {@link ContentHandler} as target.
*/
public static void toSax(final URLConnection urlConnection, final ContentHandler contentHandler) {
try {
@@ -124,7 +125,9 @@
try {
xmlReader = XMLReaderFactory.createXMLReader();
xmlReader.setContentHandler(contentHandler);
- xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", contentHandler);
+ if ( contentHandler instanceof LexicalHandler ) {
+ xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", contentHandler);
+ }
xmlReader.setEntityResolver(new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {