org.realtor.rets.util
Class CompactParser

java.lang.Object
  |
  +--org.realtor.rets.util.CompactParser

public class CompactParser
extends java.lang.Object

CompactParser.java Created Aug 1, 2003 This is a lightweight parser for RETS compact messages. It scans the compact message and loads the keys and values into its internal data structure. The data can then be iterated over by calling the nextColumn() method. Copyright 2003, Avantia inc.

Version:
$Revision: 1.1 $
Author:
scohen

Field Summary
private  java.lang.String delimiter
           
private  java.util.Iterator iter
           
private  java.util.LinkedHashMap map
           
 
Constructor Summary
CompactParser()
           
CompactParser(java.lang.String rawXML)
           
CompactParser(java.lang.String rawCompact, java.lang.String metadataXML)
           
 
Method Summary
private  java.lang.String getAttribute(java.lang.String attributeName, java.lang.String tag)
           
 java.util.Vector getColumns()
          Returns a Vector conaining the names of the columns.
 java.lang.String getData(java.lang.String key)
          Returns the data contained in the column name represented by the String key
 java.util.Map getMapping()
           
private  java.lang.String getTag(java.lang.String tagName, java.lang.String xml)
           
private  java.lang.String getTagBody(java.lang.String tagName, java.lang.String xml)
           
static CompactParser getTestInstance()
           
 boolean hasMoreColumns()
          Tests whether or not there are more columns in the iteration.
static void main(java.lang.String[] args)
           
private  void map(java.lang.String columns, java.lang.String data)
           
 java.lang.String nextColumn()
          Get the next column in the sequence.
private  void parse(java.lang.String xml)
           
 void reset()
          resets the iterator to start at the first column
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delimiter

private java.lang.String delimiter

map

private java.util.LinkedHashMap map

iter

private java.util.Iterator iter
Constructor Detail

CompactParser

public CompactParser()

CompactParser

public CompactParser(java.lang.String rawXML)

CompactParser

public CompactParser(java.lang.String rawCompact,
                     java.lang.String metadataXML)
Method Detail

reset

public void reset()
resets the iterator to start at the first column


getColumns

public java.util.Vector getColumns()
Returns a Vector conaining the names of the columns.

Returns:
The names of the columns.

hasMoreColumns

public boolean hasMoreColumns()
Tests whether or not there are more columns in the iteration.

Returns:
true if there are more columns waiting, false if there aren't.

nextColumn

public java.lang.String nextColumn()
Get the next column in the sequence.

Returns:
A string whose value is the name of the next column, or null if there aren't any more columns.

getData

public java.lang.String getData(java.lang.String key)
Returns the data contained in the column name represented by the String key

Parameters:
key - The name of the column whose data you wish to examine.
Returns:
The data contained in the column, or null if no data is present.

parse

private void parse(java.lang.String xml)

getTag

private java.lang.String getTag(java.lang.String tagName,
                                java.lang.String xml)

getTagBody

private java.lang.String getTagBody(java.lang.String tagName,
                                    java.lang.String xml)

getAttribute

private java.lang.String getAttribute(java.lang.String attributeName,
                                      java.lang.String tag)

map

private void map(java.lang.String columns,
                 java.lang.String data)

getMapping

public java.util.Map getMapping()

getTestInstance

public static CompactParser getTestInstance()

main

public static void main(java.lang.String[] args)


Copyright © 2002 National Association of Realtors - All Rights Reserved.