org.cip4.jdflib.core
Class XMLParser

java.lang.Object
  extended by org.apache.xerces.parsers.XMLParser
      extended by org.apache.xerces.parsers.AbstractXMLDocumentParser
          extended by org.apache.xerces.parsers.AbstractDOMParser
              extended by org.apache.xerces.parsers.DOMParser
                  extended by org.cip4.jdflib.core.XMLParser
All Implemented Interfaces:
org.apache.xerces.xni.XMLDocumentHandler, org.apache.xerces.xni.XMLDTDContentModelHandler, org.apache.xerces.xni.XMLDTDHandler
Direct Known Subclasses:
JDFParser

public class XMLParser
extends org.apache.xerces.parsers.DOMParser

Author:
matternk

Field Summary
 boolean ignoreNSDefault
          set ignoreNSDefault=true if you do not want any heuristics to be performed regarding DOM level 1 / 2 namespace associations
protected  org.apache.commons.logging.Log log
           
 boolean m_eraseEmpty
          if true, empty pools and whitespace are removed when parsing
 XMLErrorHandler m_ErrorHandler
           
 Exception m_lastExcept
           
protected  String m_SchemaLocation
           
static boolean m_searchStream
           
 
Fields inherited from class org.apache.xerces.parsers.DOMParser
fUseEntityResolver2, SYMBOL_TABLE, USE_ENTITY_RESOLVER2, XMLGRAMMAR_POOL
 
Fields inherited from class org.apache.xerces.parsers.AbstractDOMParser
ABORT, CORE_DOCUMENT_CLASS_NAME, CREATE_CDATA_NODES_FEATURE, CREATE_ENTITY_REF_NODES, CURRENT_ELEMENT_NODE, DEFAULT_DOCUMENT_CLASS_NAME, DEFER_NODE_EXPANSION, DOCUMENT_CLASS_NAME, fBaseURIStack, fCreateCDATANodes, fCreateEntityRefNodes, fCurrentCDATASection, fCurrentCDATASectionIndex, fCurrentEntityDecl, fCurrentNode, fCurrentNodeIndex, fDeferNodeExpansion, fDeferredDocumentImpl, fDeferredEntityDecl, fDocument, fDocumentClassName, fDocumentImpl, fDocumentIndex, fDocumentType, fDocumentTypeIndex, fDOMFilter, fErrorHandler, fFilterReject, fFirstChunk, fInCDATASection, fIncludeComments, fIncludeIgnorableWhitespace, fInDTD, fInDTDExternalSubset, fInEntityRef, fInternalSubset, fNamespaceAware, fRejectedElement, fRoot, fSkippedElemStack, fStorePSVI, fStringBuffer, INCLUDE_COMMENTS_FEATURE, INCLUDE_IGNORABLE_WHITESPACE, NAMESPACES, PSVI_DOCUMENT_CLASS_NAME
 
Fields inherited from class org.apache.xerces.parsers.AbstractXMLDocumentParser
fDocumentSource, fDTDContentModelSource, fDTDSource
 
Fields inherited from class org.apache.xerces.parsers.XMLParser
ENTITY_RESOLVER, ERROR_HANDLER, fConfiguration
 
Fields inherited from interface org.apache.xerces.xni.XMLDTDHandler
CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE
 
Fields inherited from interface org.apache.xerces.xni.XMLDTDContentModelHandler
OCCURS_ONE_OR_MORE, OCCURS_ZERO_OR_MORE, OCCURS_ZERO_OR_ONE, SEPARATOR_CHOICE, SEPARATOR_SEQUENCE
 
Constructor Summary
XMLParser()
          default constructor
XMLParser(String strDocType)
          Deprecated. - use default constructor
XMLParser(XMLParser parser)
           
 
Method Summary
 void cleanup()
          (non-Javadoc) reset all internal variables to a reasonable default
 String getDocumentClass()
           
protected  XMLDoc getXMLDoc()
           
protected  void initParser(String schemaLocation, XMLErrorHandler errorHandler)
           
 void parse(InputSource inSource)
          parse an input source
 XMLDoc parseFile(File file)
           
 XMLDoc parseFile(String strFile)
          parseFile - parse a file specified by strFile
 XMLDoc parseInputSource(InputSource inSource)
          parse an input source
 XMLDoc parseStream(InputStream inStream)
          parseStream - parse a stream specified by inStream
 XMLDoc parseString(String stringInput)
          parseString - parse a string specified by stringInput
protected  XMLDoc runParser(InputSource inSource, boolean bEraseEmpty)
           
protected  void setDocumentProperties(KElement root, DocumentXMLImpl memberDocument, String namespaceURI)
           
 void setErrorHandler(ErrorHandler handler)
           
 void setSchemaLocation(String nsURI, String locationURL)
          set the physical schema location
 void startDocument(org.apache.xerces.xni.XMLLocator locator, String encoding, org.apache.xerces.xni.NamespaceContext namespaceContext, org.apache.xerces.xni.Augmentations augs)
           
 
Methods inherited from class org.apache.xerces.parsers.DOMParser
getEntityResolver, getErrorHandler, getFeature, getProperty, getXMLParserConfiguration, parse, setEntityResolver, setFeature, setProperty
 
