jstrachan 2002/09/17 08:27:04
Modified: jelly/src/java/org/apache/commons/jelly XMLOutput.java
Log:
Added some extra helper methods to make it easier to output simple SAX events from
inside a Tag
Revision Changes Path
1.7 +32 -7
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/XMLOutput.java
Index: XMLOutput.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/XMLOutput.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XMLOutput.java 21 Jun 2002 03:18:42 -0000 1.6
+++ XMLOutput.java 17 Sep 2002 15:27:04 -0000 1.7
@@ -78,6 +78,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.AttributesImpl;
/** <p><code>XMLOutput</code> is used to output XML events
* in a SAX-like manner. This also allows pipelining to be done
@@ -97,13 +98,15 @@
/** The Log to which logging calls will be made. */
private static final Log log = LogFactory.getLog(XMLOutput.class);
+ /** empty attributes */
+ private static final Attributes EMPTY_ATTRIBUTES = new AttributesImpl();
+
/** The SAX ContentHandler that output goes to */
private ContentHandler contentHandler;
/** The SAX LexicalHandler that output goes to */
private LexicalHandler lexicalHandler;
-
-
+
public XMLOutput() {
}
@@ -245,6 +248,28 @@
comment(ch, 0, ch.length);
}
+ /**
+ * Helper method for outputting a start element event for an element in no
namespace
+ */
+ public void startElement(String localName) throws SAXException {
+ startElement("", localName, localName, EMPTY_ATTRIBUTES);
+ }
+
+ /**
+ * Helper method for outputting a start element event for an element in no
namespace
+ */
+ public void startElement(String localName, Attributes attributes) throws
SAXException {
+ startElement("", localName, localName, attributes);
+ }
+
+ /**
+ * Helper method for outputting an end element event for an element in no
namespace
+ */
+ public void endElement(String localName) throws SAXException {
+ endElement("", localName, localName);
+ }
+
+
// ContentHandler interface
//-------------------------------------------------------------------------
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>