27.08.2012, 10:48
(
Последний раз редактировалось dugi; 27.08.2012 в 14:44.
)
Once upon a time, we used to use XML loader for parsing XML files.But I don't love it ! Because it uses XPath and XPath makes XML sucks.I created this plugin for reading XML files, It's based on TinyXML
Natives ;
Example usages;
Example 1: Bank load
Download (.dll + .so + .inc )
Download (source code)
Natives ;
pawn Код:
/*
* Skyline.'s XML System ...
*/
native xmlCopyFile ( XMLNode: xmlDocument, xmlFileToCopy[] ); // Copy a root node to other xml file
native XMLNode: xmlCreateFile ( xmlFileToCreate[] ); // Create a new xml file with <root />, Returns XMLNodePtr if successfully created, 0 otherwise
native xmlDestroyNode ( XMLNode: nodeToDestroy ); // Destroy a XMLNode
native XMLNode: xmlLoadFile ( xmlFileToLoad[] ); // Load a xml file, Returns XMLNodePtr if successfully created, 0 otherwise
native xmlNodeGetAttribute ( XMLNode: xmlNode, attributeName[], m_szDest[], m_iLen = sizeof m_szDest ); // Copy attribute content to m_szDest
native xmlNodeSetAttribute ( XMLNode: xmlNode, attributeName[], m_szVal[] ); // Set the attribute content
native xmlNodeGetName ( XMLNode: xmlNode, m_szDest[], m_iLen = sizeof m_szDest ); // Copy node tag name to m_szDest
native xmlNodeSetName ( XMLNode: xmlNode, m_szNewName[] ); // Set the nametag for xmlNode
native xmlNodeGetValue ( XMLNode: xmlNode, m_szDest[], m_iLen = sizeof m_szDest ); // Copy the node content to m_szDest
native xmlNodeSetValue ( XMLNode: xmlNode, m_szNewValue[] ); // Set the XML Node content
native xmlSaveFile ( XMLNode: xmlDocument ); // Saves a opened xml file
native xmlUnloadFile ( XMLNode: xmlDocument ); // Closes a opened xml file
native XMLNode: xmlCreateChild ( XMLNode: xmlNode, m_szTag[] ); // Creates a new childnode
native XMLNode: xmlFindChild (XMLNode: xmlNode, m_szTag[], m_iIndex = 0); // Get a XML child at the index
native xmlNodeGetAttributeCount (XMLNode: xmlNode); // Returns attribute count for XML Node
native xmlNodeGetAttributeName ( XMLNode: xmlNode, m_iAttributeIndex, m_szDest[], m_iLen = sizeof m_szDest); // Copy the Attribute name for XMLNode at the index
native xmlNodeGetChildrenCount (XMLNode: xmlNode); // Returns children count for XMLNode
native XMLNode: xmlNodeGetChildren (XMLNode: xmlNode, m_iChildIndex = 0); // Return the xml children at the index
native XMLNode: xmlNodeGetParent ( XMLNode: xmlNode ); // Return the parent child
native xmlGetLastErrorDesc ( m_szDest[], m_iLen = sizeof m_szDest ); // Copy the last error description to m_szDest, It's only in load method now.
native xmlGetLastErrorRow(); // Error, in which row
native xmlGetLastErrorCol(); // Error, in which col
Example 1: Bank load
Download (.dll + .so + .inc )
Download (source code)