donaldp 2002/07/06 22:24:13
Modified: xmlbundle/src/java/org/apache/excalibur/xmlizer/impl
HTMLXMLizer.java
Log:
Fix javadoc error
Revision Changes Path
1.2 +54 -43
jakarta-avalon-excalibur/xmlbundle/src/java/org/apache/excalibur/xmlizer/impl/HTMLXMLizer.java
Index: HTMLXMLizer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/xmlbundle/src/java/org/apache/excalibur/xmlizer/impl/HTMLXMLizer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HTMLXMLizer.java 24 Apr 2002 07:46:30 -0000 1.1
+++ HTMLXMLizer.java 7 Jul 2002 05:24:13 -0000 1.2
@@ -7,9 +7,8 @@
*/
package org.apache.excalibur.xmlizer.impl;
-import java.io.InputStream;
import java.io.IOException;
-import java.io.StringReader;
+import java.io.InputStream;
import java.io.StringWriter;
import java.util.Properties;
import javax.xml.transform.OutputKeys;
@@ -19,13 +18,12 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.avalon.excalibur.xml.Parser;
-import org.apache.excalibur.xmlizer.XMLizer;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.excalibur.xmlizer.XMLizer;
import org.w3c.tidy.Tidy;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
@@ -39,29 +37,28 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @version CVS $Revision$ $Date$
*/
-
public class HTMLXMLizer
extends AbstractLogEnabled
implements XMLizer, ThreadSafe, Composable
{
-
/** The component manager */
protected ComponentManager manager;
/** Used for converting DOM -> SAX */
protected static Properties format;
- static {
+ static
+ {
Properties format = new Properties();
- format.put(OutputKeys.METHOD, "xml");
- format.put(OutputKeys.OMIT_XML_DECLARATION, "no");
- format.put(OutputKeys.INDENT, "yes");
+ format.put( OutputKeys.METHOD, "xml" );
+ format.put( OutputKeys.OMIT_XML_DECLARATION, "no" );
+ format.put( OutputKeys.INDENT, "yes" );
}
/**
* Composable interface
*/
- public void compose(ComponentManager manager)
+ public void compose( ComponentManager manager )
{
this.manager = manager;
}
@@ -69,54 +66,69 @@
/**
* Generates SAX events from the given input stream
* <b>NOTE</b> : if the implementation can produce lexical events, care should
be taken
- * that <code>handler</code> can actually be a {@link XMLConsumer} that accepts
such
- * events or directly implements the LexicalHandler interface!
+ * that <code>handler</code> can actually be a
+ * {@link org.apache.avalon.excalibur.xml.XMLConsumer}
+ * that accepts such events or directly implements the
+ * LexicalHandler interface!
+ *
* @param stream the data
* @param mimeType the mime-type for the data
* @param systemID the URI defining the data (this is optional and can be null)
* @throws ComponentException if no suitable converter is found
*/
- public void toSAX( InputStream stream,
- String mimeType,
- String systemID,
+ public void toSAX( InputStream stream,
+ String mimeType,
+ String systemID,
ContentHandler handler )
throws SAXException, IOException, ComponentException
{
- if ( null == stream ) {
- throw new ComponentException("Stream must not be null.");
+ if( null == stream )
+ {
+ throw new ComponentException( "Stream must not be null." );
}
- if ( null == handler ) {
- throw new ComponentException("Handler must not be null.");
+
+ if( null == handler )
+ {
+ throw new ComponentException( "Handler must not be null." );
}
- if ( null == mimeType ) {
- if ( this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("No mime-type for xmlizing " + systemID +
- ", guessing text/html");
+
+ if( null == mimeType )
+ {
+ if( this.getLogger().isDebugEnabled() )
+ {
+ this.getLogger().debug( "No mime-type for xmlizing " + systemID +
+ ", guessing text/html" );
}
- } else if ( !mimeType.equalsIgnoreCase("text/html") ) {
- if ( this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("Mime-type " + mimeType +
- "not supported for xmlizing " + systemID +
- ", guessing text/html");
+ }
+ else if( !mimeType.equalsIgnoreCase( "text/html" ) )
+ {
+ if( this.getLogger().isDebugEnabled() )
+ {
+ this.getLogger().debug( "Mime-type " + mimeType +
+ "not supported for xmlizing " + systemID +
+ ", guessing text/html" );
}
}
final Tidy xhtmlconvert = new Tidy();
- xhtmlconvert.setXmlOut(true);
- xhtmlconvert.setXHTML(true);
- xhtmlconvert.setShowWarnings(false);
+ xhtmlconvert.setXmlOut( true );
+ xhtmlconvert.setXHTML( true );
+ xhtmlconvert.setShowWarnings( false );
final StringWriter writer = new StringWriter();
- try {
+ try
+ {
final Transformer transformer =
TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperties(format);
- transformer.transform(new DOMSource(xhtmlconvert.parseDOM(stream,
null)),
- new StreamResult(writer));
- } catch (TransformerException te) {
- throw new SAXException("Exception during transformation.", te);
+ transformer.setOutputProperties( format );
+ transformer.transform( new DOMSource( xhtmlconvert.parseDOM( stream,
null ) ),
+ new StreamResult( writer ) );
+ }
+ catch( TransformerException te )
+ {
+ throw new SAXException( "Exception during transformation.", te );
}
final InputSource inputSource =
- new InputSource( new java.io.StringReader(writer.toString()) );
- if ( null != systemID) inputSource.setSystemId( systemID );
+ new InputSource( new java.io.StringReader( writer.toString() ) );
+ if( null != systemID ) inputSource.setSystemId( systemID );
Parser parser = null;
try
@@ -130,6 +142,5 @@
if( parser != null ) this.manager.release( parser );
}
}
-
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>