|
Jameo Core Library
|
This class provides methods to write XML data. More...
Public Member Functions | |
| XMLWriter (Stream *output) | |
| Constructor. | |
| ~XMLWriter () override | |
| Destructor. | |
| bool | startDocument () |
| This method must be called at the beginning. It opens the stream if it hasn't been opened yet. | |
| bool | endDocument () |
| This method must be called at the end. It closes the stream. | |
| void | startIndent () |
| Increase indentation level. | |
| void | endIndent () |
| Decrease indentation level. | |
| void | startElement (const String &name) |
| This method opens a new XML element. | |
| void | writeAttribute (const String &name, const String &content) |
| This method writes an XML attribute to the open start element. | |
| void | writeAttribute (const String &name, int32 content) |
| This method writes an XML attribute to the currently open start element. | |
| void | writeAttribute (const String &name, uint32 content) |
| This method writes an XML attribute to the currently open start element. | |
| void | writeAttribute (const String &name, int64 content) |
| This method writes an XML attribute to the currently open start element. | |
| void | writeAttribute (const String &name, uint64 content) |
| This method writes an XML attribute to the currently open start element. | |
| void | writeAttribute (const String &name, float content) |
| This method writes an XML attribute to the currently open start element. | |
| void | writeAttribute (const String &name, double content) |
| This method writes an XML attribute to the currently open start element. | |
| void | endElement () |
| This method closes the currently open XML element. If the element has no content, a <.../> element is written. | |
| void | writeCData (const String &cdata, bool xmlencode=true) |
| This method writes CDATA to the currently open start element. | |
| void | WriteBase64 (const uint8 *data, size_t length) |
| This method writes data and encodes it using the BASE64 algorithm. | |
Public Member Functions inherited from jm::Object | |
| Object () noexcept | |
| Constructor. | |
| virtual | ~Object () noexcept |
| Destructor. | |
| void | release () noexcept |
| Decreases the reference counter and releases the object immediately when the reference counter becomes 0. | |
| Object * | retain () noexcept |
| Increases the reference counter of this object by 1. | |
| Object * | autorelease () noexcept |
| Same function as release(), but releases the object with a delay if the reference counter is 0. AutoreleasePool::drain() must be called in the to release the object. | |
| int32 | referenceCount () const noexcept |
| Returns the value of the reference counter. | |
| virtual bool | equals (const Object *other) const |
| Comparison of objects. | |
| virtual String | displayName () const |
| Returns the display name of the object intended to present to a user. | |
| virtual void | printDiffInfo (DiffOperation operation, Object *other) const |
| Output method for outputting the diff results for the diff algorithm. | |
| void | setHighBit (bool status) noexcept |
| bool | highBit () const noexcept |
This class provides methods to write XML data.
The XMLWriter class allows you to write XML files by providing various methods to handle different aspects of XML writing.
|
explicit |
Constructor.
| output | The Stream where the XML data should be written. |
|
override |
Destructor.
| bool jm::XMLWriter::endDocument | ( | ) |
This method must be called at the end. It closes the stream.
| void jm::XMLWriter::endElement | ( | ) |
This method closes the currently open XML element. If the element has no content, a <.../> element is written.
| void jm::XMLWriter::endIndent | ( | ) |
Decrease indentation level.
In XML, whitespaces are sometimes significant. The significance of whitespaces depends on the document. This method performs an indentation and decreases the indentation level.
| bool jm::XMLWriter::startDocument | ( | ) |
This method must be called at the beginning. It opens the stream if it hasn't been opened yet.
| void jm::XMLWriter::startElement | ( | const String & | name | ) |
This method opens a new XML element.
This method is used to open a new XML element in the XMLWriter class. It should be called before writing any content to the element.
| name | The name of the XML element to be opened. |
| void jm::XMLWriter::startIndent | ( | ) |
Increase indentation level.
In XML, whitespaces are sometimes significant. The significance of whitespaces depends on the document. This method performs an indentation and increases the indentation level.
This method writes an XML attribute to the open start element.
| name | The name of the attribute. |
| content | The content of the attribute. |
| void jm::XMLWriter::writeAttribute | ( | const String & | name, |
| double | content | ||
| ) |
This method writes an XML attribute to the currently open start element.
This method should be called before writing any content to the element.
| name | The name of the attribute. |
| content | The content of the attribute. |
| void jm::XMLWriter::writeAttribute | ( | const String & | name, |
| float | content | ||
| ) |
This method writes an XML attribute to the currently open start element.
This method should be called before writing any content to the element.
| name | The name of the attribute. |
| content | The content of the attribute. |
| void jm::XMLWriter::writeAttribute | ( | const String & | name, |
| int32 | content | ||
| ) |
This method writes an XML attribute to the currently open start element.
This method should be called before writing any content to the element.
| name | The name of the attribute. |
| content | The content of the attribute. |
| void jm::XMLWriter::writeAttribute | ( | const String & | name, |
| int64 | content | ||
| ) |
This method writes an XML attribute to the currently open start element.
This method should be called before writing any content to the element.
| name | The name of the attribute. |
| content | The content of the attribute. |
| void jm::XMLWriter::writeAttribute | ( | const String & | name, |
| uint32 | content | ||
| ) |
This method writes an XML attribute to the currently open start element.
This method should be called before writing any content to the element.
| name | The name of the attribute. |
| content | The content of the attribute. |
| void jm::XMLWriter::writeAttribute | ( | const String & | name, |
| uint64 | content | ||
| ) |
This method writes an XML attribute to the currently open start element.
This method should be called before writing any content to the element.
| name | The name of the attribute. |
| content | The content of the attribute. |
| void jm::XMLWriter::WriteBase64 | ( | const uint8 * | data, |
| size_t | length | ||
| ) |
This method writes data and encodes it using the BASE64 algorithm.
| data | The unencoded data to be written. |
| length | The length of the data. |
| void jm::XMLWriter::writeCData | ( | const String & | cdata, |
| bool | xmlencode = true |
||
| ) |
This method writes CDATA to the currently open start element.
CDATA is used to escape blocks of text that contain characters which would otherwise be recognized as markup. This method should be called before writing any content to the element.
| cdata | The CDATA to be written. |
| xmlencode | If true (default), certain characters (e.g. & -> &) will be XML-encoded. |