Package uk.ac.starlink.ttools.votlint
Class DoctypeInterpolator
- java.lang.Object
-
- uk.ac.starlink.ttools.votlint.DoctypeInterpolator
-
public class DoctypeInterpolator extends java.lang.ObjectAttempts to check that a DOCTYPE declaration is present in an input stream representing XML. If it is not, one is inserted. The algorithm used here isn't bulletproof, but should work in most sensible cases, and fail noisily if it can't do it. It copes with a number of not-too-weird XML encodings.- Author:
- Mark Taylor (Starlink)
-
-
Constructor Summary
Constructors Constructor Description DoctypeInterpolator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStreamgetStreamWithDoctype(java.io.BufferedInputStream in)Returns an input stream which is a copy of a given one, except that if the given one doesn't include a DOCTYPE declaration, one is inserted.java.lang.StringgetVotableVersion()Returns the value of the version attribute of the top-level VOTABLE element, if there was one and it was encountered.static voidmain(java.lang.String[] args)Filter program which takes a stream on standard output and writes to standard output including the DOCTYPE.voidmessage(java.lang.String msg)Presents a processing message.
-
-
-
Method Detail
-
getStreamWithDoctype
public java.io.InputStream getStreamWithDoctype(java.io.BufferedInputStream in) throws java.io.IOExceptionReturns an input stream which is a copy of a given one, except that if the given one doesn't include a DOCTYPE declaration, one is inserted. This method can only be called once for each instance of this class.- Parameters:
in- original input stream- Returns:
- input stream like in but with a DOCTYPE
- Throws:
java.lang.IllegalStateException- if this method has already been called on this objectjava.io.IOException
-
getVotableVersion
public java.lang.String getVotableVersion()
Returns the value of the version attribute of the top-level VOTABLE element, if there was one and it was encountered.- Returns:
- declared VOTable version string, or null
-
message
public void message(java.lang.String msg)
Presents a processing message.- Parameters:
msg- message text
-
main
public static void main(java.lang.String[] args) throws java.io.IOExceptionFilter program which takes a stream on standard output and writes to standard output including the DOCTYPE.- Throws:
java.io.IOException
-
-