Package org.cip4.jdflib.core
Class XMLParser
java.lang.Object
org.apache.xerces.parsers.XMLParser
org.apache.xerces.parsers.AbstractXMLDocumentParser
org.apache.xerces.parsers.AbstractDOMParser
org.apache.xerces.parsers.DOMParser
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
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanset ignoreNSDefault=true if you do not want any heuristics to be performed regarding DOM level 1 / 2 namespace associationsprotected final org.apache.commons.logging.Logbooleanif true, empty pools and whitespace are removed when parsingprotected Stringstatic booleanFields inherited from class org.apache.xerces.parsers.DOMParser
fUseEntityResolver2, SYMBOL_TABLE, USE_ENTITY_RESOLVER2, XMLGRAMMAR_POOLFields inherited from class org.apache.xerces.parsers.AbstractDOMParser
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, fRejectedElementDepth, fRoot, fSkippedElemStack, fStorePSVI, fStringBuffer, INCLUDE_COMMENTS_FEATURE, INCLUDE_IGNORABLE_WHITESPACE, NAMESPACES, PSVI_DOCUMENT_CLASS_NAMEFields inherited from class org.apache.xerces.parsers.AbstractXMLDocumentParser
fDocumentSource, fDTDContentModelSource, fDTDSourceFields inherited from class org.apache.xerces.parsers.XMLParser
ENTITY_RESOLVER, ERROR_HANDLER, fConfigurationFields inherited from interface org.apache.xerces.xni.XMLDTDContentModelHandler
OCCURS_ONE_OR_MORE, OCCURS_ZERO_OR_MORE, OCCURS_ZERO_OR_ONE, SEPARATOR_CHOICE, SEPARATOR_SEQUENCEFields inherited from interface org.apache.xerces.xni.XMLDTDHandler
CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSchemaLocation(String nsURI, String locationURL) add an additional physical schema locationvoidcleanup()(non-Javadoc) reset all internal variables to a reasonable defaultprotected XMLDocprotected voidinitParser(String schemaLocation, XMLErrorHandler errorHandler) voidparse(InputSource inSource) parse an input sourceparseFile - parse a file specified by strFileparseInputSource(InputSource inSource) parse an input sourceparseStream(InputStream inStream) parseStream - parse a stream specified by inStreamparseString - parse a string specified by stringInputprotected XMLDocrunParser(InputSource inSource, boolean bEraseEmpty) voidsetDocumentClassName(String className) protected voidsetDocumentProperties(KElement root, DocumentXMLImpl memberDocument, String namespaceURI) voidsetErrorHandler(ErrorHandler handler) voidsetInputID(String inputID) set the input id attribute for error loggingvoidsetSchemaLocation(String nsURI, String locationURL) set the physical schema locationvoidstartDocument(org.apache.xerces.xni.XMLLocator locator, String encoding, org.apache.xerces.xni.NamespaceContext namespaceContext, org.apache.xerces.xni.Augmentations augs) toString()Methods inherited from class org.apache.xerces.parsers.DOMParser
getEntityResolver, getErrorHandler, getFeature, getProperty, getXMLParserConfiguration, parse, setEntityResolver, setFeature, setPropertyMethods 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, setLocale, startAttlist, startCDATA, startConditional, startDTD, startElement, startExternalSubset, startGeneralEntity, startParameterEntity, textDecl, unparsedEntityDecl, xmlDeclMethods inherited from class org.apache.xerces.parsers.AbstractXMLDocumentParser
any, element, empty, endContentModel, endGroup, getDocumentSource, getDTDContentModelSource, getDTDSource, occurrence, pcdata, separator, setDocumentSource, setDTDContentModelSource, setDTDSource, startContentModel, startGroupMethods inherited from class org.apache.xerces.parsers.XMLParser
parse
-
Field Details
-
m_ErrorHandler
-
m_SchemaLocation
-
m_lastExcept
-
m_searchStream
public static boolean m_searchStream -
ignoreNSDefault
public boolean ignoreNSDefaultset ignoreNSDefault=true if you do not want any heuristics to be performed regarding DOM level 1 / 2 namespace associations -
m_eraseEmpty
public boolean m_eraseEmptyif true, empty pools and whitespace are removed when parsing -
log
protected final org.apache.commons.logging.Log log
-
-
Constructor Details
-
XMLParser
public XMLParser()default constructor -
XMLParser
Deprecated.- use default constructor- Parameters:
strDocType-
-
XMLParser
- Parameters:
parser-
-
-
Method Details
-
setDocumentClassName
- Overrides:
setDocumentClassNamein classorg.apache.xerces.parsers.AbstractDOMParser
-
getDocumentClass
- Returns:
- the class name
-
parseFile
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
- Parameters:
file-- Returns:
-
parseString
parseString - parse a string specified by stringInput- Parameters:
stringInput- string to parse- Returns:
- JDFDoc or null if parse failed default: parseString(stringInput)
-
parseStream
parseStream - parse a stream specified by inStream- Parameters:
inStream- stream to parse- Returns:
- JDFDoc or null if parse failed default: parseStream(inStream)
-
parse
parse an input source- Overrides:
parsein classorg.apache.xerces.parsers.DOMParser- Parameters:
inSource- the InputSource to parse
-
parseInputSource
parse an input source- Parameters:
inSource- the InputSource to parse- Returns:
- JDFDoc the newly parsed doc
-
initParser
- Parameters:
schemaLocation-errorHandler- default: initParser(null, DocumentJDFImpl.class.getName(), null);
-
setErrorHandler
- Overrides:
setErrorHandlerin classorg.apache.xerces.parsers.DOMParser- See Also:
-
DOMParser.setErrorHandler(org.xml.sax.ErrorHandler)
-
runParser
- Parameters:
inSource-bEraseEmpty-- Returns:
-
getXMLDoc
-
setDocumentProperties
protected void setDocumentProperties(KElement root, DocumentXMLImpl memberDocument, String namespaceURI) -
setSchemaLocation
set the physical schema location- Parameters:
nsURI- the schema namespace urilocationURL- the schema location url
-
addSchemaLocation
add an additional physical schema location- Parameters:
nsURI- the schema namespace urilocationURL- 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:
startDocumentin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
startDocumentin classorg.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()
-
toString
-
setInputID
set the input id attribute for error logging- Parameters:
inputID-
-