TrinityCore
|
Easy loading and saving of XML and HTML files. More...
#include <XML.h>
Public Types | |
enum | Type { VALUE, TAG } |
typedef Table< std::string, XML > | AttributeTable |
Private Attributes | |
Type | m_type |
std::string | m_name |
std::string | m_value |
AttributeTable | m_attribute |
Array< XML > | m_child |
Easy loading and saving of XML and HTML files.
The XML class is intended primarily for interchange with other programs. We recommend using G3D::Any to make your own human-readable formats because it is a more general syntax, the implementation is more efficient, and contains better error handling.
Every XML is either a VALUE, or a TAG that contains both a table of its XML attributes and an array of its children. Children are nested tags and the strings between the nested tags.
No validation is performed, and the XML must be completely legal. XML Entity references (e.g., the ampersand codes for greater than and less than) are not automatically converted.
Tags with names that begin with "!" or "?" are ignored. Comment tags must end with "-->" e.g.,
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE note SYSTEM "Note.dtd">
child0 ... ... child2 ...
typedef Table<std::string, XML> G3D::XML::AttributeTable |
enum G3D::XML::Type |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
tagType | Must be XML::TAG to dismbiguate from the string constructor |
|
inline |
tagType | Must be XML::TAG to dismbiguate from the string constructor |
G3D::XML::XML | ( | TextInput & | t | ) |
|
inline |
bool G3D::XML::boolean | ( | ) | const |
Returns false if a TAG.
void G3D::XML::deserialize | ( | TextInput & | t | ) |
Note that the result is always copied, making this inefficient for return values that are not VALUEs.
void G3D::XML::load | ( | const std::string & | filename | ) |
|
inline |
The name, if this is a TAG.
|
inline |
Attribute table size; zero for a TAG
double G3D::XML::number | ( | ) | const |
Parse as a number. Returns nan() if a TAG or unparseable as a number.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return child i. Children are nested tags and the unquoted strings of characters between tags.
Return the attribute with this name.
void G3D::XML::parse | ( | const std::string & | s | ) |
void G3D::XML::save | ( | const std::string & | filename | ) | const |
void G3D::XML::serialize | ( | TextOutput & | t | ) | const |
|
inline |
Returns "" if a TAG.
|
inline |
void G3D::XML::unparse | ( | std::string & | s | ) | const |
|
private |
|
private |
|
private |
|
private |