Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-2007, 10:45 PM
Senior Member
 
Join Date: Jun 2007
Posts: 111
Eric is on a distinguished road
Class to read and parse QIF
I need a class to read and parse QIF (Quicken Interchange Format) files. If anyone knows of such a class I would appreciate a point in the right direction.

Thanks,

Eric
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-01-2007, 10:51 PM
Member
 
Join Date: Jun 2007
Posts: 92
Daniel is on a distinguished road
I think it would probably be better to use the OFX file format (newer).
Same question apllies though.
Greetings.
Daniel
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-01-2007, 10:57 PM
Member
 
Join Date: Jun 2007
Posts: 92
Marcus is on a distinguished road
Hi, You posted the problem yourself, you googled .Luckily the end of this problem is near for developers.
Krugle - Code Search for Developers
I 'm not an expert on your question but I entered the search OFX file parse in krugle.

The class name is ex. OFX1ToXML.java
I hope to help you with this, if I did, please thank krugle..

I copied the class below as a reference:

Code:
/****************************************************************************** * The contents of this file are subject to the Compiere License Version 1.1 * ("License"); You may not use this file except in compliance with the License * You may obtain a copy of the License at <a href="http://www.compiere.org/license.html" target="_blank" rel="nofollow">http://www.compiere.org/license.html</a> * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific language governing rights and limitations under the License. * The Initial Developer is ActFact BV. * Copyright (C) 2003-2004 ActFact BV and Compiere Inc.; All Rights Reserved. * Contributor(s): ______________________________________. *****************************************************************************/ package org.compiere.impexp; import java.io.*; import java.util.logging.*; import org.compiere.util.*; /** * Covert OFX 1XX (SQGML) into valid XML * * SGML BASED OFX 1 compliant data is read from the BufferedReader * passed to init. This class extends InputSream, allowing the * XML compliant output data to be read from it. * * @author Maarten Klinker * @version $Id: OFX1ToXML.java,v 1.4 2006/03/03 10:50:20 graemian Exp $ */ public final class OFX1ToXML extends InputStream implements Runnable { /** Reader object */ private PipedReader m_reader = new PipedReader(); /** Writer object */ private BufferedWriter m_writer; /** Temp String */ private String m_ofx = ""; /** Logger */ private CLogger log = CLogger.getCLogger(getClass()); /** * Constructor for OFX1ToXML * @param is InputStream * @throws IOException */ public OFX1ToXML(InputStream is) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(is)); init(br); } // OFX1ToXML /** * Constructor for OFX1ToXML * @param br BufferedReader * @throws IOException */ public OFX1ToXML(BufferedReader br) throws IOException { init(br); } // OFX1ToXML /** * Method init * @param br BufferedReader * @throws IOException */ public void init(BufferedReader br) throws IOException { m_writer = new BufferedWriter(new PipedWriter(m_reader)); String line = br.readLine(); write("<?xml version=\"1.0\"?>\n"); write("<?OFX "); while(line.indexOf("<") != 0) { if (line.length() > 0) { write(line.replaceAll(":", "=\"") + "\" "); } line = br.readLine(); } write("?>\n"); while(line != null) { m_ofx += line + "\n"; line = br.readLine(); } br.close(); new Thread(this).start(); } //i nit /** * Method run * @see java.lang.Runnable#run() */ public void run() { boolean addCloseTag; int tag2Start; int tagStart; int tagEnd; String tag; String line = ""; try { while(m_ofx != "") { addCloseTag = false; tagStart = m_ofx.indexOf("<"); if (tagStart == -1) { break; } tagEnd = m_ofx.indexOf(">"); if (tagEnd <= tagStart + 1) { throw new IOException("PARSE ERROR: Invalid tag"); } tag = m_ofx.substring(tagStart + 1, tagEnd); if (tag.indexOf(" ") != -1) { throw new IOException("PARSE ERROR: Invalid tag"); } if (!tag.startsWith("/")) { addCloseTag = (m_ofx.indexOf("</"+tag+">") == -1); } tag2Start = m_ofx.indexOf("<", tagEnd); if (m_ofx.indexOf("\n", tagEnd) < tag2Start) { tag2Start = m_ofx.indexOf("\n", tagEnd); } if (tag2Start == -1) { tag2Start = m_ofx.length(); } String data=m_ofx.substring(tagEnd+1, tag2Start); line = m_ofx.substring(0, tagEnd+1)+xmlEncodeTextAsPCDATA(data); m_ofx = m_ofx.substring(tag2Start); if (addCloseTag) { line += "</" + tag + ">"; } write(line); } write(m_ofx); m_writer.close(); } catch (IOException e) { log.log(Level.SEVERE, "Ofx1To2Convertor: IO Exception", e); } } // run /** * Method write * @param str String * @throws IOException */ private void write(String str) throws IOException { m_writer.write(str, 0, str.length()); } // write /** * Method read * @return int * @throws IOException */ public int read() throws IOException { return m_reader.read(); } // read /** * Method read * @param cbuf char[] * @param off int * @param len int * @return int * @throws IOException */ public int read(char[] cbuf, int off, int len) throws IOException { return m_reader.read(cbuf, off, len); } // read /** * Encodes strings for XML */ public final static String xmlEncodeTextAsPCDATA(String text) { if (text == null) return null; char c; StringBuffer n = new StringBuffer(text.length() * 2); for (int i = 0; i < text.length(); i++) { c = text.charAt(i); switch (c) { case '&': n.append("&"); break; case '<': n.append("<"); break; case '>': n.append(">"); break; case '"': n.append("""); break; case '\'': n.append("'"); break; default: { n.append(c); break; } } } return n.toString(); } } //Ofx1To2Convertor
Greetings

Marcus
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SAX Parse bluefloyd8 New To Java 1 01-25-2008 05:57 PM
Using Scanner class to read int Java Tip Java Tips 0 01-18-2008 01:50 PM
Read from console (Scanner Class) hey New To Java 10 12-12-2007 12:11 AM
Using Scanner class to read int value Java Tip Java Tips 0 12-03-2007 11:34 AM
how to parse an xml file oregon XML 3 08-01-2007 06:53 PM


All times are GMT +3. The time now is 04:18 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org