<?xml version="1.0" encoding="utf-8"?> <MyBeerJournal> <Brewery name="Founders Brewing Company" location="Grand Rapids, MI"> <Beer name="Centennial" description="IPA" rating="A+" dateSampled="01/02/2011"> "What an excellent IPA. This is the most delicious beer I have ever tasted!" </Beer> </Brewery> <Brewery name="Brewery Vivant" location="Grand Rapids, MI"> <Beer name="Farmhouse Ale" description="Belgian Ale" rating="B" dateSampled="02/07/2015"> This beer is not so good... but I am not that big of a fan of english style ales. </Beer> </Brewery> <Brewery name="Bells Brewery" location="Kalamazoo, MI"> <Beer name="Two Hearted Ale" description="IPA" rating="A" dateSampled="03/15/2012"> Another execllent brew. Two Hearted gives Founders Centennial a run for it's money. </Beer> </Brewery> </MyBeerJournal>
new XMLFile:xml = xml_open("text.xml");
new XMLPointer:pointer = xml_pointer(xml);
xml_pointer_childnode(pointer, "MyBeerJournal");
xml_pointer_childnode(pointer, "Brewery");
xml_pointer_nextnode(pointer);
xml_pointer_childnode(pointer);
xml_pointer_parentnode(pointer);
xml_pointer_attr(pointer);
new tmp[1000], tmp2[1000];
xml_pointer_getname(pointer, tmp);
xml_pointer_getvalue(pointer, tmp2);
printf("%s: %s", tmp, tmp2);
xml_killpointer(pointer);
xml_close(xml);
[19:52:32] XML:: (text.xml) XML File loaded [1] [19:52:32] name: Farmhouse Ale [19:52:32] XML:: XML File unloaded [1]
native XMLFile:xml_open(input[]); // Opens a file
native xml_close(XMLFile:file); // Closes a file
native xml_save(XMLFile:file); // Saves a file
native XMLPointer:xml_pointer(XMLFile:file); // Creates a pointer and points it to document
native XMLPointer:xml_clonepointer(XMLPointer:pointer); // Creates a new pointer based on existing pointer
native xml_killpointer(XMLPointer:pointer); // Destroys a pointer
native xml_pointer_getfilehandle(XMLPointer:pointer); // Gets file handle from pointer
native xml_pointer_getname(XMLPointer:pointer, name[], len = sizeof(name)); // Gets the node/attribute name from given pointer
native xml_pointer_getvalue(XMLPointer:pointer, value[], len = sizeof(value)); // Gets node/attribute value from given pointer
native xml_pointer_getvalue_int(XMLPointer:pointer); // Gets node/attribute value as an int
native xml_pointer_getvalue_float(XMLPointer:pointer); // Gets node/attribute value as a float
native xml_pointer_root(XMLPointer:pointer); // Points pointer to document root
native xml_pointer_childnode(XMLPointer:pointer, node[] = ""); // Points pointer to child node, specifying or not a node name
native xml_pointer_nextnode(XMLPointer:pointer, node[] = ""); // Points pointer to next node at the same height, specifying or not a node name
native xml_pointer_parentnode(XMLPointer:pointer); // Points pointer to parent node, being the pointer currently a node or an attribute
native xml_pointer_childattr(XMLPointer:pointer, attr[] = ""); // Points pointer to a child node
native xml_pointer_nextattr(XMLPointer:pointer, attr[] = ""); // Points pointer to next attribute
native xml_pointer_delete(XMLPointer:pointer); // Delete element pointed by the pointer. Current pointer gets pointed to parent node, or document root
native xml_pointer_appendnode(XMLPointer:pointer, name[], value[]=""); // Appends a child node to current pointer node
native xml_pointer_prependnode(XMLPointer:pointer, name[], value[]=""); // Prepends a child node to current pointer node
Source - GitHubChangelog:
Binary + Include - SolidFiles
Well. Use it, or just don't. Not everyone is YSI dependant and believe me: This one is way faster.
|
What are you trying to prove here? Your XML plugin is superior?
Y_Less spent hundreds, if not, thousands of hours coding YSI. And you don't even know what it is? YSI is dozens of libraries going up and beyond XML... pfft. ****** it, and try using it. Why should I believe you? You're all full of yourself and stuck-up. You have no respect for YSI or its creator, do you? Please, for the sake of my sanity: PROVE IT |
There's no need for YSI if you're using this plugin. |
I'm not bullshitting here, and my job was quite simple and futile - create an interface from a great and fast xml parser to a scripting language with no object orientation support. I'm talking about software interface layering, and not the best algorithm. Or you dare to tell me a pawn script, which is executed by opcodes and native amx functions, passing through dozens of instructions is faster than C++ code compiled to native instructions?
See a nice speed test: Add a little abstract machine overhead and there you go. And about this one: Watch your interpretation: I meant if you're looking for a xml parser and that's it, that's it. I have enough respect for Y_Less and I bet he is alright for what has been said here. Let's keep the argument straight and not turn my topic into a flame war. |