com.simonstl.blogger
Class XML2blog

java.lang.Object
  |
  +--java.io.Reader
        |
        +--java.io.FilterReader
              |
              +--com.simonstl.blogger.XML2blog

public final class XML2blog
extends java.io.FilterReader

This class converts XML documents which use a set of conventions into Blogger templates.

Because Blogger templates use tags like <$BlogItemAuthor$>, they aren't properly XML. This code takes XHTML in the form <_BlogItemAuthor_/> and converts it to <$BlogItemAuthor$>. You shouldn't run this code on other documents which have elements starting with _B or containing empty elements whose names end in _. It also adds the necessary spaces to empty elements generated by XML processors that create things like <br/>. If the spaces are already there, an extra space is inserted, but that causes no harm.

Version:
0.01 $Date: 2002/01/27 $
Author:
Simon St.Laurent

Field Summary
protected  boolean generating
           
protected  boolean inElementName
           
protected  java.lang.StringBuffer myBuffer
           
protected  boolean pastXmlDecl
           
 
Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
XML2blog(java.io.InputStream in)
           
XML2blog(java.io.Reader in)
           
 
Method Summary
protected  int feedFromInternalBuffer()
           
 void keepXMLDecl(boolean _pastXmlDecl)
          To keep the XML declaration, call keepXMLDecl(true) before processing the document.
static void main(java.lang.String[] args)
          This class defines a main() method to test the O2KCleaner
 int read()
           
 int read(char[] text, int offset, int length)
           
 
Methods inherited from class java.io.FilterReader
close, mark, markSupported, ready, reset, skip
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pastXmlDecl

protected boolean pastXmlDecl

generating

protected boolean generating

inElementName

protected boolean inElementName

myBuffer

protected java.lang.StringBuffer myBuffer
Constructor Detail

XML2blog

public XML2blog(java.io.InputStream in)

XML2blog

public XML2blog(java.io.Reader in)
Method Detail

keepXMLDecl

public void keepXMLDecl(boolean _pastXmlDecl)
To keep the XML declaration, call keepXMLDecl(true) before processing the document.

feedFromInternalBuffer

protected int feedFromInternalBuffer()

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.FilterReader

read

public int read(char[] text,
                int offset,
                int length)
         throws java.io.IOException
Overrides:
read in class java.io.FilterReader

main

public static void main(java.lang.String[] args)
This class defines a main() method to test the O2KCleaner