[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] ANNOUNCE: XMLIO 0.5 with C and C++ implementation
XMLIO is my lightweight library for generating and processing SML/XML streams in C or C++ applications where application data structures or configuration settings are stored as XML syntax. The latest version is completely rewritten in C, with the C++ API layered over that (but using exceptions, references, and in the XML:: namespace). The XML input processor (XML_Input and XML::Input) is a hybrid push/pull model where specific element handlers are specified for each level of a nested object hierarchy. When a desired element is encounted, a callback handler is called (like with a push model), but it is up to the handler to pull what it needs (either data or more subelements). If nothing is requested, the entire element is skipped. Because element processing is performed on the stack and unused elements are thrown away immediately, there is no memory overhead during processing, making it extremely efficient. Intrinsic data types (including ints, floats, doubles, booleans, strings, and list enums) corresponding to object member data can automatically be processed and stored at the correct address in the object. Custom processors can be easily written to handle custom element data. Here is an example on how to process the following XML syntax into some sample objects: <Circle> <Center>(100,100)</Center> <Radius>50</Radius> </Circle> typedef struct Point_ { int x, y; } Point; XML_Error Read_Point(XML_Element *elem, Point *p) { XML_Char data[40]; size_t len = sizeof(data) / sizeof(XML_Char); XML_Error error = XML_ElementReadData(elem, data, &len); data[len] = 0; if (sscanf(data, "(%dx%d)", &p->x, &p->y) != 2) return XML_Error_InvalidValue; return error; } typedef struct Circle_ { Point center; int radius; } Circle; XML_Error Read_Circle(XML_Element *elem, Circle *circle) { const XML_Handler handlers[] = { XML_ELEMENT_HANDLER_MEMBER("Center", Read_Point, Circle, center), XML_INT_HANDLER("Radius", Circle, radius), XML_HANDLER_END }; return XML_ElementProcess(elem, handlers, circle); } Please see the README at http://www.fxtech.com/xmlio for complete details. -- Paul Miller - stele@f... xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1 To unsubscribe, mailto:majordomo@i... the following message; unsubscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|