edu.ucsb.nceas.metaedit
Class IBMParser

java.lang.Object
  |
  +--edu.ucsb.nceas.metaedit.IBMParser

public class IBMParser
extends java.lang.Object
implements ParserDriver

Implementation of the ParserDriver interface for the IBM XML parser (xml4j).

Version:
0.9Beta
Author:
Matthew Jones, Rudolf Nottrott, Zheng Wang

Constructor Summary
IBMParser(java.lang.String openOrNew, java.lang.String documentDOMRootName, java.lang.String filenameOrURL, MetaEditor editor)
          Construct a new IBMParser with the given DTD filename.
 
Method Summary
 void appendElement(org.w3c.dom.Element selectedTreeElement, org.w3c.dom.Element chosenElementToAppend)
           
 edu.ucsb.nceas.metaedit.TXElement createElement(java.lang.String ElementName)
           
 edu.ucsb.nceas.metaedit.TXText createTextNode(java.lang.String data, boolean ignorable)
           
 java.util.Vector getAppendableElements(ElementFactory.TreeElement selectedTreeElement)
          Create a Vector of names that are appendable as children on the element specified in selectedTreeElement.
 java.util.Vector getAppendablesInProperOrder(ElementFactory.TreeElement selectedTreeElement)
           
 java.lang.String getContentModelString(ElementFactory.TreeElement treeElement)
           
 int getContentType(java.lang.String elementName)
          Determine the content type for a given element type.
 org.w3c.dom.Document getDocumentDOM()
           
 javax.swing.JTree getDocumentJTree()
          getDocumentTree returns the JTree to the MetaDoc for display.
 edu.ucsb.nceas.metaedit.DTD getDTD()
           
 java.util.Enumeration getDTDAttrDecls(ElementFactory.TreeElement selectedTreeElement)
          Determine the attributes declared in the DTD for a given node.
 java.util.Vector getInsertableBefore(ElementFactory.TreeElement selectedTreeElement)
          Creates a Vector of element names that are insertable as siblings after the element that is specified in selectedTreeElement.
 edu.ucsb.nceas.metaedit.TXAttribute[] getTagAttrDeclsArray(ElementFactory.TreeElement selectedTreeElement)
           
 void insertElement(ElementFactory.TreeElement selectedTreeElement, ElementFactory.TreeElement chosenElementToInsert)
           
 void removeElement(ElementFactory.TreeElement selectedTreeElement)
           
 org.w3c.dom.Node validateElement(ElementFactory.TreeElement treeElement)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IBMParser

public IBMParser(java.lang.String openOrNew,
                 java.lang.String documentDOMRootName,
                 java.lang.String filenameOrURL,
                 MetaEditor editor)
          throws java.lang.Exception
Construct a new IBMParser with the given DTD filename.
Parameters:
file - the filename of the DTD to be loaded
Method Detail

createElement

public edu.ucsb.nceas.metaedit.TXElement createElement(java.lang.String ElementName)
Specified by:
createElement in interface ParserDriver

createTextNode

public edu.ucsb.nceas.metaedit.TXText createTextNode(java.lang.String data,
                                                     boolean ignorable)
Specified by:
createTextNode in interface ParserDriver

appendElement

public void appendElement(org.w3c.dom.Element selectedTreeElement,
                          org.w3c.dom.Element chosenElementToAppend)
Specified by:
appendElement in interface ParserDriver

insertElement

public void insertElement(ElementFactory.TreeElement selectedTreeElement,
                          ElementFactory.TreeElement chosenElementToInsert)
Specified by:
insertElement in interface ParserDriver

removeElement

public void removeElement(ElementFactory.TreeElement selectedTreeElement)
Specified by:
removeElement in interface ParserDriver

validateElement

public org.w3c.dom.Node validateElement(ElementFactory.TreeElement treeElement)
Specified by:
validateElement in interface ParserDriver

getContentModelString

public java.lang.String getContentModelString(ElementFactory.TreeElement treeElement)
Specified by:
getContentModelString in interface ParserDriver

getDocumentJTree

public javax.swing.JTree getDocumentJTree()
getDocumentTree returns the JTree to the MetaDoc for display.
Specified by:
getDocumentJTree in interface ParserDriver

getDocumentDOM

public org.w3c.dom.Document getDocumentDOM()
Specified by:
getDocumentDOM in interface ParserDriver

getAppendableElements

public java.util.Vector getAppendableElements(ElementFactory.TreeElement selectedTreeElement)
Create a Vector of names that are appendable as children on the element specified in selectedTreeElement.
Specified by:
getAppendableElements in interface ParserDriver
Parameters:
selectedTreeElement - the element for which allowable children are being determined
Returns:
a vector of strings with the names of allowable children nodes

getAppendablesInProperOrder

public java.util.Vector getAppendablesInProperOrder(ElementFactory.TreeElement selectedTreeElement)
Specified by:
getAppendablesInProperOrder in interface ParserDriver

getInsertableBefore

public java.util.Vector getInsertableBefore(ElementFactory.TreeElement selectedTreeElement)
Creates a Vector of element names that are insertable as siblings after the element that is specified in selectedTreeElement.
Specified by:
getInsertableBefore in interface ParserDriver
Parameters:
selectedTreeElement - the element for which allowable siblings are being determined
Returns:
a vector of strings with the names of allowable sibling elements, or null if we are at the root element

getDTDAttrDecls

public java.util.Enumeration getDTDAttrDecls(ElementFactory.TreeElement selectedTreeElement)
Determine the attributes declared in the DTD for a given node. Note that this returns a data type that is specific to the IBM parser -- a BIG PROBLEM!
Specified by:
getDTDAttrDecls in interface ParserDriver
Parameters:
pare - the node for which the attribute declartions apply
Returns:
a Hashtable of attribute definitions

getTagAttrDeclsArray

public edu.ucsb.nceas.metaedit.TXAttribute[] getTagAttrDeclsArray(ElementFactory.TreeElement selectedTreeElement)
Specified by:
getTagAttrDeclsArray in interface ParserDriver

getContentType

public int getContentType(java.lang.String elementName)
Determine the content type for a given element type. NEED TO FIX THIS TO USE OUR ELEMENT TYPE CONSTANTS
Specified by:
getContentType in interface ParserDriver
Parameters:
elementName - the element name to look up
Returns:
integer indicating the content type

getDTD

public edu.ucsb.nceas.metaedit.DTD getDTD()
Specified by:
getDTD in interface ParserDriver


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.