eu.xtreemos.xosd.factory.utils.parsers
Class XSDParser

java.lang.Object
  extended by eu.xtreemos.xosd.factory.utils.parsers.XSDParser

public class XSDParser
extends java.lang.Object

Parses the XSD document and generates the code that is used in the XMLSearchEngine.

The code consists of definition of constants and enums.

Author:
danielv
See Also:
XMLSearchEngine

Field Summary
(package private) static org.apache.log4j.Logger logger
           
 
Constructor Summary
XSDParser()
          Default constructor for XSDParser.
 
Method Summary
private  boolean hashtableContainsKey(java.lang.String regexKey, java.util.Hashtable<java.lang.String,java.lang.Object> hash)
          The method checks whether there is any key in the Hashtable matching the regexKey regular expression.
private  java.util.ArrayList hashtableGetValue(java.lang.String regexKey, java.util.Hashtable<java.lang.String,java.lang.Object> hash)
          The method gets an ArrayList corresponding to the matches via regular expression.
private  void loadXSD(org.w3c.dom.Node element, java.util.Hashtable<java.lang.String,java.lang.Object> inHash)
          Parses the XSD document and puts the data into a mixed ArrayList and Hashtable structure.
 java.util.Hashtable<java.lang.String,java.lang.Object> loadXSDSchema(java.lang.String xsdSchemaFile)
          Parses the XSD document and puts the data into a mixed ArrayList and Hashtable structure.
static void main(java.lang.String[] args)
          main method - used for testing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
Constructor Detail

XSDParser

public XSDParser()
Default constructor for XSDParser.

Method Detail

hashtableContainsKey

private boolean hashtableContainsKey(java.lang.String regexKey,
                                     java.util.Hashtable<java.lang.String,java.lang.Object> hash)
The method checks whether there is any key in the Hashtable matching the regexKey regular expression.

Parameters:
regexKey - the regular expression with which the keys should be compared
hash - the hashtable with keys to compare
Returns:
true if there is at least one match; false otherwise
See Also:
expressions: http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html#sum

hashtableGetValue

private java.util.ArrayList hashtableGetValue(java.lang.String regexKey,
                                              java.util.Hashtable<java.lang.String,java.lang.Object> hash)
The method gets an ArrayList corresponding to the matches via regular expression.

Parameters:
regexKey - the regular expression with which the keys should be compared
hash - the hashtable with keys to compare
Returns:
ArrayList with values from the matchin keys; empty ArrayList otherwise
See Also:
expressions: http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html#sum

loadXSD

private void loadXSD(org.w3c.dom.Node element,
                     java.util.Hashtable<java.lang.String,java.lang.Object> inHash)
Parses the XSD document and puts the data into a mixed ArrayList and Hashtable structure. Hashtables (key/value) pairs correspond to the (XML tag/XML value) pairs.

Parameters:
element - the root element of the XSD tree
inHash - the Hashtable for this subtree
See Also:
#loadXSDSchema(String, String)

loadXSDSchema

public java.util.Hashtable<java.lang.String,java.lang.Object> loadXSDSchema(java.lang.String xsdSchemaFile)
                                                                     throws java.io.IOException,
                                                                            org.xml.sax.SAXException
Parses the XSD document and puts the data into a mixed ArrayList and Hashtable structure. Hashtables (key/value) pairs correspond to the (XML tag/XML value) pairs.

Parameters:
xsdSchemaFile - The full path to the XSD document
Returns:
A Hashtable with the parsed XSD
Throws:
java.io.IOException
org.xml.sax.SAXException
See Also:
XMLSearchEngine

main

public static void main(java.lang.String[] args)
main method - used for testing.