wxXml2
Classes | Macros | Typedefs | Enumerations | Functions | Variables
xml2.h File Reference
#include "wx/string.h"
#include "wx/object.h"
#include "wx/wfstream.h"
#include "wx/xml2def.h"
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
Include dependency graph for xml2.h:
This graph shows which files directly or indirectly include this file:

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...
 

Macros

#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 struct 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

class WXDLLIMPEXP_WXXML2 wxXml2BaseNode
 
class WXDLLIMPEXP_WXXML2 wxXml2Node
 
class WXDLLIMPEXP_WXXML2 wxXml2Property
 
class WXDLLIMPEXP_WXXML2 wxXml2Namespace
 
class WXDLLIMPEXP_WXXML2 wxXml2Document
 
class WXDLLIMPEXP_WXXML2 wxXml2DTD
 

Macro Definition Documentation

#define WX2XML (   str)    ((xmlChar *)(str.mb_str(wxConvUTF8)))
#define wxCHECK_NULL_POINTERS (   x,
 
)
Value:
if (x == NULL && y == NULL) \
return TRUE; \
if ((x == NULL && y != NULL) || \
(x != NULL && y == NULL)) \
return FALSE;

A macro used in the overloaded operator==; this is the return table:

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

Referenced by wxXml2Node::Cmp(), wxXml2Node::CmpNoNs(), wxXml2ElemContent::operator==(), wxXml2Enumeration::operator==(), wxXml2ElemDecl::operator==(), wxXml2AttrDecl::operator==(), wxXml2EntityDecl::operator==(), wxXml2Property::operator==(), wxXml2DTD::operator==(), wxXml2Namespace::operator==(), and wxXml2BaseNode::operator==().

#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
Note
LIBXML_VERSION is in the format MAJOR|MAJOR|MINOR|RELEASE|RELEASE
#define wxXML2DOC_USE_INDENTATION   2

A wxXml2Document::Save flag.

Tells wxXml2Document to save the document using an indentation step.

Referenced by wxXml2Document::Save().

#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 '
').

Referenced by wxXml2DTD::Save(), and wxXml2Document::Save().

#define XML2WX (   str)    (wxString((const char *)str, wxConvUTF8))

Typedef Documentation

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.

Enumeration Type Documentation

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...

Enumerator:
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, "&amp;"); 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.

Function Documentation

WXDLLIMPEXP_DATA_WXXML2 ( wxXml2Node  )
WXDLLIMPEXP_DATA_WXXML2 ( wxXml2Property  )
WXDLLIMPEXP_DATA_WXXML2 ( wxXml2Namespace  )
WXDLLIMPEXP_DATA_WXXML2 ( wxXml2Document  )
WXDLLIMPEXP_DATA_WXXML2 ( wxXml2BaseNode  )

Variable Documentation