public class XmlMethods extends Object
Constructor and Description |
---|
XmlMethods() |
Modifier and Type | Method and Description |
---|---|
static io.toro.gloop.object.cursor.GloopCursor |
getInputCursorFromFile(String filename,
String encoding,
List<String> xmlNodeNames,
io.toro.gloop.engine.GloopExecutionContext context)
Opens an input cursor used to read from large XML files
|
static io.toro.gloop.object.cursor.GloopCursor |
getInputCursorFromInputStream(InputStream inputStream,
String encoding,
List<String> xmlNodeNames,
io.toro.gloop.engine.GloopExecutionContext context)
Opens an input cursor used to read from large XML files
|
static String |
gloopObjectToXmlString(io.toro.gloop.object.property.GloopObject gloopObject,
boolean insertHeader,
Map declaredNamespaces)
Marshalls a gloop object to an XML string
|
static io.toro.gloop.object.property.GloopModel |
openXmlOutputCursor(String elementName,
boolean insertHeader,
Map declaredNamespaces,
boolean includeNamespaces,
String indent,
boolean closeDestination,
Object destination,
io.toro.gloop.engine.GloopExecutionContext context)
Opens a cursor used to write large amounts of xml data
|
static io.toro.gloop.object.property.GloopObject |
readerToGloopObject(Reader xmlString)
Converts a reader containing XML to a gloop object
|
static void |
setCursorElementName(io.toro.gloop.cursor.xml.GloopXmlOutputCursor gloopCursor,
String elementName)
Sets the element name of an XML output cursor
|
static io.toro.gloop.object.property.GloopObject |
streamToGloopObject(InputStream xmlString)
Converts an input stream containing XML to a gloop object
|
static void |
writeXml(Writer writer,
io.toro.gloop.object.property.GloopObject gloopObject,
boolean insertHeader,
boolean includeNamespaces,
Map declaredNamespaces,
boolean includeNulls)
Marshalls the given gloop object to a writer
|
static io.toro.gloop.object.property.GloopObject |
xmlStringToGloopObject(String xmlString)
Converts an XML string to a gloop object
|
@GloopComment(value="Convert a gloop object to xml") @GloopParameter(name="gloopXml") public static String gloopObjectToXmlString(io.toro.gloop.object.property.GloopObject gloopObject, @GloopParameter(defaultValue="true") boolean insertHeader, Map declaredNamespaces)
gloopObject
- the object to marshallinsertHeader
- flag stating whether to include the <? xml version="1.0"?> headerdeclaredNamespaces
- map of pre-declared namespaces already declared (if any). The key should contain the
namespace URIs, and the values should contain their prefixespublic static io.toro.gloop.object.property.GloopObject xmlStringToGloopObject(String xmlString) throws SAXException
xmlString
- the XML to convertSAXException
public static io.toro.gloop.object.property.GloopObject streamToGloopObject(InputStream xmlString) throws SAXException
xmlString
- the input stream containing the xmlSAXException
public static io.toro.gloop.object.property.GloopObject readerToGloopObject(Reader xmlString) throws SAXException
xmlString
- the reader containing the xmlSAXException
public static void writeXml(@GloopParameter(allowNull=false) Writer writer, @GloopParameter(allowNull=false) io.toro.gloop.object.property.GloopObject gloopObject, @GloopParameter(defaultValue="false") boolean insertHeader, @GloopParameter(defaultValue="true") boolean includeNamespaces, Map declaredNamespaces, @GloopParameter(defaultValue="false") boolean includeNulls)
writer
- The writer to write the XML togloopObject
- The gloop object to marshallinsertHeader
- flag stating whether to include the <? xml version="1.0"?> headerincludeNamespaces
- A flag stating whether to include namespace declarationsdeclaredNamespaces
- map of pre-declared namespaces already declared (if any). The key should contain the
namespace URIs, and the values should contain their prefixesincludeNulls
- A flag stating whether to include empty elements for properties that have a null value@GloopObjectParameter(value="gloopXmlCursor{\n gloopXmlCursor[]{\n nodeName\n cursorRecord:object\n }\n}") public static io.toro.gloop.object.cursor.GloopCursor getInputCursorFromFile(String filename, @GloopParameter(defaultValue="UTF-8") String encoding, List<String> xmlNodeNames, io.toro.gloop.engine.GloopExecutionContext context) throws FileNotFoundException, XMLStreamException, TransformerConfigurationException
filename
- The name of the file containing the XMLencoding
- The enoding of the XMLxmlNodeNames
- the element names the cursor should be seeking tocontext
- The Gloop Execution Context, Gloop maps this automaticallyFileNotFoundException
XMLStreamException
TransformerConfigurationException
@GloopObjectParameter(value="gloopXmlCursor{\n gloopXmlCursor[]{\n nodeName\n cursorRecord:object\n }\n}") public static io.toro.gloop.object.cursor.GloopCursor getInputCursorFromInputStream(InputStream inputStream, @GloopParameter(defaultValue="UTF-8") String encoding, List<String> xmlNodeNames, io.toro.gloop.engine.GloopExecutionContext context) throws XMLStreamException, TransformerConfigurationException
inputStream
- The input stream containing the XMLencoding
- The enoding of the XMLxmlNodeNames
- the element names the cursor should be seeking tocontext
- The Gloop Execution Context, Gloop maps this automaticallyXMLStreamException
TransformerConfigurationException
@GloopObjectParameter(value="output{\n cursorXmlOutput{\n writer:object:printer used to write the xml out to::::java.io.Writer\n outputXmlCursor[]*{\n }\n }\n}") public static io.toro.gloop.object.property.GloopModel openXmlOutputCursor(String elementName, @GloopParameter(defaultValue="true") boolean insertHeader, Map declaredNamespaces, @GloopParameter(defaultValue="true") boolean includeNamespaces, @GloopParameter(allowNull=false,defaultValue=" ") String indent, @GloopParameter(defaultValue="true") boolean closeDestination, Object destination, io.toro.gloop.engine.GloopExecutionContext context) throws IOException
elementName
- The name given to the XML element that this cursor will writeinsertHeader
- Whether to print a the xml header (%lt;?xml version = "1.0"?%gt;)declaredNamespaces
- A map of declared namespaces for this XMLincludeNamespaces
- Whether to include the namespaces in the XML elementsindent
- The indent to use if pretty printing. Default is 4 spacescloseDestination
- True if the cursor will close the underlying destination after printing closing textdestination
- Where to write the data to. Must be a StringBuffer, Writer, or Filecontext
- The Gloop Execution Context, Gloop maps this automaticallyIOException
public static void setCursorElementName(io.toro.gloop.cursor.xml.GloopXmlOutputCursor gloopCursor, String elementName)
gloopCursor
- XML Output cursorelementName
- The element nameCopyright © 2019. All rights reserved.