fdda.plugins.xmlreader
Class DOCTYPEChangerStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.FilterInputStream
              |
              +--fdda.plugins.xmlreader.DOCTYPEChangerStream

public final class DOCTYPEChangerStream
extends FilterInputStream

This class adds a DOCTYPE to an incoming XML document or replaces its existing DOCTYPE declaration if it has one.

Version:
0.01 $Date: 2003/03/18 16:28:58 $
Author:
Simon St.Laurent, Nigel Whitaker

Field Summary
protected  boolean cycle
           
protected  boolean docStarted
           
protected  boolean generating
           
protected  boolean internalSubset
           
protected  String internalSubsetContent
           
protected  StringBuffer myBuffer
           
protected  String publicIdentifier
           
protected  boolean replace
           
protected  String rootElement
           
protected  String systemIdentifier
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
DOCTYPEChangerStream(InputStream in)
           
 
Method Summary
protected  void addDocType()
           
protected  int feedFromInternalBuffer()
           
 String getInternalSubset()
          Returns the internal subset.
 String getPublicIdentifier()
          Returns the public identifier.
 String getRootElement()
          Returns the root element.
 String getSystemIdentifier()
          Returns the system identifier.
static void main(String[] args)
          This class defines a main() method to test the DOCTYPEChanger
 int read()
           
 int read(byte[] text, int offset, int length)
           
 void setInternalSubset(String subsetContents)
          Use this method to set the internal subset identified by the DOCTYPE declaration.
 void setPublicIdentifier(String identifier)
          Use setPublicIdentifier to set the public identifer identified by the DOCTYPE declaration.
 void setReplace(boolean replaceChoice)
          Use setReplace to indicate whether to replace the DOCTYPE declarations for documents that already have one.
 void setRootElement(String elementName)
          Use setRootElement to set the root element identified by the DOCTYPE declaration.
 void setSystemIdentifier(String identifier)
          Use setSystemIdentifier to set the public identifer identified by the DOCTYPE declaration.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

replace

protected boolean replace

rootElement

protected String rootElement

publicIdentifier

protected String publicIdentifier

systemIdentifier

protected String systemIdentifier

internalSubsetContent

protected String internalSubsetContent

docStarted

protected boolean docStarted

generating

protected boolean generating

cycle

protected boolean cycle

internalSubset

protected boolean internalSubset

myBuffer

protected StringBuffer myBuffer
Constructor Detail

DOCTYPEChangerStream

public DOCTYPEChangerStream(InputStream in)
Method Detail

setReplace

public void setReplace(boolean replaceChoice)
Use setReplace to indicate whether to replace the DOCTYPE declarations for documents that already have one. False means don't replace, true means do replace.


setRootElement

public void setRootElement(String elementName)
Use setRootElement to set the root element identified by the DOCTYPE declaration.


setPublicIdentifier

public void setPublicIdentifier(String identifier)
Use setPublicIdentifier to set the public identifer identified by the DOCTYPE declaration. If set, the result will be <!DOCTYPE rootElement PUBLIC 'publicIdentifier' 'systemIdentifer' [internalSubset, if present]>> . You must also set a system identifier for this to work properly.


setSystemIdentifier

public void setSystemIdentifier(String identifier)
Use setSystemIdentifier to set the public identifer identified by the DOCTYPE declaration. If set without a public identifier, the result will be <!DOCTYPE rootElement SYSTEM 'systemIdentifer' [internalSubset, if present]>>


setInternalSubset

public void setInternalSubset(String subsetContents)
Use this method to set the internal subset identified by the DOCTYPE declaration. If set, the result will be <!DOCTYPE rootElement PUBLIC or SYSTEM identifiers [internalSubset]>>


getRootElement

public String getRootElement()
Returns the root element. Mostly useful to see if you set it previously.


getPublicIdentifier

public String getPublicIdentifier()
Returns the public identifier. Mostly useful to see if you set it previously.


getSystemIdentifier

public String getSystemIdentifier()
Returns the system identifier. Mostly useful to see if you set it previously.


getInternalSubset

public String getInternalSubset()
Returns the internal subset.


addDocType

protected void addDocType()

feedFromInternalBuffer

protected int feedFromInternalBuffer()

read

public int read()
         throws IOException
Overrides:
read in class FilterInputStream
IOException

read

public int read(byte[] text,
                int offset,
                int length)
         throws IOException
Overrides:
read in class FilterInputStream
IOException

main

public static void main(String[] args)
This class defines a main() method to test the DOCTYPEChanger



API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.