@API(type=EXTENDABLE,
src=PRIVATE)
public class Context
extends java.lang.Object
implements java.lang.Cloneable
ContextElement
up to the root.
These represent the ancestors of the element for which the Context
was built.ContextElement
representing the siblings
of the element for which the Context
was built. Context
was built.Modifier and Type | Field and Description |
---|---|
protected java.util.Stack<ContextElement> |
elementStack
The stack with the
ContextElement objects,
ancestors of the element for which the Context was built. |
protected java.util.List<ro.sync.xml.parser.IDValue> |
idValuesList
The ID values list.
|
protected ro.sync.contentcompletion.xml.AdditionalContextInformationProvider |
infoProvider
Creates a full SAX source over the document and other useful methods.
|
protected java.util.List<ContextElement> |
nextSiblingElements
The list of
ContextElement objects representing the next siblings
(in document order) of the element for which the Context was built. |
protected ProxyNamespaceMapping |
prefixNamespaceMapping
The mapping between namespace prefixes and URI's determined to the point
where the
Context was built. |
protected java.util.List<ContextElement> |
previousSiblingElements
The list of
ContextElement objects representing the previous siblings
(in document order) of the element for which the Context was built. |
protected org.xml.sax.XMLReader |
xmlReader
The
XMLReader used to create sources
for executing XPath expressions in the Context . |
Constructor and Description |
---|
Context() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
java.lang.String |
computeContextXPathExpression()
Takes the position in the document where the content completion was invoked
and converts it to an XPath expression that contains the path of elements.
|
java.util.List<java.lang.String> |
executeXPath(java.lang.String expression,
java.lang.String[] prefixNamespaceMappings)
Executes an XPath 2.0 expression over a simplified version of the entire document, containing no text nodes for faster processing.
|
java.util.List |
executeXPath(java.lang.String expression,
java.lang.String[] prefixNamespaceMappings,
boolean useFullDocumentContent)
Executes an XPath 2.0 expression over the current document.
|
java.lang.String |
getDefaultAttributeValue(ContextElement elementContext,
java.lang.String attributeName)
Returns the default value for the specified attribute and context element.
|
java.util.Stack<ContextElement> |
getElementStack()
Gets the stack of
ContextElement representing the ancestors of the element
for which the Context was built. |
java.util.List<ro.sync.xml.parser.IDValue> |
getIdValuesList() |
java.util.List<ContextElement> |
getNextSiblingElements()
Get the list of next sibling elements of the element the
Context was built for. |
ProxyNamespaceMapping |
getPrefixNamespaceMapping()
Gets the mapping between namespace prefixes and URI's to the point
the
Context was built. |
java.util.List<ContextElement> |
getPreviousSiblingElements()
Get the list of previous sibling elements of the element the
Context was built for. |
Attribute[] |
getRootAttributes()
Get the list with the attributes of the root element.
|
java.lang.String |
getSystemID()
Get the system ID of the current document for which the context has been built..
|
void |
pushContextElement(ContextElement element,
java.util.List<ContextElement> previousSiblingElements)
Updates the context by adding the given element in the context.
|
void |
setAdditionalContextInformationProvider(ro.sync.contentcompletion.xml.AdditionalContextInformationProvider infoProvider)
Set the
AdditionalContextInformationProvider used for creating a SAX source and other useful stuff. |
void |
setElementStack(java.util.Stack<ContextElement> elementStack)
Sets the stack consisting of
ContextElement representing the ancestor elements
of the element for which the Context was built. |
void |
setIdValuesList(java.util.List<ro.sync.xml.parser.IDValue> idValuesList) |
void |
setNextSiblingElements(java.util.List<ContextElement> nextSiblingElements)
Sets the list of
ContextElement representing the next siblings (in document order)
of the element the Context was built for. |
void |
setPrefixNamespaceMapping(ProxyNamespaceMapping prefixNamespaceMapping)
Sets the mapping between the namespace prefixes and URI's to the point where
the
Context was built. |
void |
setPreviousSiblingElements(java.util.List<ContextElement> previousSiblingElements)
Sets the list of
ContextElement representing the previous siblings (in document order)
of the element the Context was built for. |
void |
setXMLReader(org.xml.sax.XMLReader xmlReader)
Set the
XMLReader used for creating a SAX source. |
protected java.util.Stack<ContextElement> elementStack
ContextElement
objects,
ancestors of the element for which the Context
was built.protected ProxyNamespaceMapping prefixNamespaceMapping
Context
was built.protected java.util.List<ContextElement> previousSiblingElements
ContextElement
objects representing the previous siblings
(in document order) of the element for which the Context
was built.protected java.util.List<ContextElement> nextSiblingElements
ContextElement
objects representing the next siblings
(in document order) of the element for which the Context
was built.protected org.xml.sax.XMLReader xmlReader
XMLReader
used to create sources
for executing XPath expressions in the Context
.protected ro.sync.contentcompletion.xml.AdditionalContextInformationProvider infoProvider
protected java.util.List<ro.sync.xml.parser.IDValue> idValuesList
public void setElementStack(java.util.Stack<ContextElement> elementStack)
ContextElement
representing the ancestor elements
of the element for which the Context
was built.
The root is always added the first on the stack.elementStack
- The stack of ancestor ContextElement
.public java.util.Stack<ContextElement> getElementStack()
ContextElement
representing the ancestors of the element
for which the Context
was built.
The root is always added the first on the stack.ContextElement
.public void setPrefixNamespaceMapping(ProxyNamespaceMapping prefixNamespaceMapping)
Context
was built.prefixNamespaceMapping
- The new mapping to be set.public ProxyNamespaceMapping getPrefixNamespaceMapping()
Context
was built.public Attribute[] getRootAttributes()
Attribute
objects
representing the attributes of the root element.public void setPreviousSiblingElements(java.util.List<ContextElement> previousSiblingElements)
ContextElement
representing the previous siblings (in document order)
of the element the Context
was built for.previousSiblingElements
- The list of previous sibling ContextElement
.public java.util.List<ContextElement> getPreviousSiblingElements()
Context
was built for.ContextElement
, null
or empty list
if no previous siblings
exist for the current element.public void setNextSiblingElements(java.util.List<ContextElement> nextSiblingElements)
ContextElement
representing the next siblings (in document order)
of the element the Context
was built for.nextSiblingElements
- The list of next sibling ContextElement
.public java.util.List<ContextElement> getNextSiblingElements()
Context
was built for.ContextElement
, null
or empty list
if no next siblings
exist for the current element.public java.util.List<java.lang.String> executeXPath(java.lang.String expression, java.lang.String[] prefixNamespaceMappings)
expression
- The XPath expression to be executed.prefixNamespaceMappings
- An array of prefixes followed by namespace URI's
representing the namespace mappings to the point of the Context
.
null
.public java.util.List executeXPath(java.lang.String expression, java.lang.String[] prefixNamespaceMappings, boolean useFullDocumentContent)
expression
- The XPath expression to be executed.prefixNamespaceMappings
- An array of prefixes followed by namespace URI's
representing the namespace mappings to the point of the Context
.
useFullDocumentContent
- If false
the XML Reader over which the XPath is run does not contain any text nodes so this method is useful only
for gathering attribute values which adhere to certain conditions (like //@id). if true
the reader will contain the entire XML document's information
making it possible to also gather element values for example.null
.public void setXMLReader(org.xml.sax.XMLReader xmlReader)
XMLReader
used for creating a SAX source. The content completion
proposals for XSD and XSL documents are obtained by running XPath queries
on this SAX source.xmlReader
- The new XMLReader
.public void setAdditionalContextInformationProvider(ro.sync.contentcompletion.xml.AdditionalContextInformationProvider infoProvider)
AdditionalContextInformationProvider
used for creating a SAX source and other useful stuff.infoProvider
- The new AdditionalContextInformationProvider
.public void pushContextElement(ContextElement element, java.util.List<ContextElement> previousSiblingElements)
element
- Context element to be added.previousSiblingElements
- Previous siblings for the new insert position. They are children of the given element
and the insertion position is after them.public java.lang.Object clone()
clone
in class java.lang.Object
Object.clone()
public void setIdValuesList(java.util.List<ro.sync.xml.parser.IDValue> idValuesList)
idValuesList
- The list of string values representing all ID's collected from the XML document.public java.util.List<ro.sync.xml.parser.IDValue> getIdValuesList()
public java.lang.String getSystemID()
public java.lang.String computeContextXPathExpression()
public java.lang.String getDefaultAttributeValue(ContextElement elementContext, java.lang.String attributeName)
elementContext
- The context element.attributeName
- The name of the attribute.© Copyright SyncRO Soft SRL 2002 - 2016. All rights reserved.