org.apache.openjpa.lib.meta
Class XMLVersionParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.apache.openjpa.lib.meta.XMLMetaDataParser
          extended by org.apache.openjpa.lib.meta.XMLVersionParser
All Implemented Interfaces:
MetaDataParser, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler

public class XMLVersionParser
extends XMLMetaDataParser

Custom non-validating SAX parser which can be used to get the version and schema location attributes from the root node.

Author:
Jeremy Bauer

Field Summary
static String VERSION_1_0
           
static String VERSION_2_0
           
 
Fields inherited from class org.apache.openjpa.lib.meta.XMLMetaDataParser
_extendedNamespace, _openjpaNamespace
 
Constructor Summary
XMLVersionParser(String rootElement)
           
 
Method Summary
protected  void endElement(String name)
          Override this method marking the end of some element.
 String getSchemaLocation()
          Get the string value of the schema location attribute on the root element
 String getVersion()
          Get the string value of the version attribute on the root element
protected  boolean startElement(String name, Attributes attrs)
          Override this method marking the start of some element.
 
Methods inherited from class org.apache.openjpa.lib.meta.XMLMetaDataParser
addComments, addResult, characters, clear, clearDeferredMetaData, comment, currentClassLoader, currentComments, currentDepth, currentLocation, currentText, endCDATA, endDTD, endElement, endEntity, error, fatalError, finish, getClassLoader, getDocType, getException, getException, getException, getLexicalHandler, getLocation, getLog, getOverrideContextClassloader, getParseComments, getParseText, getResults, getSchemaSource, getSourceFile, getSourceIsSystemId, getSourceName, getSuffix, ignoreContent, isCaching, isParsing, isValidating, parse, parse, parse, parse, parse, parse, parsed, parseNewResource, reset, setCaching, setClassLoader, setDocumentLocator, setLexicalHandler, setLocation, setLog, setOverrideContextClassloader, setParseComments, setParseText, setParsing, setSourceIsSystemId, setSuffix, setValidating, startCDATA, startDTD, startElement, startEntity
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_1_0

public static final String VERSION_1_0
See Also:
Constant Field Values

VERSION_2_0

public static final String VERSION_2_0
See Also:
Constant Field Values
Constructor Detail

XMLVersionParser

public XMLVersionParser(String rootElement)
Method Detail

endElement

protected void endElement(String name)
                   throws SAXException
Description copied from class: XMLMetaDataParser
Override this method marking the end of some element.

Specified by:
endElement in class XMLMetaDataParser
Throws:
SAXException

startElement

protected boolean startElement(String name,
                               Attributes attrs)
                        throws SAXException
Description copied from class: XMLMetaDataParser
Override this method marking the start of some element. If this method returns false, the content of the element and the end element event will be ignored.

Specified by:
startElement in class XMLMetaDataParser
Throws:
SAXException

getVersion

public String getVersion()
Get the string value of the version attribute on the root element

Returns:
doc version

getSchemaLocation

public String getSchemaLocation()
Get the string value of the schema location attribute on the root element

Returns:
doc schema location


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.