[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

  • From: Paul Miller <stele@f...>
  • To: sml-dev@e..., xml-dev <xml-dev@i...>
  • Date: Sat, 01 Jan 2000 12:50:16 -0500

namespace 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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.