XML-DOM in Objective-C

iconara

Registered
Is anyone interested in a XML Document Object Model framework written in Objective-C? It was inspired largely by JDOM (www.jdom.org). I wrote it for my own curiosity, but I think it could be of use. There seems to be a lack of this for Cocoa, there are a few for C++, but none for ObjC, what I have seen.

Anyone?

It can parse XML-files into DOM-trees with Apples XML-services (from the CoreFoundation), namespaces are a little buggy still, though.

This is what you can do (a trivial example):

Code:
DOMDocument *doc = [[DOMDocument alloc] init];
DOMElement *elem1 = [[DOMElement alloc] initWithName:@"iconara"];
DOMElement *elem2 = [[DOMElement alloc] initWithName:@"monkeyboxing"];

[doc setRootElement:elem1];
[elem1 addContent:elem2];
[elem2 setEmpty:YES];
[elem2 addAttribute:[DOMAttribute attributeWithName:@"foo" Value:@"bar"]];

printf( [[doc toString] cString] );

[elem2 release];
[elem1 release];
[doc release];

and you get:

Code:
<?xml version="1.0"?>

<iconara foo="bar">
    <monkeyboxing/>
</iconara>

I'll post it if you what it.

happy coding

theo
 
Back
Top