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

    Fields
    Modifier and Type
    Field
    Description
    boolean
    set ignoreNSDefault=true if you do not want any heuristics to be performed regarding DOM level 1 / 2 namespace associations
    protected final org.apache.commons.logging.Log
     
    boolean
    if true, empty pools and whitespace are removed when parsing
     
     
    protected String
     
    static boolean
     

    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

    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_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.XMLDTDContentModelHandler

    OCCURS_ONE_OR_MORE, OCCURS_ZERO_OR_MORE, OCCURS_ZERO_OR_ONE, SEPARATOR_CHOICE, SEPARATOR_SEQUENCE

    Fields inherited from interface org.apache.xerces.xni.XMLDTDHandler

    CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE
  • Constructor Summary

    Constructors
    Constructor
    Description
    default constructor
    XMLParser(String strDocType)
    Deprecated.
    - use default constructor
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addSchemaLocation(String nsURI, String locationURL)
    add an additional physical schema location
    void
    (non-Javadoc) reset all internal variables to a reasonable default
     
    protected XMLDoc
     
    protected void
    initParser(String schemaLocation, XMLErrorHandler errorHandler)
     
    void
    parse(InputSource inSource)
    parse an input source
     
    parseFile(String strFile)
    parseFile - parse a file specified by strFile
    parse an input source
    parseStream - parse a stream specified by inStream
    parseString - parse a string specified by stringInput
    protected XMLDoc
    runParser(InputSource inSource, boolean bEraseEmpty)
     
    void
     
    protected void
    setDocumentProperties(KElement root, DocumentXMLImpl memberDocument, String namespaceURI)
     
    void
     
    void
    setInputID(String inputID)
    set the input id attribute for error logging
    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, 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, wait, wait, wait
  • Field Details

    • 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 final org.apache.commons.logging.Log log
  • Constructor Details

    • 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 Details

    • setDocumentClassName

      public void setDocumentClassName(String className)
      Overrides:
      setDocumentClassName in class org.apache.xerces.parsers.AbstractDOMParser
    • 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 s)
      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
    • addSchemaLocation

      public void addSchemaLocation(String nsURI, String locationURL)
      add an additional 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()
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • setInputID

      public void setInputID(String inputID)
      set the input id attribute for error logging
      Parameters:
      inputID -