How can I parse and update local XML in iOS? - iphone

I am trying to do following task. I know we can read XML in iOS using a parser, but can we locally update the same XML?
1) Read XML from local resource folder.
2) Update XML. Locally change value of a tag.
Thanks for your help.

If you just need to read the XML you can use the native NSXMLParser. If you need to change the XML you can use TouchXML. You can get a good tutorial on how to use TouchXML here. Also interesting discussion of the various options here.

Related

XML generation from data in core data iphone

I am going to make an application and in that I want to store user's input in XML file and then parse it to another user,So I am confuse How can I do it, and which XML method should I use? NSXML parser,libxml,touchXML or KissXML?
I think this link will help you to choose best type of xml parser.
How To Choose The Best XML Parser for Your iPhone Project
Thank You

how to create XML Doc in ios

in my current project i need to create one xml file and send it to server.
i searched many sites a got information about some API like
NSXML (now its deprecated)
http://onlinefreecomputertutorials.blogspot.in/2011/07/how-to-read-and-write-xml-documents.html
GDATAXML (now its deprecated)
http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml
please if is there any API i can use to create xml or you have any idea just share with me or any link for tutorial to create xml in objective c.
thanks for any help.
Use TCMXMLWriter. It's a small XML library with a very nice syntax.

iPhone HTML Parsing using TouchXML and tidy

I'm trying to parse HTML using TouchXML. However, it seems that the data I want to parse (I do not control the source, it's downloaded from the internet) is partially malformed - I get various errors during the parse. Therefore, it seems that I should be using the inbuilt tidy support to fix the HTML but I cannot seem to find any documentation or information on how to enable it or link libtidy successfully into my project.
If anyone has any information on how to do this, it'd be much appreciated. Alternatively if there's another tool I could be using to do this - do tell me!
Actually, you can both link to the framework and include the headers, without needing to download the source.
Link to the existing framework libtidy.dylib
Add /usr/include/tidy to HEADER_SEARCH_PATHS
Turns out that although the framework can be linked in to an xcode project, the headers are missing. I have got around this by downloading the HTML Tidy Source (src and include directory) and added them in to compile as part of my xcode project.

How parse html string in iphone

i m using php file for using data in my application,
in this file i post data on the server and if i get the data from the server
then it is in html formate.
so problem is that i have a string with html tags how i use data in that string.
how i extract data from html string.
Use NSXMLParser class. it works for HTML too. There are three useful delegate methods.
If your HTML out put is some simple data - may be you can write some simple NSString parser your self like 'markhunte' mentioned, if you have large complex data in HTML then you have to go for some open source parsers.
Cocoa does not provide HTML parser, Forum discussion claims in some case XML parser itself work for you, but I never go it working for my data.
In my case I had very simple TAG which I had handled using my own parser using NSString.
I have used the code from --> Flatten-html-content-ie-strip-tags-cocoaobjective-c.
There are also examples of its use on SO.
Just use NSScanner, it is great for searching in between tags that are permanent. If you post some page code I help you set up the scanner.

Tutorial or sample code for parsing xml file using libxml2 in IPhone Application

I just want a tutorial demonstrating the parsing of XML File using libXml2 in Iphone . I found tutorials on TouchXMLand other but not the same for Libxml2
Please help if u can.
Apple has an example iPhone project that parses some simple XML using both NSXMLParser and libxml2 SAX2. You can find the project here:
http://developer.apple.com/iphone/library/samplecode/XMLPerformance/Introduction/Intro.html
Although this isn't exactly a tutorial, it is working code. It runs in the simulator out of the box. Because it accomplishes the same task twice, you should be able to compare the libxml2 code to the NSXMLParser code to figure out what's going on.
Not even these?
I recommend TBXML. I use it everytime I need to parse a XML File. It's really easy to use. ;-)
See here: TBXML Homepage
A good sample is:
http://bill.dudney.net/roller/objc/entry/libxml2_push_parsing