Gnash
0.8.11dev
|
Implements XML (AS2) and flash.xml.XMLDocument (AS3) class. More...
#include <XML_as.h>
Public Types | |
enum | ParseStatus { XML_OK = 0, XML_UNTERMINATED_CDATA = -2, XML_UNTERMINATED_XML_DECL = -3, XML_UNTERMINATED_DOCTYPE_DECL = -4, XML_UNTERMINATED_COMMENT = -5, XML_UNTERMINATED_ELEMENT = -6, XML_OUT_OF_MEMORY = -7, XML_UNTERMINATED_ATTRIBUTE = -8, XML_MISSING_CLOSE_TAG = -9, XML_MISSING_OPEN_TAG = -10 } |
enum | LoadStatus { XML_LOADED_UNDEFINED = -1, XML_LOADED_FALSE = false, XML_LOADED_TRUE = true } |
typedef std::string::const_iterator | xml_iterator |
![]() | |
enum | NodeType { Element = 1, Attribute = 2, Text = 3, Cdata = 4, EntityRef = 5, Entity = 6, ProcInstr = 7, Comment = 8, Document = 9, DocType = 10, DocFragment = 11, Notation = 12 } |
typedef std::list< XMLNode_as * > | Children |
Public Member Functions | |
XML_as (as_object &object) | |
Create an XML object. More... | |
XML_as (as_object &object, const std::string &xml) | |
~XML_as () | |
void | toString (std::ostream &o, bool encode) const |
Convert the XML object to a string. More... | |
const std::string & | getXMLDecl () const |
void | setXMLDecl (const std::string &xml) |
const std::string & | getDocTypeDecl () const |
void | setDocTypeDecl (const std::string &docType) |
const std::string & | getContentType () const |
void | setContentType (const std::string &contentType) |
void | parseXML (const std::string &xml) |
Parses an XML document into the specified XML object tree. More... | |
int | status () const |
void | setStatus (ParseStatus st) |
LoadStatus | loaded () const |
void | setLoaded (LoadStatus st) |
bool | ignoreWhite () const |
Return current ignoreWhite property. More... | |
void | ignoreWhite (bool ignore) |
Set ignoreWhite property. More... | |
![]() | |
XMLNode_as (Global_as &gl) | |
virtual | ~XMLNode_as () |
size_t | length () const |
const std::string & | nodeName () const |
const std::string & | nodeValue () const |
NodeType | nodeType () const |
Get the type of an XML Node. More... | |
void | nodeTypeSet (NodeType type) |
Set the type of an XML Node. More... | |
void | nodeNameSet (const std::string &name) |
Set name of this node. More... | |
bool | extractPrefix (std::string &prefix) const |
void | nodeValueSet (const std::string &value) |
Set value of this node. More... | |
void | getNamespaceForPrefix (const std::string &prefix, std::string &ns) const |
Performs a recursive search of node attributes to find a match. More... | |
bool | getPrefixForNamespace (const std::string &ns, std::string &prefix) const |
Performs a recursive search of node attributes to find a match. More... | |
void | setNamespaceURI (const std::string &value) |
const std::string & | getNamespaceURI () const |
bool | descendsFrom (XMLNode_as *node) const |
Returns true if 'this' descends from the specified node. More... | |
bool | hasChildNodes () const |
XMLNode_as * | firstChild () const |
XMLNode_as * | lastChild () const |
as_object * | childNodes () |
XMLNode_as * | previousSibling () const |
XMLNode_as * | nextSibling () const |
XMLNode_as * | cloneNode (bool deep) const |
Copy a node. More... | |
void | appendChild (XMLNode_as *node) |
Append a child node to this XML object. More... | |
void | removeChild (XMLNode_as *node) |
Remove a child node from this XML object. More... | |
XMLNode_as * | getParent () const |
Get the parent XMLNode_as of this node. Can be 0. More... | |
void | insertBefore (XMLNode_as *newnode, XMLNode_as *pos) |
Insert a node before a node. More... | |
as_object * | getAttributes () const |
Return the attributes object associated with this node. More... | |
void | setAttribute (const std::string &name, const std::string &value) |
Set a named attribute to a value. More... | |
void | setObject (as_object *o) |
Associate an as_object with this XMLNode_as. More... | |
as_object * | object () |
Return the object associated with this XMLNode_as. More... | |
![]() | |
virtual | ~Relay ()=0 |
virtual void | clean () |
Handle any cleanup necessary before the Relay is destroyed. More... | |
Additional Inherited Members | |
![]() | |
virtual void | setReachable () |
Mark reachable elements. More... | |
void | clearChildren () |
Clear all children, making sure unreferenced children are deleted. More... | |
![]() | |
Global_as & | _global |
Implements XML (AS2) and flash.xml.XMLDocument (AS3) class.
This class interface is identical in AS3 and AS2; it is probably included in AS3 for backward compatibility. The class definition is necessary because XML is encoded differently in AMF.
typedef std::string::const_iterator gnash::XML_as::xml_iterator |
gnash::XML_as::XML_as | ( | as_object & | object | ) |
Create an XML object.
An XMLDocument is always user-created, so always starts with an associated object.
References gnash::XMLNode_as::setObject().
Referenced by gnash::registerXMLNative().
gnash::XML_as::XML_as | ( | as_object & | object, |
const std::string & | xml | ||
) |
References parseXML(), and gnash::XMLNode_as::setObject().
|
inline |
References gnash::key::o, and toString().
|
inline |
Referenced by gnash::registerXMLNative().
|
inline |
Referenced by gnash::registerXMLNative().
|
inline |
Referenced by gnash::registerXMLNative().
|
inline |
Return current ignoreWhite property.
Referenced by ignoreWhite(), parseXML(), and gnash::registerXMLNative().
|
inline |
Set ignoreWhite property.
References gnash::image::end(), gnash::escapeXML(), ignoreWhite(), gnash::registerXMLNative(), gnash::unescapeXML(), test::uri, and gnash::xml_class_init().
|
inline |
Referenced by gnash::registerXMLNative().
void gnash::XML_as::parseXML | ( | const std::string & | xml | ) |
Parses an XML document into the specified XML object tree.
This reads in an XML file from disk and parses into into a memory resident tree which can be walked through later.
Calls to this function clear any precedently parsed data.
References _, gnash::XMLNode_as::clearChildren(), ignoreWhite(), gnash::log_error(), XML_MISSING_CLOSE_TAG, and XML_OK.
Referenced by gnash::registerXMLNative(), setContentType(), and XML_as().
|
inline |
References parseXML().
Referenced by gnash::registerXMLNative().
|
inline |
Referenced by gnash::registerXMLNative().
|
inline |
Referenced by gnash::registerXMLNative().
|
inline |
Referenced by gnash::registerXMLNative().
|
inline |
Referenced by gnash::registerXMLNative().
|
inline |
Referenced by gnash::registerXMLNative().
|
virtual |
Convert the XML object to a string.
This calls XMLNode::toString after adding an xmlDecl and docTypeDecl
o | The ostream to write the string to. |
encode | Whether to URL encode the node values. |
Reimplemented from gnash::XMLNode_as.
References gnash::XMLNode_as::_global, gnash::XMLNode_as::appendChild(), gnash::key::e, gnash::XMLNode_as::Element, gnash::image::end(), gnash::equal(), gnash::XMLNode_as::firstChild(), gnash::XMLNode_as::getNamespaceURI(), gnash::XMLNode_as::getParent(), gnash::key::i, name, gnash::XMLNode_as::nextSibling(), gnash::XMLNode_as::nodeName(), gnash::XMLNode_as::nodeNameSet(), gnash::XMLNode_as::nodeTypeSet(), gnash::XMLNode_as::nodeValueSet(), gnash::key::s, gnash::XMLNode_as::setAttribute(), gnash::XMLNode_as::setNamespaceURI(), gnash::XMLNode_as::Text, gnash::unescapeXML(), XML_MISSING_CLOSE_TAG, XML_MISSING_OPEN_TAG, XML_OK, XML_UNTERMINATED_ATTRIBUTE, XML_UNTERMINATED_CDATA, XML_UNTERMINATED_COMMENT, XML_UNTERMINATED_DOCTYPE_DECL, XML_UNTERMINATED_ELEMENT, and gnash::XMLNode_as::XMLNode_as().
Referenced by ~XML_as().