Class XMLReader

  • All Implemented Interfaces:
    org.xml.sax.XMLReader
    Direct Known Subclasses:
    XMLReaderAdapter

    public class XMLReader
    extends java.lang.Object
    implements org.xml.sax.XMLReader
    INTERNAL:

    Purpose:Provide a wrapper for an org.xml.sax.XMLReader instance and define some extra event methods that can be used by TopLink during the unmarshal process. These events are no ops in this class, but may be overridden in subclasses.

    Responsibilities

    • Wrap an instance of org.xml.sax.XMLReader and provide all the required API
    • Provide empty implementations of some callback methods that can be overridden in subclasses
    Since:
    release specific (what release of product did this appear in)
    Author:
    mmacivor
    See Also:
    DOMReader
    • Field Detail

      • NAMESPACE_PREFIXES_FEATURE

        public static final java.lang.String NAMESPACE_PREFIXES_FEATURE
        See Also:
        Constant Field Values
      • REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE_FEATURE

        public static final java.lang.String REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE_FEATURE
        See Also:
        Constant Field Values
      • locator

        protected org.xml.sax.Locator locator
    • Constructor Detail

      • XMLReader

        public XMLReader​(org.xml.sax.XMLReader internalReader)
      • XMLReader

        public XMLReader()
    • Method Detail

      • getLocator

        public org.xml.sax.Locator getLocator()
        INTERNAL: return the Locator object associated with this reader
        Since:
        2.4
      • setLocator

        public void setLocator​(org.xml.sax.Locator newLocator)
        INTERNAL: set the Locator object to associate with this reader
        Since:
        2.4
      • getContentHandler

        public org.xml.sax.ContentHandler getContentHandler()
        Specified by:
        getContentHandler in interface org.xml.sax.XMLReader
      • setContentHandler

        public void setContentHandler​(org.xml.sax.ContentHandler handler)
        Specified by:
        setContentHandler in interface org.xml.sax.XMLReader
      • isNamespaceAware

        public boolean isNamespaceAware()
        INTERNAL: Determine if namespaces will be considered during marshal/unmarshal operations.
        Since:
        2.4
      • setNamespaceAware

        public void setNamespaceAware​(boolean namespaceAware)
        If set to true, the reader will be aware of namespaces during marshal/unmarsal operations.
        Parameters:
        namespaceAware - if reader should be namespace aware
        Since:
        2.6.0
      • getNamespaceSeparator

        public char getNamespaceSeparator()
        INTERNAL: The character used to separate the prefix and uri portions when namespaces are present
        Since:
        2.4
      • setNamespaceSeparator

        public void setNamespaceSeparator​(char namespaceSeparator)
        Sets namespace separator.
        Parameters:
        namespaceSeparator - namespace separator
        Since:
        2.6.0
      • getMediaType

        public MediaType getMediaType()
        INTERNAL:
        Returns:
        The MediaType associated with this reader
      • getDTDHandler

        public org.xml.sax.DTDHandler getDTDHandler()
        Specified by:
        getDTDHandler in interface org.xml.sax.XMLReader
      • setDTDHandler

        public void setDTDHandler​(org.xml.sax.DTDHandler handler)
        Specified by:
        setDTDHandler in interface org.xml.sax.XMLReader
      • setEntityResolver

        public void setEntityResolver​(org.xml.sax.EntityResolver resolver)
        Specified by:
        setEntityResolver in interface org.xml.sax.XMLReader
      • getEntityResolver

        public org.xml.sax.EntityResolver getEntityResolver()
        Specified by:
        getEntityResolver in interface org.xml.sax.XMLReader
      • getErrorHandler

        public org.xml.sax.ErrorHandler getErrorHandler()
        Specified by:
        getErrorHandler in interface org.xml.sax.XMLReader
      • setErrorHandler

        public void setErrorHandler​(org.xml.sax.ErrorHandler handler)
        Specified by:
        setErrorHandler in interface org.xml.sax.XMLReader
      • getLexicalHandler

        public org.xml.sax.ext.LexicalHandler getLexicalHandler()
      • setLexicalHandler

        public void setLexicalHandler​(org.xml.sax.ext.LexicalHandler lexicalHandler)
      • getFeature

        public boolean getFeature​(java.lang.String name)
                           throws org.xml.sax.SAXNotRecognizedException,
                                  org.xml.sax.SAXNotSupportedException
        Specified by:
        getFeature in interface org.xml.sax.XMLReader
        Throws:
        org.xml.sax.SAXNotRecognizedException
        org.xml.sax.SAXNotSupportedException
      • setFeature

        public void setFeature​(java.lang.String name,
                               boolean value)
                        throws org.xml.sax.SAXNotRecognizedException,
                               org.xml.sax.SAXNotSupportedException
        Specified by:
        setFeature in interface org.xml.sax.XMLReader
        Throws:
        org.xml.sax.SAXNotRecognizedException
        org.xml.sax.SAXNotSupportedException
      • getProperty

        public java.lang.Object getProperty​(java.lang.String name)
                                     throws org.xml.sax.SAXNotRecognizedException,
                                            org.xml.sax.SAXNotSupportedException
        Specified by:
        getProperty in interface org.xml.sax.XMLReader
        Throws:
        org.xml.sax.SAXNotRecognizedException
        org.xml.sax.SAXNotSupportedException
      • setProperty

        public void setProperty​(java.lang.String name,
                                java.lang.Object value)
                         throws org.xml.sax.SAXNotRecognizedException,
                                org.xml.sax.SAXNotSupportedException
        Specified by:
        setProperty in interface org.xml.sax.XMLReader
        Throws:
        org.xml.sax.SAXNotRecognizedException
        org.xml.sax.SAXNotSupportedException
      • parse

        public void parse​(org.xml.sax.InputSource input)
                   throws java.io.IOException,
                          org.xml.sax.SAXException
        Specified by:
        parse in interface org.xml.sax.XMLReader
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
      • parse

        public void parse​(java.lang.String systemId)
                   throws java.io.IOException,
                          org.xml.sax.SAXException
        Specified by:
        parse in interface org.xml.sax.XMLReader
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
      • setValidatorHandler

        public void setValidatorHandler​(javax.xml.validation.ValidatorHandler validatorHandler)
      • getValidatorHandler

        public javax.xml.validation.ValidatorHandler getValidatorHandler()
      • newObjectEvent

        public void newObjectEvent​(java.lang.Object object,
                                   java.lang.Object parent,
                                   Mapping selfRecordMapping)
      • getValue

        public java.lang.Object getValue​(java.lang.CharSequence characters,
                                         java.lang.Class<?> dataType)
        This call back mechanism provides an opportunity for the XMLReader to provide an alternate conversion. This optimization is currently only leveraged for properties annotated with @XmlInlineBinaryData.
        Parameters:
        characters - The characters to be converted.
        dataType - The type to be converted to.
        Returns:
        The converted value
      • isNullRepresentedByXsiNil

        public boolean isNullRepresentedByXsiNil​(AbstractNullPolicy nullPolicy)
      • isInCollection

        public boolean isInCollection()