|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.process.TransformXML<T>
T - The type of the output of the Function (from String to T)public class TransformXML<T>
Reads XML from an input file or stream and writes XML to an output
file or stream, while transforming text appearing inside specified
XML tags by applying a specified . See TransformXMLApplications for examples.
Implementation note: This is done using SAX2.
Function
| Nested Class Summary | |
|---|---|
static class |
TransformXML.NoEscapingSAXInterface<T>
This version of the SAXInterface doesn't escape the text produced by the function. |
static class |
TransformXML.SAXInterface<T>
|
| Constructor Summary | |
|---|---|
TransformXML()
|
|
| Method Summary | |
|---|---|
TransformXML.SAXInterface<T> |
buildSaxInterface()
|
void |
transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.File in)
Read XML from the specified file and write XML to stdout, while transforming text appearing inside the specified XML tags by applying the specified . |
void |
transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.File in,
java.io.File out)
Read XML from the specified file and write XML to specified file, while transforming text appearing inside the specified XML tags by applying the specified . |
void |
transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
org.xml.sax.InputSource in,
java.io.Writer w,
TransformXML.SAXInterface<T> saxInterface)
Read XML from input source and write XML to output writer, while transforming text appearing inside the specified XML tags by applying the specified . |
void |
transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.InputStream in)
Read XML from input stream and write XML to stdout, while transforming text appearing inside the specified XML tags by applying the specified . |
void |
transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.InputStream in,
java.io.OutputStream out)
Read XML from input stream and write XML to output stream, while transforming text appearing inside the specified XML tags by applying the specified . |
void |
transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.InputStream in,
java.io.Writer w)
Read XML from input stream and write XML to output stream, while transforming text appearing inside the specified XML tags by applying the specified . |
void |
transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.InputStream in,
java.io.Writer w,
TransformXML.SAXInterface<T> handler)
Calls the fully specified transformXML with an InputSource constructed from in. |
void |
transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.Reader in,
java.io.Writer w,
TransformXML.SAXInterface<T> handler)
Calls the fully specified transformXML with an InputSource constructed from in. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TransformXML()
| Method Detail |
|---|
public TransformXML.SAXInterface<T> buildSaxInterface()
public void transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.File in)
Function. Note that the Function
you supply must be prepared to accept Strings as
input; if your Function doesn't handle
Strings, you need to write a wrapper for it that
does.
tags - an array of Strings, each an XML tag
within which the transformation should be appliedfn - the Function to applyin - the File to read from
public void transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.File in,
java.io.File out)
Function.
Note that the Function you supply must be
prepared to accept Strings as input; if your
Function doesn't handle Strings, you
need to write a wrapper for it that does.
tags - an array of Strings, each an XML tag
within which the transformation should be appliedfn - the Function to applyin - the File to read fromout - the File to write to
public void transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.InputStream in)
Function.
Note that the Function you supply must be
prepared to accept Strings as input; if your
Function doesn't handle Strings, you
need to write a wrapper for it that does.
tags - an array of Strings, each an XML tag
within which the transformation should be appliedfn - the Function to applyin - the InputStream to read from
public void transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.InputStream in,
java.io.OutputStream out)
Function.
Note that the Function you supply must be
prepared to accept Strings as input; if your
Function doesn't handle Strings, you
need to write a wrapper for it that does.
tags - an array of Strings, each an XML tag
within which the transformation should be appliedfn - the Function to applyin - the InputStream to read fromout - the OutputStream to write to
public void transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.InputStream in,
java.io.Writer w)
Function.
Note that the Function you supply must be
prepared to accept Strings as input; if your
Function doesn't handle Strings, you
need to write a wrapper for it that does.
Implementation notes: The InputStream is assumed to already be buffered if useful, and we need a stream, so that the XML decoder can determine the correct character encoding of the XML file. The output is to a Writer, and the provided Writer should again be buffered if desirable. Internally, this Writer is wrapped as a PrintWriter.
tags - an array of Strings, each an XML entity
within which the transformation should be appliedfn - the Function to applyin - the InputStream to read fromw - the Writer to write to
public void transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.InputStream in,
java.io.Writer w,
TransformXML.SAXInterface<T> handler)
in.
public void transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
java.io.Reader in,
java.io.Writer w,
TransformXML.SAXInterface<T> handler)
in.
public void transformXML(java.lang.String[] tags,
Function<java.lang.String,T> fn,
org.xml.sax.InputSource in,
java.io.Writer w,
TransformXML.SAXInterface<T> saxInterface)
Function.
Note that the Function you supply must be
prepared to accept Strings as input; if your
Function doesn't handle Strings, you
need to write a wrapper for it that does.
Implementation notes: The InputSource is assumed to already
be buffered if useful, and we need a stream, so that the XML decoder
can determine the correct character encoding of the XML file.
TODO: does that mean there's a bug if you send it a Reader
instead of an InputStream? It seems to work with a Reader...
The output is to a Writer, and the provided Writer should again
be buffered if desirable. Internally, this Writer is wrapped as
a PrintWriter.
tags - an array of Strings, each an XML entity
within which the transformation should be appliedfn - the Function to applyin - the InputStream to read fromw - the Writer to write tosaxInterface - the sax handler you would like to use (default is SaxInterface, defined in this class, but you may define your own handler)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||