Class XMLReader
- java.lang.Object
-
- org.eclipse.persistence.internal.oxm.record.XMLReader
-
- All Implemented Interfaces:
org.xml.sax.XMLReader
- Direct Known Subclasses:
XMLReaderAdapter
public class XMLReader extends java.lang.Object implements org.xml.sax.XMLReaderINTERNAL: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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classXMLReader.ValidatingContentHandlerValidate the SAX events reported to the ContentHandler.
-
Field Summary
Fields Modifier and Type Field Description protected org.xml.sax.Locatorlocatorstatic java.lang.StringNAMESPACE_PREFIXES_FEATUREstatic java.lang.StringREPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE_FEATUREprotected XMLReader.ValidatingContentHandlervalidatingContentHandler
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectconvertValueBasedOnSchemaType(Field xmlField, java.lang.Object value, ConversionManager conversionManager, AbstractUnmarshalRecord record)INTERNAL:org.xml.sax.ContentHandlergetContentHandler()java.lang.ObjectgetCurrentObject(CoreAbstractSession session, Mapping selfRecordMapping)org.xml.sax.DTDHandlergetDTDHandler()org.xml.sax.EntityResolvergetEntityResolver()org.xml.sax.ErrorHandlergetErrorHandler()booleangetFeature(java.lang.String name)org.xml.sax.ext.LexicalHandlergetLexicalHandler()org.xml.sax.LocatorgetLocator()INTERNAL: return the Locator object associated with this readerMediaTypegetMediaType()INTERNAL:chargetNamespaceSeparator()INTERNAL: The character used to separate the prefix and uri portions when namespaces are presentjava.lang.ObjectgetProperty(java.lang.String name)javax.xml.validation.ValidatorHandlergetValidatorHandler()java.lang.ObjectgetValue(java.lang.CharSequence characters, java.lang.Class<?> dataType)This call back mechanism provides an opportunity for the XMLReader to provide an alternate conversion.booleanisInCollection()booleanisNamespaceAware()INTERNAL: Determine if namespaces will be considered during marshal/unmarshal operations.booleanisNullRecord(AbstractNullPolicy nullPolicy, org.xml.sax.Attributes atts, UnmarshalRecord record)booleanisNullRepresentedByXsiNil(AbstractNullPolicy nullPolicy)voidnewObjectEvent(java.lang.Object object, java.lang.Object parent, Mapping selfRecordMapping)voidparse(java.lang.String systemId)voidparse(org.xml.sax.InputSource input)voidsetContentHandler(org.xml.sax.ContentHandler handler)voidsetDTDHandler(org.xml.sax.DTDHandler handler)voidsetEntityResolver(org.xml.sax.EntityResolver resolver)voidsetErrorHandler(org.xml.sax.ErrorHandler handler)voidsetFeature(java.lang.String name, boolean value)voidsetLexicalHandler(org.xml.sax.ext.LexicalHandler lexicalHandler)voidsetLocator(org.xml.sax.Locator newLocator)INTERNAL: set the Locator object to associate with this readervoidsetNamespaceAware(boolean namespaceAware)If set to true, the reader will be aware of namespaces during marshal/unmarsal operations.voidsetNamespaceSeparator(char namespaceSeparator)Sets namespace separator.voidsetProperty(java.lang.String name, java.lang.Object value)voidsetValidatorHandler(javax.xml.validation.ValidatorHandler validatorHandler)
-
-
-
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
-
validatingContentHandler
protected XMLReader.ValidatingContentHandler validatingContentHandler
-
locator
protected org.xml.sax.Locator locator
-
-
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:
getContentHandlerin interfaceorg.xml.sax.XMLReader
-
setContentHandler
public void setContentHandler(org.xml.sax.ContentHandler handler)
- Specified by:
setContentHandlerin interfaceorg.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
-
convertValueBasedOnSchemaType
public java.lang.Object convertValueBasedOnSchemaType(Field xmlField, java.lang.Object value, ConversionManager conversionManager, AbstractUnmarshalRecord record)
INTERNAL:- Since:
- 2.4
-
getDTDHandler
public org.xml.sax.DTDHandler getDTDHandler()
- Specified by:
getDTDHandlerin interfaceorg.xml.sax.XMLReader
-
setDTDHandler
public void setDTDHandler(org.xml.sax.DTDHandler handler)
- Specified by:
setDTDHandlerin interfaceorg.xml.sax.XMLReader
-
setEntityResolver
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
- Specified by:
setEntityResolverin interfaceorg.xml.sax.XMLReader
-
getEntityResolver
public org.xml.sax.EntityResolver getEntityResolver()
- Specified by:
getEntityResolverin interfaceorg.xml.sax.XMLReader
-
getErrorHandler
public org.xml.sax.ErrorHandler getErrorHandler()
- Specified by:
getErrorHandlerin interfaceorg.xml.sax.XMLReader
-
setErrorHandler
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
- Specified by:
setErrorHandlerin interfaceorg.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:
getFeaturein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
setFeature
public void setFeature(java.lang.String name, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException- Specified by:
setFeaturein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
getProperty
public java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException- Specified by:
getPropertyin interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.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:
setPropertyin interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
parse
public void parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXException- Specified by:
parsein interfaceorg.xml.sax.XMLReader- Throws:
java.io.IOExceptionorg.xml.sax.SAXException
-
parse
public void parse(java.lang.String systemId) throws java.io.IOException, org.xml.sax.SAXException- Specified by:
parsein interfaceorg.xml.sax.XMLReader- Throws:
java.io.IOExceptionorg.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)
-
getCurrentObject
public java.lang.Object getCurrentObject(CoreAbstractSession session, 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)
-
isNullRecord
public boolean isNullRecord(AbstractNullPolicy nullPolicy, org.xml.sax.Attributes atts, UnmarshalRecord record)
-
isInCollection
public boolean isInCollection()
-
-