[xml] Creating XMLElement from XML String



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?.

Thanks,
- Apparao Mulpuri.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]