Difference between TouchXML and GDataXML parser - objective-c

I have two options in front of me for parsing really fat XML file,
TouchXML
GDataXML
It's lot of work to do because XML file is very huge. I thought of asking people who have already worked with these parsers.
Which one is better for fat XML files?
I found a blog post which says that TouchXML does not edit/save XML files whereas GDataXML has that feature. What exactly do they mean by edit/save XML file feature?

Lets see if I can answer your questions:
Which one is better for fat XML files? The answer is neither. Both are DOM parsers, which actually load the entire document into memory to make queries faster. If you're parsing a large file, you're better off going with a SAX parser, such as the built-in NSXMLParser, or even the SAX-based version of libxml2.
What exactly do they mean by edit/save XML file feature? Well, suppose you have a XML file that has your app's settings in it. If you open up that file and make changes, you're going to want to save them, right? That's where the writing comes in. The parsers that allow writing let you save the representation of the xml file in the memory into an actual file that can be written to disk.

Related

How to read/edit Parasoft SOATEST .tst file by code or manually?

I need to read the .txt file as raw text or by code to extract the data keyed in the test suite (resource/assertors,....). Is there any way to do that? by code or any editor.
If you have binary format of tst file then there could be a problem, there is no official API to read it.
It's very old format, I don't think that is still in use.
There could be also two, newest, formats of tst:
compressed XML
XML
In case of compressed XML you have to unzip it and then you have access to XML, where you can read it as text file.
In case of XML, it's just XML, you can read it as pure text file.
There is no official API which allows to read it in similar way as SOAtest's GUI to use in code i.e.: in Java.

How to compare and find the differences between two XML files in cocoa?

This is a bit of a two part question, for working with 40mb xml files.
• What’s a reasonable size to store in memory for a program running continually in the background?
• How to find what has changed in an XML file.
So on the first read the XML is loaded into NSData, then uploaded to the server.
Now instead of uploading a 40mb XML every time it changes, I would prefer to upload a “delta” file containing only what has changed. The program would monitor the file for change, and activate when it’s been modified. From what I can see, I would need to parse an old version of the xml file and parse the modified xml file, then compare them? Is it unreasonable to store 80mb in memory like this every time the file is modified?. Now I’m assuming that this has to be done with a DOM parser because I can’t see how you could compare two files like that with a SAX parser since it only has part of the file stored?
I'm a newbie at this so any help would be appreciated!
To compare two files:
There are many ways to do, (As file is to be considered, I may not be correct):
sdiff file1.xml file2.xml A unix command
You can use this command with apple script.
-[NSFileManager contentsEqualAtPath:andPath:]
This method checks to see if two files at given path are the same file, then compares their size, and finally compares their contents.
For other part:
What size is considered for background process, I dont think so, for an application it matters. You can save these into temporary files. Even safari uses 130+ MB as you can easily check through Activity monitor.
NSXMLParser ended up being the most useful for this

Objective C, How to parse local XML file in Resources folder?

I have a XML file in resources folder in xcode and I want to parse the XML..
The question is how to get access to the file programmatically?
Thanks in advance.
NSXMLParser is an event driven xml parser. You can use it but I tend to like query based parsers better. Lib2Xml.
this will get you started with lib2xml
http://cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html
An xml file is the just another text file. This has info on different ways to load xml files.
How to save/load text files in Objective-C for the iPhone, using UITextView?
There are many options. Two of the most popular: use Cocoa's NSXMLParser class, or use TouchXML. If you use NSXMLParser, you'll end up creating a delegate for the parser that decides what to do whenever the parser encounters XML tags, data, etc.

How to modify XML on Objective-C?

I'm working on a project for the iPad, I need to read and write to an xml file, which is also used by the counter part of the application in windows.
The problem that I have is that I've been looking around but I haven't found a way to modify an element or attribute in an xml, without having to build the whole xml again.
I saw this other post, which is basically the same problem that I have, and I also end it up in the same point as the person asking the question, NSXMLParser and TouchXML are read only and do not allowed me to modify my xml.
Any other suggestion about what can I use?
Thanks!

Objective-C libraries for XML Parsing

I would like to know some libraries in objective-C for xml parsing. I think it is a very common need, but I found limited resources for handling this task:
Google Code projects: TouchCode (TouchXML)
NSXMLParser
What is your best solution to work with XML in objective-C language? Please advice.
What is the solution that you have used for your product?
NSXMLParser is a stream-oriented class; you set it up and get delegate callbacks when it detects something. Usually this is not what you want to do, but can be much faster and lower memory.
TouchXML will parse the XML itself using libxml, and create an object tree for the entire XML structure. This allows you to easily access the contents of the XML tree, using manual traversal methods or basic XPaths (more sophisticated XPath support is planned).
It serves a narrow purpose, but if your goal is to parse untidy HTML, you might want to try a static library I started called TagScraper. It doesn't handle many/most XML/HTML entities correctly, but it could be pretty easily patched to. URL: http://github.com/searls/TagScraper
Its value is that it provides a simple XPath mechanism that hides the tidying/querying/assembling for you, and then it provides the parsed elements & attributes in a tree-like data structure of Tag.h nodes.