Altova XMLSpy 2024 Enterprise Edition

When code is generated from an XML Schema, the generated code provides a document class with the same name as the schema. This class contains all possible root elements as members, as well as the members listed below. Note that, in the method names below, "Doc" stands for the name of the generated document class itself.

 

Methods


Name

Description

ic_java_public_static

static Doc createDocument()

Creates a new, empty XML document.

ic_java_public_static

static void declareAllNamespacesFromSchema(com.altova.xml.ElementType node)

Declares all namespaces from the XML Schema on the element supplied as argument (typically, the XML root element). Calling this method is useful if your schema has multiple namespace declarations, each mapped to a prefix, and you would like to declare all of them on the element supplied as argument.

ic_java_public_static

static Doc loadFromBinary(byte[] xml)

Loads an XML document from a byte array.

ic_java_public_static

static Doc loadFromFile(String fileName)

Loads an XML document from a file.

ic_java_public_static

static Doc loadFromString(String xml)

Loads an XML document from a string.

ic_java_public_member

byte[] saveToBinary(boolean prettyPrint)

Saves an XML document to a byte array, with optional "pretty-print" formatting.

ic_java_public_member

byte[] saveToBinary(boolean prettyPrint, String encoding)

Saves an XML document to a byte array, with optional "pretty-print" formatting, with the specified encoding.

ic_java_public_member

byte[] saveToBinary(boolean prettyPrint, String encoding, boolean bigEndian, boolean writeBOM)

Saves an XML document to a byte array, with optional "pretty-print" formatting, with the specified encoding. Byte order and Unicode byte-order mark can be specified for Unicode encodings.

ic_java_public_member

void saveToFile(String fileName, boolean prettyPrint)

Saves an XML document to a file, with optional "pretty-print" formatting.

ic_java_public_member

void saveToFile(String fileName, boolean prettyPrint, boolean omitXmlDecl)

Saves an XML document to a file, with optional "pretty-print" formatting, with UTF-8 encoding. When omitXmlDecl is true, the XML declaration will not be written.

ic_java_public_member

void saveToFile(String fileName, boolean prettyPrint, boolean omitXmlDecl, String encoding)

Saves an XML document to a file, with optional "pretty-print" formatting, with the specified encoding. When omitXmlDecl is true, the XML declaration will not be written.

ic_java_public_member

void saveToFile(String fileName, boolean prettyPrint, boolean omitXmlDecl, String encoding, boolean bBigEndian, boolean bBOM)

Saves an XML document to a file, with optional "pretty-print" formatting, with the specified encoding. When omitXmlDecl is true, the XML declaration will not be written. Byte order and Unicode byte-order mark can be specified for Unicode encodings.

ic_java_public_member

void saveToFile(String fileName, boolean prettyPrint, String encoding)

Saves an XML document to a file, with optional "pretty-print" formatting, with the specified encoding.

ic_java_public_member

void saveToFile(String fileName, boolean prettyPrint, String encoding, boolean bBigEndian, boolean bBOM)

Saves an XML document to a file, with optional "pretty-print" formatting, with the specified encoding. Byte order and Unicode byte-order mark can be specified for Unicode encodings.

ic_java_public_member

String saveToString(boolean prettyPrint)

Saves an XML document to a string, with optional "pretty-print" formatting.

ic_java_public_member

String saveToString(boolean prettyPrint, boolean omitXmlDecl)

Saves an XML document to a string, with optional "pretty-print" formatting. When omitXmlDecl is true, the XML declaration will not be written.

ic_java_public_member

void setSchemaLocation(String schemaLocation)

Adds an xsi:schemaLocation or xsi:noNamespaceSchemaLocation attribute to the root element. A root element must already exist.

© 2017-2023 Altova GmbH