Methods inherited from class org.apache.xerces.parsers.AbstractDOMParser
abort, attributeDecl, characters, comment, createAttrNode, createElementNode, doctypeDecl, dropDocumentReferences, elementDecl, emptyElement, endAttlist, endCDATA, endConditional, endDocument, endDTD, endElement, endExternalSubset, endGeneralEntity, endParameterEntity, externalEntityDecl, getDocument, getDocumentClassName, handleBaseURI, handleBaseURI, ignorableWhitespace, ignoredCharacters, internalEntityDecl, notationDecl, processingInstruction, reset, setCharacterData, setDocumentClassName, setLocale, startAttlist, startCDATA, startConditional, startDTD, startElement, startExternalSubset, startGeneralEntity, startParameterEntity, textDecl, unparsedEntityDecl, xmlDecl
 
Methods inherited from class org.apache.xerces.parsers.AbstractXMLDocumentParser
any, element, empty, endContentModel, endGroup, getDocumentSource, getDTDContentModelSource, getDTDSource, occurrence, pcdata, separator, setDocumentSource, setDTDContentModelSource, setDTDSource, startContentModel, startGroup
 
Methods inherited from class org.apache.xerces.parsers.XMLParser
parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_ErrorHandler

public XMLErrorHandler m_ErrorHandler

m_SchemaLocation

protected String m_SchemaLocation

m_lastExcept

public Exception m_lastExcept

m_searchStream

public static boolean m_searchStream

ignoreNSDefault

public boolean ignoreNSDefault
set ignoreNSDefault=true if you do not want any heuristics to be performed regarding DOM level 1 / 2 namespace associations


m_eraseEmpty

public boolean m_eraseEmpty
if true, empty pools and whitespace are removed when parsing


log

protected org.apache.commons.logging.Log log
Constructor Detail

XMLParser

public XMLParser()
default constructor


XMLParser

@Deprecated
public XMLParser(String strDocType)
Deprecated. - use default constructor

Parameters:
strDocType -

XMLParser

public XMLParser(XMLParser parser)
Parameters:
parser -
Method Detail

getDocumentClass

public String getDocumentClass()
Returns:
the class name

parseFile

public XMLDoc parseFile(String strFile)
parseFile - parse a file specified by strFile

Parameters:
strFile - link to the document to parse, may be either a file path or a url
Returns:
JDFDoc or null if File not found

parseFile

public XMLDoc parseFile(File file)
Parameters:
file -
Returns:

parseString

public XMLDoc parseString(String stringInput)
parseString - parse a string specified by stringInput

Parameters:
stringInput - string to parse
Returns:
JDFDoc or null if parse failed default: parseString(stringInput)

parseStream

public XMLDoc parseStream(InputStream inStream)
parseStream - parse a stream specified by inStream

Parameters:
inStream - stream to parse
Returns:
JDFDoc or null if parse failed default: parseStream(inStream)

parse

public void parse(InputSource inSource)
parse an input source

Overrides:
parse in class org.apache.xerces.parsers.DOMParser
Parameters:
inSource - the InputSource to parse

parseInputSource

public XMLDoc parseInputSource(InputSource inSource)
parse an input source

Parameters:
inSource - the InputSource to parse
Returns:
JDFDoc the newly parsed doc

initParser

protected void initParser(String schemaLocation,
                          XMLErrorHandler errorHandler)
Parameters:
schemaLocation -
errorHandler - default: initParser(null, DocumentJDFImpl.class.getName(), null);

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
Overrides:
setErrorHandler in class org.apache.xerces.parsers.DOMParser
See Also:
DOMParser.setErrorHandler(org.xml.sax.ErrorHandler)

runParser

protected XMLDoc runParser(InputSource inSource,
                           boolean bEraseEmpty)
Parameters:
inSource -
bEraseEmpty -
Returns:

getXMLDoc

protected XMLDoc getXMLDoc()

setDocumentProperties

protected void setDocumentProperties(KElement root,
                                     DocumentXMLImpl memberDocument,
                                     String namespaceURI)

setSchemaLocation

public void setSchemaLocation(String nsURI,
                              String locationURL)
set the physical schema location

Parameters:
nsURI - the schema namespace uri
locationURL - the schema location url

startDocument

public void startDocument(org.apache.xerces.xni.XMLLocator locator,
                          String encoding,
                          org.apache.xerces.xni.NamespaceContext namespaceContext,
                          org.apache.xerces.xni.Augmentations augs)
                   throws org.apache.xerces.xni.XNIException
Specified by:
startDocument in interface org.apache.xerces.xni.XMLDocumentHandler
Overrides:
startDocument in class org.apache.xerces.parsers.AbstractDOMParser
Throws:
org.apache.xerces.xni.XNIException
See Also:
AbstractDOMParser.startDocument(org.apache.xerces.xni.XMLLocator, java.lang.String, org.apache.xerces.xni.NamespaceContext, org.apache.xerces.xni.Augmentations)

cleanup

public void cleanup()
(non-Javadoc) reset all internal variables to a reasonable default

See Also:
AbstractDOMParser.reset()


Copyright © 2013. All Rights Reserved.