Parsing OFX or SGML in iOS - ios

How do I parse OFX in iOS? OFX is formatted in SGML, and I can't find any good parsers to use in C or Objective-C on iOS.

Try using libofx. It depends on OpenJADE for SGML but I've gotten them both to compile and work on iOS.

There are a few challenges here:
(1) OFX 1.x documents are SGML-based, while 2.x documents are XML-based, so if you know you will only deal with 2.x documents you could probably use an XML parser.
(2) If you do have to deal with 1.x documents, you'll have some code-lifting ahead of you. SGML in general and OFX 1.x in particular do not enforce close tags for simple types. That means you'll see things like:
<INVACCTFROM>
<BROKERID>Fidelity Investments
<ACCTID>FidRoth
</INVACCTFROM>
Parsing this kind of thing will be tricky unless you provide your own schema logic, or pre-process the data to a more "valid" format. An example of the latter, while not in C/Obj-C/C++, is given on Scott Hanselman's blog.
Good resources on OFX can be found here.

Related

Parsing .osm XML data to get Lon/lat coordinates

What's the most efficient parsing method/technique to store, track and associate the associated Nodes and Refs for Polygons while parsing OpenStreetMap (.osm XML) file formats?
This is asked with an iOS Objective-C mobile environment in mind. Thank you.
If there is no pretty good reason, you should rely on the existing work of others and make use of existing OSM XML/PBF parsers that do also some abstraction for you: https://wiki.openstreetmap.org/wiki/Frameworks

Unipaas extracting a XML

Is someone tried to extract XML to "Unipass" Programming Language? I've read a XML file then put it on a blob virtual, From there i want i get the data inside .
<patient>
<name>
<given>Henry</given>
<family>Sovelen</family>
<suffix>The 6th</suffix>
</name>
<administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1"/>
<birthTime value="19320924"/>
</patient>
Can someone teach me how to get the value 'Henry' Using unipaas programming language and btw i also used .xsl for stylesheet for that one
UniPaas (previously know as Magic, or eDeveloper, or xpa) is able to read XML directly. XML is one of data sources available for UniPaas; there are gateways for MSSQL Server, Oracle, DB2, MySQL and finally ODBC (which covers pretty much all other sources).
Luckily for you, no need to install support for XML, it's in UniPaas by default.
Since you are new to UniPaas and data sources, I'd recommend to see this video.
Once you have XML connected, you can use APG (automatic program generator) feature to quickly generate simple export-import program.
I'd strongly advice to install "On-line" samples, in Chapter 14 you can find example for XML data (see image below).
Let me know if you need more detail. UniPaas is really powerful tool, but it's "strange kind of animal" and can be confusing at the start.

iOS - Differences about NSXMLParser and libxml2

better-performance-with-libxml2-or-nsxmlparser-on-the-iphone
I've read that question and the answer about comparation of XML parser on iOS Apps Development. Well, actually i don't get what the point is.
My questions is, if I want to get and load huge XML data on my apps, larger than 200kb, what the best I could use..? is it NSXMLParser or libxml2..?
btw, I'm using Xcode 4.2 on iOS 5
I have used this resource in the past:
How To Choose The Best XML Parser for Your iPhone Project
The post summarizes the differences between a number of different XML parsers for iOS.
What's wrong with the accepted answer to that question?
Basically, #zPesk says :
libxml was found to be a bit faster but harder to use because it's in C instead of objective-c.
I don't think it matters that much as long as you use SAX parsing instead of DOM parsing - the last thing you want to do with an XML document that big is to load it into memory all at once!

Blackberry development: how to get XMLReader SAXParser

I'm looking to port my working Android XML parser to Blackberry, but the latter's Java feature set isn't as rich? I didn't want to have to write two parsers.
The following code yields "The method getXMLReader() is undefined for the type SAXParser":
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
Am I just out of luck here?
It's true I am trying to use org.xml.sax. I've read all the XML parsing discussions I can find out there. I wonder now if I can do this? Should I be using org.kxml2 instead because org.xml.sax makes no sense in BlackBerry land?
Thanks for any advice!
Russ
You don't need to use the getXmlReader() method.
Now that you have your SAXParser use it to parse a document or stream.
SaxParserFactory spf = SaxParerFacter.newInstance();
SAXParser parser = spf.newSAXParser();
Open your stream or file and call and assign it to a variable. Let's call ours input.
parser.parse(input, handler)
The handler file will implement all of the call backs to handle the events the parser encounters.
I found this explanation of SAX to be quite helpful.
I'll answer this though I suspect there are others who know better.
My assessment of BlackBerry is that it's very poor in its API set. So, the SAX XML parser isn't available as it is on Android. Okay, that's cool. It's older and from a "smaller" time.
Worse though, it appears very challenging even to add a third-party library to a BlackBerry application. I followed various posts out there and failed to incorporate my own "third-party" JAR convincingly into a BlackBerry project despite the collective wisdom of a number of web pages on the topic.
I was thinking then of writing my own parsing engine to replace SAXParser.parse(). How hard could it be since my expectations for it are childishly simple?
Very hard indeed since it appears that the JavaME support for java.lang.Class is impoverished as well; it doesn't support the important reflection methods such as getDeclaredMethods() for use in creating the engine (into which I naturally wanted to plug my existing XML parser-handler).
Alas, this makes me wonder just what BlackBerry apps out there are able to do? I'm probably giving this world short shrift, but a couple of days were sufficient for me to go from zero to parsing XML texts off the web on Android, so I expected a very easy time of it here too.
Please feel free to shred my answer. If you can and do, especially if you add a real one, it will doubtless greatly benefit other folk new to BlackBerry development including me later when I come back to the problem (so that I can avoid brute-force stringing through the XML stream instead of cleanly parsing it).

TIGER shapefiles - using and interpreting

I know of the US GIS TIGER file format from years ago, but have never used it.
I'm very shortly going to need to very quickly implement simple geocoding and vector graphics of roads and other features.
Where do I go for information - are there tutorials, example queries, etc?
Are there other ways to include geocoding and basic mapping in a mobile (no internet) device?
-Adam
As far as I'm aware of, there aren't many applications that make use of the TIGER/Line format directly. Most apps use TIGER files that have been translated into ESRI's shapefile format.
Edited to add:
Is there information on ESRI's format available?
There's an ESRI whitepaper describing the file format.
If you're planning to use shapefiles in an application, there are various libraries out there.
The OpenStreetMap project imported TIGER data, you might find useful code snippets there. See the TIGER page on the OpenStreetMap wiki for more information and links

Resources