Re: [xml] Creating XMLElement from XML String
- From: Daniel Veillard <veillard redhat com>
- To: Apparao Mulpuri <apparao forums gmail com>
- Cc: xml gnome org
- Subject: Re: [xml] Creating XMLElement from XML String
- Date: Thu, 25 Sep 2008 17:23:31 +0200
On Sat, Sep 20, 2008 at 10:30:45AM +0530, Apparao Mulpuri wrote:
Hi List,
I am trying to create a XMLElement form a XMLString. Here is the
method implementation in Apple Mac OS X which is not working:
- (id)initWithXMLString:(NSString *)string error:(NSError **)error
xmlDocPtr _xmlDoc = xmlParseDoc((xmlChar *)[string UTF8String]);
NSLog(@"_xmlDoc::%s",_xmlDoc); --- it returns NULL here
if (_xmlDoc != NULL)
{
elementNode = xmlDocGetRootElement(_xmlDoc);
// elementNode is xmlNodePtr type
xmlFreeDoc(_xmlDoc);
}
}
return self;
}
Is there any problem with the above code. Is there any function
available for creating element node from xmlString?.
XML parsing is not defined outside of document parsing, so you're
on a very undefined corner case for many reasons, your best bet is
xmlParseInNodeContext
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]