View Full Version : How to get inner xml content of a node?
sspbond007
Apr 20, 2009, 05:32 PM
Hi there!
I am parsing a XML file . I am stuck at a specific problem, I can't figure out how to get the whole inner XML of a node.
The node looks like that:
<td><b>this</b> is a <b>test</b></td>
What function do I have to use to get the content of <td> node:
"<b>this</b> is a <b>test</b>"
Thanks....
dejo
Apr 20, 2009, 06:00 PM
Are you using NSXMLParser?
sspbond007
Apr 20, 2009, 11:18 PM
Are you using NSXMLParser?
Yes, I'm Using the NSXMLParser.
dejo
Apr 21, 2009, 12:40 AM
Yes, I'm Using the NSXMLParser.
Then you'll want to set up parser:didStartElement:namespaceURI:qualifiedName:attributes: and parser:didEndElement:namespaceURI:qualifiedName: in your delegate to handle the <td> element. Check out the SeismicXML sample app to learn more about how this technique works.
sspbond007
Apr 21, 2009, 01:50 AM
Then you'll want to set up parser:didStartElement:namespaceURI:qualifiedName:attributes: and parser:didEndElement:namespaceURI:qualifiedName: in your delegate to handle the <td> element. Check out the SeismicXML sample app to learn more about how this technique works.
Yes, I'm doing the same.But
parser:didStartElement:namespaceURI:qualifiedName:attributes: gives the ideaa of current Element and its attribute,
parser:didEndElement:namespaceURI:qualifiedName: tell that the current Elemnt is closed now.
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string : gives the simple text content enclosed by the current Element,
But I actually want the XML content of a Element.
Thanks for reply.
dejo
Apr 21, 2009, 02:00 AM
But I actually want the XML content of a Element.
What do you mean by "XML content"? Like in a DOM or something?
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.