com.pnp.xfeature.data
Class SchemaParser

java.lang.Object
  extended by com.pnp.xfeature.data.SchemaParser
All Implemented Interfaces:
org.apache.xerces.dom3.DOMErrorHandler

public class SchemaParser
extends java.lang.Object
implements org.apache.xerces.dom3.DOMErrorHandler

This class represents an XML schema. The schema is loaded through the constructor. The method getElements returns elements which can be added.

Author:
Valerio Bürker, Institut für Automatik ETH Zürich

Constructor Summary
SchemaParser(java.lang.String filename)
          Loads an XML schema into memory.
 
Method Summary
 java.util.List getAttributes(java.lang.String element, java.lang.String parentElement)
          Returns a List of Strings containing the attributes for an element.
 java.util.List getElements(java.lang.String parentElement, java.util.List children)
          This method returns a vector of Strings containing the elements that can be added to the XML tree.
 java.lang.String getTargetNamespace()
          Not implemented yet
 boolean handleError(org.apache.xerces.dom3.DOMError error)
          Standard error handler.
 void loadModel(java.lang.String filename)
          This method loads an XML schema into memory.
 java.util.Vector loop(int n, int nmax, int[] counter, java.util.Vector[] temp, java.util.Vector result)
          no comments
 boolean validate(java.lang.String parentElement, java.util.List children)
          This method checks a subtree with a parent element and its children.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaParser

public SchemaParser(java.lang.String filename)
Loads an XML schema into memory.

Parameters:
filename - Absolute path of XML schema.
Method Detail

loadModel

public void loadModel(java.lang.String filename)
This method loads an XML schema into memory.

Parameters:
filename - Absolute path of the XML schema.

getTargetNamespace

public java.lang.String getTargetNamespace()
Not implemented yet


getElements

public java.util.List getElements(java.lang.String parentElement,
                                  java.util.List children)
This method returns a vector of Strings containing the elements that can be added to the XML tree.

Parameters:
parentElement - Element a child is added to.
children - List of Strings containing the children elements which are already there.
Returns:
List of Strings containing the possible elements to be added.

validate

public boolean validate(java.lang.String parentElement,
                        java.util.List children)
This method checks a subtree with a parent element and its children. The subtree does not have to be complete. This means as long as the existing children conform to the schema, the method returns true.

Parameters:
parentElement - Parent Element of the subtree
children - List of Strings containing the children elements which are already there.
Returns:
boolean value indicating whether the subtree is ok.

loop

public java.util.Vector loop(int n,
                             int nmax,
                             int[] counter,
                             java.util.Vector[] temp,
                             java.util.Vector result)
no comments


getAttributes

public java.util.List getAttributes(java.lang.String element,
                                    java.lang.String parentElement)
Returns a List of Strings containing the attributes for an element.

Parameters:
element - name of element
parentElement - name of parent element
Returns:
List of Strings containing the attributes

handleError

public boolean handleError(org.apache.xerces.dom3.DOMError error)
Standard error handler.

Specified by:
handleError in interface org.apache.xerces.dom3.DOMErrorHandler


Copyright © 2004 - 2008 ETH Zurich and P&P Software GmbH, All Rights Reserved.