public final class XIncluder extends Object implements XInclusionContext
XInclusionScheme
s,
allowing to process or update inclusions.
Modifier and Type | Field and Description |
---|---|
XInclusionScheme[] |
xInclusionSchemes
Schemes of the XInclusions to be processed.
|
Constructor and Description |
---|
XIncluder(XInclusionScheme[] xInclusionSchemes)
Constructs an XIncluder allowing to process inclusions belonging to the
specified schemes.
|
Modifier and Type | Method and Description |
---|---|
Element |
findElementById(Document document,
String id)
Searches specified document for an element having specified ID.
|
Document |
getDocument(URL url)
Opens and returns the document corresponding to specified URL.
|
boolean |
process(Tree tree,
List<Node[]> replacements,
Console console,
List<LoadError> loadErrors,
List<LoadError> loadWarnings)
Process inclusions found in specified document subtree.
|
boolean |
update(Document[] documents,
Console console,
List<LoadError> loadErrors,
List<LoadError> loadWarnings)
Update marked inclusions found in specified documents.
|
public final XInclusionScheme[] xInclusionSchemes
public XIncluder(XInclusionScheme[] xInclusionSchemes)
xInclusionSchemes
- schemes of the XInclusions to be processed.
Inclusions belonging to schemes not listed here are ignored by this
XIncluder.public boolean process(Tree tree, List<Node[]> replacements, Console console, List<LoadError> loadErrors, List<LoadError> loadWarnings)
tree
- Document subtree possibly containing inclusions.replacements
- The replacements which have been performed are
appended to this list. May be null
.
This list will contain pairs of arrays of Nodes. First array contains the Nodes which specify the inclusion directive. Second array contains the replacement, that is included, Nodes.
console
- Console used to report verbose and debug messages. May
be null
.loadErrors
- Inclusion errors are appended to this list. May be
null
.loadWarnings
- Inclusion warnings are appended to this list. May
be null
.true
if inclusions have been found and processed
in specified document subtree; false
otherwise.update(com.xmlmind.xml.doc.Document[], com.xmlmind.util.Console, java.util.List<com.xmlmind.xml.load.LoadError>, java.util.List<com.xmlmind.xml.load.LoadError>)
public boolean update(Document[] documents, Console console, List<LoadError> loadErrors, List<LoadError> loadWarnings)
All inclusions marked for update are automatically unmarked at the end of this update process.
This method generates InclusionUpdatedEvent
events.
documents
- An array of documents possibly containing inclusions
marked for update.console
- Console used to report verbose and debug messages. May
be null
.loadErrors
- Inclusion errors are appended to this list. May be
null
.loadWarnings
- Inclusion warnings are appended to this list. May
be null
.XInclusion.setMarkedForUpdate(boolean)
,
process(com.xmlmind.xml.doc.Tree, java.util.List<com.xmlmind.xml.doc.Node[]>, com.xmlmind.util.Console, java.util.List<com.xmlmind.xml.load.LoadError>, java.util.List<com.xmlmind.xml.load.LoadError>)
public Document getDocument(URL url) throws InclusionException
XInclusionContext
getDocument
in interface XInclusionContext
url
- URL of the documentInclusionException
- if, for any reason,
specified document cannot be openedpublic Element findElementById(Document document, String id)
XInclusionContext
findElementById
in interface XInclusionContext
document
- document to be searchedid
- searched IDnull
if such element is not found