FileDocCategorySizeDatePackage
PYXWriter.javaAPI DocAndroid 1.5 API6267Wed May 06 22:41:42 BST 2009org.ccil.cowan.tagsoup

PYXWriter

public class PYXWriter extends Object implements ScanHandler, LexicalHandler, ContentHandler
A ContentHandler that generates PYX format instead of XML. Primarily useful for debugging.

Fields Summary
private PrintWriter
theWriter
private static char[]
dummy
private String
attrName
Constructors Summary
public PYXWriter(Writer w)

		if (w instanceof PrintWriter) {
			theWriter = (PrintWriter)w;
			}
		else {
			theWriter = new PrintWriter(w);
			}
		
Methods Summary
public voidadup(char[] buff, int offset, int length)

		// saved attribute name

	// ScanHandler implementation

	          
		theWriter.println(attrName);
		attrName = null;
		
public voidaname(char[] buff, int offset, int length)

		theWriter.print('A");
		theWriter.write(buff, offset, length);
		theWriter.print(' ");
		attrName = new String(buff, offset, length);
		
public voidaval(char[] buff, int offset, int length)

		theWriter.write(buff, offset, length);
		theWriter.println();
		attrName = null;
		
public voidcdsect(char[] buff, int offset, int length)

		pcdata(buff, offset, length);
		
public voidcharacters(char[] buff, int offset, int length)

		pcdata(buff, offset, length);
		
public voidcmnt(char[] buff, int offset, int length)

//		theWriter.print('!');
//		theWriter.write(buff, offset, length);
//		theWriter.println();
		
public voidcomment(char[] ch, int start, int length)

		cmnt(ch, start, length);
		
public voiddecl(char[] buff, int offset, int length)

        
public voidendCDATA()

 
public voidendDTD()

 
public voidendDocument()

		theWriter.close();
		
public voidendElement(java.lang.String uri, java.lang.String localname, java.lang.String qname)

		if (qname.length() == 0) qname = localname;
		theWriter.print(')");
		theWriter.println(qname);
		
public voidendEntity(java.lang.String name)

 
public voidendPrefixMapping(java.lang.String prefix)

 
public voidentity(char[] buff, int offset, int length)

 
public voideof(char[] buff, int offset, int length)

		theWriter.close();
		
public voidetag(char[] buff, int offset, int length)

		theWriter.print(')");
		theWriter.write(buff, offset, length);
		theWriter.println();
		
public intgetEntity()

 return 0; 
public voidgi(char[] buff, int offset, int length)

		theWriter.print('(");
		theWriter.write(buff, offset, length);
		theWriter.println();
		
public voidignorableWhitespace(char[] buff, int offset, int length)

		characters(buff, offset, length);
		
public voidpcdata(char[] buff, int offset, int length)

		if (length == 0) return;	// nothing to do
		boolean inProgress = false;
		length += offset;
		for (int i = offset; i < length; i++) {
			if (buff[i] == '\n") {
				if (inProgress) {
					theWriter.println();
					}
				theWriter.println("-\\n");
				inProgress = false;
				}
			else {
				if (!inProgress) {
					theWriter.print('-");
					}
				switch(buff[i]) {
				case '\t":
					theWriter.print("\\t");
					break;
				case '\\":
					theWriter.print("\\\\");
					break;
				default:
					theWriter.print(buff[i]);
					}
				inProgress = true;
				}
			}
		if (inProgress) {
			theWriter.println();
			}
		
public voidpi(char[] buff, int offset, int length)

		theWriter.write(buff, offset, length);
		theWriter.println();
		
public voidpitarget(char[] buff, int offset, int length)

		theWriter.print('?");
		theWriter.write(buff, offset, length);
		theWriter.write(' ");
		
public voidprocessingInstruction(java.lang.String target, java.lang.String data)

		theWriter.print('?");
		theWriter.print(target);
		theWriter.print(' ");
		theWriter.println(data);
		
public voidsetDocumentLocator(org.xml.sax.Locator locator)

 
public voidskippedEntity(java.lang.String name)

 
public voidstagc(char[] buff, int offset, int length)

//		theWriter.println("!");			// FIXME
		
public voidstage(char[] buff, int offset, int length)

		theWriter.println("!");			// FIXME
		
public voidstartCDATA()

 
public voidstartDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)

 
public voidstartDocument()

 
public voidstartElement(java.lang.String uri, java.lang.String localname, java.lang.String qname, org.xml.sax.Attributes atts)

		if (qname.length() == 0) qname=localname;
		theWriter.print('(");
		theWriter.println(qname);
		int length = atts.getLength();
		for (int i = 0; i < length; i++) {
			qname = atts.getQName(i);
			if (qname.length() == 0) qname = atts.getLocalName(i);
			theWriter.print('A");
//			theWriter.print(atts.getType(i));	// DEBUG
			theWriter.print(qname);
			theWriter.print(' ");
			theWriter.println(atts.getValue(i));
			}
		
public voidstartEntity(java.lang.String name)

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