tmiller 02/05/21 06:02:14
Modified: java/src/org/apache/xalan/xsltc/runtime/output
SAXHTMLOutput.java SAXOutput.java SAXXMLOutput.java
Log:
added new methods, on-going
Revision Changes Path
1.3 +62 -4
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/SAXHTMLOutput.java
Index: SAXHTMLOutput.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/SAXHTMLOutput.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SAXHTMLOutput.java 20 May 2002 22:15:33 -0000 1.2
+++ SAXHTMLOutput.java 21 May 2002 13:02:14 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: SAXHTMLOutput.java,v 1.2 2002/05/20 22:15:33 tmiller Exp $
+ * @(#)$Id: SAXHTMLOutput.java,v 1.3 2002/05/21 13:02:14 tmiller Exp $
*
* The Apache Software License, Version 1.1
*
@@ -86,9 +86,6 @@
}
- public void startElement(String elementName) throws TransletException {
- }
-
public void attribute(String name, final String value)
throws TransletException
{
@@ -160,6 +157,40 @@
_saxHandler.endElement(EMPTYSTRING, EMPTYSTRING, "meta");
}
+ /**
+ * Start an element in the output document. This might be an XML
+ * element (<elem>data</elem> type) or a CDATA section.
+ */
+ public void startElement(String elementName) throws TransletException {
+ try {
+ // Close any open start tag
+ if (_startTagOpen) closeStartTag();
+
+ // Handle document type declaration (for first element only)
+ if (_lexHandler != null) {
+ if ((_doctypeSystem != null) || (_doctypePublic != null))
+ _lexHandler.startDTD(elementName,
+ _doctypePublic,_doctypeSystem);
+ _lexHandler = null;
+ }
+
+ _depth++;
+ _elementName = elementName;
+ _attributes.clear();
+ _startTagOpen = true;
+ _qnameStack.push(elementName);
+
+ // Insert <META> tag directly after <HEAD> element in HTML doc
+ if (elementName.toLowerCase().equals("head")) {
+ _headTagOpen = true;
+ }
+ } catch (SAXException e) {
+ throw new TransletException(e);
+ }
+ }
+
+
+
/**
* End an element or CDATA section in the output document
@@ -175,6 +206,33 @@
}
}
+
+ /**
+ * Set the output media type - only relevant for HTML output
+ */
+ public void setMediaType(String mediaType) {
+ // This value does not have to be passed to the SAX handler. This
+ // handler creates the HTML <meta> tag in which the media-type
+ // (MIME-type) will be used.
+ _mediaType = mediaType;
+ }
+
+
+ /**
+ * Ends the document output.
+ */
+ public void endDocument() throws TransletException {
+ try {
+ // Close any open start tag
+ if (_startTagOpen) closeStartTag();
+
+ // Close output document
+ _saxHandler.endDocument();
+ } catch (SAXException e) {
+ throw new TransletException(e);
+ }
+ }
+
private void initNamespaces() {
//empty
1.3 +8 -5
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/SAXOutput.java
Index: SAXOutput.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/SAXOutput.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SAXOutput.java 20 May 2002 22:15:33 -0000 1.2
+++ SAXOutput.java 21 May 2002 13:02:14 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: SAXOutput.java,v 1.2 2002/05/20 22:15:33 tmiller Exp $
+ * @(#)$Id: SAXOutput.java,v 1.3 2002/05/21 13:02:14 tmiller Exp $
*
* The Apache Software License, Version 1.1
*
@@ -80,12 +80,15 @@
protected String _elementName = null;
// parameters set by <xsl:output> element, or by set/getOutputProperty()
- protected String _encoding = null;
- protected String _doctypeSystem = null;
- protected String _doctypePublic = null;
+ protected String _encoding = null;
+ protected String _doctypeSystem = null;
+ protected String _doctypePublic = null;
// The top of this stack contains the QName of the currently open element
- protected Stack _qnameStack;
+ protected Stack _qnameStack;
+
+ // Holds the current tree depth (see startElement() and endElement()).
+ protected int _depth = 0;
public SAXOutput(ContentHandler handler, String encoding) {
1.3 +1 -4
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/SAXXMLOutput.java
Index: SAXXMLOutput.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/SAXXMLOutput.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SAXXMLOutput.java 20 May 2002 22:15:33 -0000 1.2
+++ SAXXMLOutput.java 21 May 2002 13:02:14 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: SAXXMLOutput.java,v 1.2 2002/05/20 22:15:33 tmiller Exp $
+ * @(#)$Id: SAXXMLOutput.java,v 1.3 2002/05/21 13:02:14 tmiller Exp $
*
* The Apache Software License, Version 1.1
*
@@ -91,9 +91,6 @@
// The top of this stack contains the element id of the last element
whose
// contents should be output as CDATA sections.
private Stack _cdataStack;
-
- // Holds the current tree depth (see startElement() and endElement()).
- private int _depth = 0;
// The top of this stack contains the QName of the currently open element
private Stack _qnameStack;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]