maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r591685 - /maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
Date Sat, 03 Nov 2007 20:55:59 GMT
Author: ltheussl
Date: Sat Nov  3 13:55:58 2007
New Revision: 591685

URL: http://svn.apache.org/viewvc?rev=591685&view=rev
Log:
Add a convenience method to parse a string

Modified:
    maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java

Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java?rev=591685&r1=591684&r2=591685&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
(original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
Sat Nov  3 13:55:58 2007
@@ -21,6 +21,7 @@
 
 import java.io.IOException;
 import java.io.Reader;
+import java.io.StringReader;
 
 import org.apache.maven.doxia.macro.MacroExecutionException;
 import org.apache.maven.doxia.markup.XmlMarkup;
@@ -60,6 +61,20 @@
         {
             throw new ParseException( "Macro execution failed: " + ex.getMessage(), ex );
         }
+    }
+
+    /**
+     * Convenience method to parse an arbitrary string and emit any xml events into the given
sink.
+     *
+     * @param string A string that provides the source input. The string has to be completely
+     * enclosed inside one xml root element, otherwise a ParseException is thrown.
+     * @param sink A sink that consumes the Doxia events.
+     * @throws ParseException if the string does not represent a well-formed xml snippet.
+     */
+    public void parse( String string, Sink sink )
+        throws ParseException
+    {
+        parse( new StringReader( string ), sink );
     }
 
     /** {@inheritDoc} */



Mime
View raw message