FileDocCategorySizeDatePackage
SAX2StAXBaseWriter.javaAPI DocJava SE 6 API5919Tue Jun 10 00:22:34 BST 2008com.sun.org.apache.xalan.internal.xsltc.trax

SAX2StAXBaseWriter

public abstract class SAX2StAXBaseWriter extends DefaultHandler implements LexicalHandler

Fields Summary
protected boolean
isCDATA
protected StringBuffer
CDATABuffer
protected Vector
namespaces
protected Locator
docLocator
protected XMLReporter
reporter
Constructors Summary
public SAX2StAXBaseWriter()

	
public SAX2StAXBaseWriter(XMLReporter reporter)

		this.reporter = reporter;
	
Methods Summary
public voidcharacters(char[] ch, int start, int length)

		if (isCDATA) {
			CDATABuffer.append(ch, start, length);
		}
	
public voidcomment(char[] ch, int start, int length)

	
public voidendCDATA()

		isCDATA = false;
		CDATABuffer.setLength(0);
	
public voidendDTD()

	
public voidendDocument()

		namespaces = null;
	
public voidendElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)

		namespaces = null;
	
public voidendEntity(java.lang.String name)

	
public voidendPrefixMapping(java.lang.String prefix)

	
public voiderror(org.xml.sax.SAXParseException e)

		reportException("ERROR", e);
	
public voidfatalError(org.xml.sax.SAXParseException e)

		reportException("FATAL", e);
	
public javax.xml.stream.LocationgetCurrentLocation()

		if (docLocator != null) {
			return new SAXLocation(docLocator);
		} else {
			return null;
		}

	
public static final voidparseQName(java.lang.String qName, java.lang.String[] results)
Parses an XML qualified name, and places the resulting prefix and local name in the provided String array.

param
qName The qualified name to parse.
param
results An array where parse results will be placed. The prefix will be placed at results[0], and the local part at results[1]


		String prefix, local;
		int idx = qName.indexOf(':");
		if (idx >= 0) {
			prefix = qName.substring(0, idx);
			local = qName.substring(idx + 1);
		} else {
			prefix = "";
			local = qName;
		}
		results[0] = prefix;
		results[1] = local;
	
protected voidreportException(java.lang.String type, org.xml.sax.SAXException e)
Used to report a {@link SAXException}to the {@link XMLReporter} registered with this handler.


		if (reporter != null) {
			try {
				reporter.report(e.getMessage(), type, e, getCurrentLocation());
			} catch (XMLStreamException e1) {
				throw new SAXException(e1);
			}
		}
	
public voidsetDocumentLocator(org.xml.sax.Locator locator)

		this.docLocator = locator;
	
public voidsetXMLReporter(javax.xml.stream.XMLReporter reporter)

		this.reporter = reporter;
	
public voidstartCDATA()

		isCDATA = true;
		if (CDATABuffer == null) {
			CDATABuffer = new StringBuffer();
		} else {
			CDATABuffer.setLength(0);
		}
	
public voidstartDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)

	
public voidstartDocument()

                    namespaces = new Vector(2);
	
public voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)

			namespaces = null;
	
public voidstartEntity(java.lang.String name)

	
public voidstartPrefixMapping(java.lang.String prefix, java.lang.String uri)


		if (prefix == null) {
			prefix = "";
		} else if (prefix.equals("xml")) {
			return;
		}

		if (namespaces == null) {
        	    namespaces = new Vector(2);
        	}
                namespaces.addElement(prefix);
                namespaces.addElement(uri);
        
public voidwarning(org.xml.sax.SAXParseException e)

		reportException("WARNING", e);