@NotThreadSafe public abstract class DocumentLoader extends Object implements XMLElement.Factory
Modifier and Type | Field and Description |
---|---|
static Pattern |
ID_PATTERN
ID pattern.
|
static char |
ID_PREFIX
ID prefix.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addPrefixNames(String[][] prefixNames)
Adds prefix names.
|
protected Optional<? extends Entity> |
getEntity(String key,
String prefix)
Gets a locally registered Entity.
|
protected String |
getPrefixName(String prefix)
Gets the name corresponding to a prefix.
|
protected DocumentLoader.RootHandler |
getRootHandler()
Gets a root handler.
|
protected abstract String |
getRootName()
Gets the root element name for this document.
|
protected Logger |
getThisLogger()
Gets the document logger.
|
protected abstract URL |
getURL()
Gets the URL for this document.
|
protected void |
handle(String name,
DocumentElementLoader loader)
Specifies a handler for an XML element.
|
protected boolean |
loadFrom(String from,
Optional<Reader> reader)
Loads this document from the specified location with a supplied reader.
|
XMLElement |
newXMLElement(String name)
Returns a new element.
|
protected boolean |
read(String xml)
Reads the document from an XML string.
|
protected void |
setEntities(Optional<HashMap<String,Entity>> entities)
Sets the entities.
|
protected void |
setSubstitutionDeferred(boolean substitutionDeferred)
Sets the deferred substitution indicator.
|
protected void |
setSubstitutionEnabled(boolean substitutionEnabled)
Sets the variable substitution indicator.
|
protected abstract void |
setURL(URL url)
Sets the URL for this document.
|
void |
setValidating(boolean validating)
Sets the validating indicator.
|
public static final Pattern ID_PATTERN
public static final char ID_PREFIX
public XMLElement newXMLElement(String name)
newXMLElement
in interface XMLElement.Factory
name
- The element's name.public void setValidating(boolean validating)
validating
- The validating indicator.protected final void addPrefixNames(@Nonnull String[][] prefixNames)
prefixNames
- An array of prefix-name tuples.@Nonnull @CheckReturnValue protected final Optional<? extends Entity> getEntity(@Nonnull String key, @Nonnull String prefix)
key
- The Entity name.prefix
- The prefix associated with the Entity class.@Nonnull @CheckReturnValue protected final String getPrefixName(@Nonnull String prefix)
prefix
- The prefix.@Nonnull @CheckReturnValue protected DocumentLoader.RootHandler getRootHandler()
@Nonnull @CheckReturnValue protected abstract String getRootName()
@Nonnull @CheckReturnValue protected final Logger getThisLogger()
@Nonnull @CheckReturnValue protected abstract URL getURL()
protected final void handle(@Nonnull String name, @Nonnull DocumentElementLoader loader)
name
- The element name.loader
- The entry object that will handle the element.@CheckReturnValue protected boolean loadFrom(@Nonnull String from, @Nonnull Optional<Reader> reader)
from
- The location to load from.reader
- The optional reader.@CheckReturnValue protected boolean read(@Nonnull String xml)
xml
- The XML string.protected final void setEntities(@Nonnull Optional<HashMap<String,Entity>> entities)
entities
- The optional entities.protected final void setSubstitutionDeferred(boolean substitutionDeferred)
substitutionDeferred
- True if variables substitution should be
deferred.protected final void setSubstitutionEnabled(boolean substitutionEnabled)
substitutionEnabled
- True if variables should be substituted.protected abstract void setURL(@Nonnull URL url)
url
- The URL.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.