#include "wx/string.h"
#include "wx/object.h"
#include "wx/wfstream.h"
#include "wx/xml2def.h"
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
Go to the source code of this file.
Classes | |
struct | tagXml2BaseNode |
The common part of all XML nodes. More... | |
class | wxXml2 |
A wrapper for some libxml2 static functions regarding the entire parser. More... | |
class | wxXml2Wrapper |
Provides some standard methods for all wxXml2 wrappers. More... | |
class | wxXml2Property |
Represents a node property. More... | |
class | wxXml2Namespace |
Represents an XML namespace. More... | |
class | wxXml2Document |
This class holds XML data/document as parsed by the libxml2 parser. More... | |
class | wxXml2BaseNode |
A generic XML node. More... | |
class | wxXml2Node |
Represents a node in XML documents. More... | |
class | wxNativeNewlinesFilterStream |
A little helper class used by wxXml2Document::Save and wxXml2DTD::Save to convert to the native format of newlines. More... | |
class | wxStringOutputStream |
A simple wxOutputStream which outputs everything into a wxString. More... | |
Defines | |
#define | wxCHECK_NULL_POINTERS(x, y) |
A macro used in the overloaded operator==; this is the return table:. | |
#define | WX2XML(str) ((xmlChar *)(str.mb_str(wxConvUTF8))) |
Converts from wxStrings to xmlChars. | |
#define | XML2WX(str) (wxString((const char *)str, wxConvUTF8)) |
Converts from xmlChars to wxStrings. | |
#define | wxXML2DOC_USE_NATIVE_NEWLINES 1 |
A wxXml2Document::Save flag. | |
#define | wxXML2DOC_USE_INDENTATION 2 |
A wxXml2Document::Save flag. | |
#define | wxXML2CHECK_VERSION(major, minor, release) (LIBXML_VERSION >= major##0##minor##release) |
Checks if the libxml2 version currently used (when compiling) is newer or match the given version numbers. | |
Typedefs | |
typedef tagXml2BaseNode | wxXml2BaseNodeObj |
The common part of all XML nodes. | |
Enumerations | |
enum | wxXml2NodeType { wxXML2_ELEMENT_NODE = 1, wxXML2_TEXT_NODE = 3, wxXML2_CDATA_SECTION_NODE = 4, wxXML2_ENTITY_REF_NODE = 5, wxXML2_PI_NODE = 7, wxXML2_COMMENT_NODE = 8, wxXML2_DOCUMENT_NODE = 9, wxXML2_HTML_DOCUMENT_NODE = 13, wxXML2_DTD_NODE = 14, wxXML2_ELEMENT_DECL = 15, wxXML2_ATTRIBUTE_DECL = 16, wxXML2_ENTITY_DECL = 17, wxXML2_NAMESPACE_DECL = 18 } |
Represents an XML node type. More... | |
Functions | |
WXDLLIMPEXP_DATA_WXXML2 (wxXml2Node) wxXml2EmptyNode | |
WXDLLIMPEXP_DATA_WXXML2 (wxXml2Property) wxXml2EmptyProperty | |
WXDLLIMPEXP_DATA_WXXML2 (wxXml2Namespace) wxXml2EmptyNamespace | |
WXDLLIMPEXP_DATA_WXXML2 (wxXml2Document) wxXml2EmptyDoc | |
WXDLLIMPEXP_DATA_WXXML2 (wxXml2BaseNode) wxXml2EmptyBaseNode | |
Variables | |
WXDLLIMPEXP_WXXML2 | wxXml2BaseNode |
WXDLLIMPEXP_WXXML2 | wxXml2Node |
WXDLLIMPEXP_WXXML2 | wxXml2Property |
WXDLLIMPEXP_WXXML2 | wxXml2Namespace |
WXDLLIMPEXP_WXXML2 | wxXml2Document |
WXDLLIMPEXP_WXXML2 | wxXml2DTD |
#define WX2XML | ( | str | ) | ((xmlChar *)(str.mb_str(wxConvUTF8))) |
Converts from wxStrings to xmlChars.
Libxml2 takes sequences of xmlChar (which is defined to be *always* unsigned char) which are asupposed to be always in UTF8: thus WX2XML converts wxStrings to UTF8.
#define wxCHECK_NULL_POINTERS | ( | x, | |||
y | ) |
Value:
if (x == NULL && y == NULL) \ return TRUE; \ if ((x == NULL && y != NULL) || \ (x != NULL && y == NULL)) \ return FALSE;
x y returns NULL NULL TRUE (they are equal) NULL non-NULL FALSE (they are different) non-NULL NULL FALSE (they are different) non-NULL non-NULL nothing: no 'return' statement is executed: x and y could be equal but they could also be different. The code following the macro must care about this possibility
#define wxXML2CHECK_VERSION | ( | major, | |||
minor, | |||||
release | ) | (LIBXML_VERSION >= major##0##minor##release) |
Checks if the libxml2 version currently used (when compiling) is newer or match the given version numbers.
The version numbers must be: 1 digit for major & minor; always 2 digits for release:
#if wxXML2CHECK_VERSION(2, 6, 10) put here the code for libxml2 >= 2.6.10 #else put here the code for libxml2 < 2.6.10 #endif
#define wxXML2DOC_USE_INDENTATION 2 |
A wxXml2Document::Save flag.
Tells wxXml2Document to save the document using an indentation step.
#define wxXML2DOC_USE_NATIVE_NEWLINES 1 |
A wxXml2Document::Save flag.
Tells wxXml2Document to save the document using the native newline format; if not specified all newlines will be encoded in unix format (that is, as simple '
').
#define XML2WX | ( | str | ) | (wxString((const char *)str, wxConvUTF8)) |
Converts from xmlChars to wxStrings.
Libxml2 always outputs a sequence of xmlChar which are encoded in UTF8: this macro creates a wxString which converts the given string from UTF8 to the format internally used by wxString (whatever it is).
typedef struct tagXml2BaseNode wxXml2BaseNodeObj |
The common part of all XML nodes.
This structure has been copied-and-pasted from line 440 of tree.h of the libxml2 xmlNode structure.
enum wxXml2NodeType |
Represents an XML node type.
LibXML2 allows a lot of different element types, but the following are the types you can use with the wxXml2 wrappers...
wxXML2_ELEMENT_NODE |
Container nodes; they are characterized by the NAME, the NAMESPACE and the CHILDRENs.
They create something like: <NAME>children</NAME> or (if namespace != wxXml2EmptyNamespace), <NS:NAME>children</NS:NAME> Examples: wxXml2Node container(wxXML2_ELEMENT_NODE, parentnode, "MYTAG"); container.AddChild(....); |
wxXML2_TEXT_NODE | Nodes containing text; they are characterized by VALUE (or CONTENT). |
wxXML2_CDATA_SECTION_NODE |
Creates something like: <![CDATA[content]]> To use this type of node, create a container node and then use the SetType(wxXML2_CDATA_SECTION_NODE) function.
To set content use wxXml2Node::SetContent. |
wxXML2_ENTITY_REF_NODE |
Like a text node, but this node contains only an "entity".
Entities are strings like: & or " or < .... To create them, use wxXml2Node entityref(wxXML2_TEXT_NODE, parentnode, "&"); containernode.AddChild(entityref); |
wxXML2_PI_NODE |
Creates a Processing Instruction (PI) node.
Such type of nodes looks like: <?name content ?> To use this type of node, create a container node and then use SetType(). To add 'properties', you cannot use wxXml2Property; instead use wxXml2Node::SetContent("property=\"value\""). |
wxXML2_COMMENT_NODE | Creates a comment node: . |
wxXML2_DOCUMENT_NODE |
The value of the "type" member of an xmlDoc structure.
This value is used to identify a node as a wxXml2Document. Never use it directly: use wxXml2Document instead. |
wxXML2_HTML_DOCUMENT_NODE | Like wxXML2_DOCUMENT_NODE. |
wxXML2_DTD_NODE |
The value of the "type" member of an xmlDtd structure.
This value is used to identify a node as a wxXml2DTD. Never use it directly: use wxXml2DTD instead. |
wxXML2_ELEMENT_DECL |
A DTD node which declares an element.
This value is used to identify a node as a wxXml2ElemDecl. Looks like: <!ELEMENT mynode (PCDATA)> |
wxXML2_ATTRIBUTE_DECL |
A DTD node which declares an attribute.
This value is used to identify a node as a wxXml2AttrDecl. Looks like: <!ATTLIST myattr type PCDATA "defaultvalue"> |
wxXML2_ENTITY_DECL |
A DTD node which declares an entity.
This value is used to identify a node as a wxXml2EntityDecl. Looks like: <!ENTITY myentity "entity's replacement"> |
wxXML2_NAMESPACE_DECL |
The value of the "type" member of an xmlNs structure.
This value is used to identify a node as a wxXml2Namespace. Never use it directly: use wxXml2Namespace instead. |
WXDLLIMPEXP_DATA_WXXML2 | ( | wxXml2BaseNode | ) |
WXDLLIMPEXP_DATA_WXXML2 | ( | wxXml2Document | ) |
WXDLLIMPEXP_DATA_WXXML2 | ( | wxXml2Namespace | ) |
WXDLLIMPEXP_DATA_WXXML2 | ( | wxXml2Property | ) |
WXDLLIMPEXP_DATA_WXXML2 | ( | wxXml2Node | ) |
class WXDLLIMPEXP_WXXML2 wxXml2BaseNode |
class WXDLLIMPEXP_WXXML2 wxXml2Document |
class WXDLLIMPEXP_WXXML2 wxXml2DTD |
class WXDLLIMPEXP_WXXML2 wxXml2Namespace |
class WXDLLIMPEXP_WXXML2 wxXml2Node |
class WXDLLIMPEXP_WXXML2 wxXml2Property |