[Plugin] [REL] sXML (Skyline.'s XML reader)
#1

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 ;
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 usages;
Example 1: Bank load

Download (.dll + .so + .inc )
Download (source code)
Reply
#2

Great plugin! Will come in handy, but it's not created by you I assume? (Skyline.)
Reply
#3

He uses "Skyline." name in gtaturk.
Reply
#4

If so, well done!
Reply
#5

Overall I like the verbosity of your argument names, but do keep in mind that the "m_" prefix (as used in "m_iAttributeIndex") generally means "member variable" in programming. Since these are arguments and not members of a class (as Pawn doesn't have classes), you may want to revise them.
Reply
#6

Quote:
Originally Posted by RussellK
Посмотреть сообщение
Overall I like the verbosity of your argument names, but do keep in mind that the "m_" prefix (as used in "m_iAttributeIndex") generally means "member variable" in programming. Since these are arguments and not members of a class (as Pawn doesn't have classes), you may want to revise them.
So, It's not a disadvantage for Pawn programmers.Don't need to change names I think.And I love this style, "g_" "m_" look like more good than other styles.
Reply
#7

Its slower than the YINI include?
Reply
#8

better then last one released
Reply
#9

Quote:
Originally Posted by Reboma
Посмотреть сообщение
Its slower than the YINI include?
I don't know but It's very different from Y_XML I think.
Reply
#10

Quote:
Originally Posted by Rancho
Посмотреть сообщение
I don't know but It's very different from Y_XML I think.
How different, is this faster ?
Reply
#11

Quote:
Originally Posted by Rancho
Посмотреть сообщение
I don't know but It's very different from Y_XML I think.
No, i mean YSI:INI, because i now use YSI:INI, but this XML is looks like better, but i dont know, which is the faster.
Reply
#12

I think even Y_XML has some security issues ? What about this one?
Reply
#13

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
I think even Y_XML has some security issues ? What about this one?
What security issuies ? For why?
Reply
#14

Links are broken.. has anyone the source or the .so + .dll and the include?
Reply
#15

PLS, can reupload this plugin pls?
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)