org.inria.ns.reflex.xml.dom
Class DOMContext

java.lang.Object
  extended by org.inria.ns.reflex.processor.xcl.xml.XMLContext
      extended by org.inria.ns.reflex.xml.dom.DOMContext
All Implemented Interfaces:
Iterable, Collection, List, XMLListener

public class DOMContext
extends XMLContext
implements XMLListener

A DOMContext keeps alive a complete DOM tree.

It tracks the current node to which the content have to be added.

Author:
Philippe Poulard
See Also:
XMLContext.newXMLContext(DataSet)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.xcl.xml.XMLContext
XMLContext.Guard
 
Field Summary
 Evaluable evaluable
          An evaluable that can apply some operations on an element after it has been imported and before appending it ; the only object applyable on this evaluable is Element.
 
Fields inherited from interface org.inria.ns.reflex.xml.XMLListener
DUMMY_LISTENER
 
Constructor Summary
DOMContext(XMLContext.Guard guard)
          Create a new DOM context with a DOMFragment as context node.
 
Method Summary
 void addXML(Object xml)
          Add an XML object to this context (the current node or a list of node).
 boolean convertSAXToDOM(XMLReader reader)
          Indicate to convert SAX to DOM.
 void nodeAppended(Node childNode)
          Update the current node with the given node if it is an element, comment, text, or PI.
 void textUpdated(Text text)
          Do nothing.
 
Methods inherited from class org.inria.ns.reflex.processor.xcl.xml.XMLContext
add, add, addAll, addAll, attributeAdded, attributeValueUpdated, clear, commentUpdated, contains, containsAll, equals, get, getNode, getRootNode, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, newXMLContext, processingInstructionUpdated, remove, remove, removeAll, retainAll, set, setAttributeAsContext, setContainerAsContext, setNode, size, subList, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.inria.ns.reflex.xml.XMLListener
attributeAdded, attributeValueUpdated, commentUpdated, processingInstructionUpdated
 

Field Detail

evaluable

public Evaluable evaluable
An evaluable that can apply some operations on an element after it has been imported and before appending it ; the only object applyable on this evaluable is Element. By default, it is null.

Constructor Detail

DOMContext

public DOMContext(XMLContext.Guard guard)
Create a new DOM context with a DOMFragment as context node.

Parameters:
guard - A guard that protects the creation of this context.
See Also:
XMLContext.newXMLContext(DataSet), DOMFragment
Method Detail

addXML

public void addXML(Object xml)
Add an XML object to this context (the current node or a list of node).

If it is an element or an attribute, it is also set as the current node of this context.

Parameters:
xml - An object.
See Also:
XMLContext.addXML(java.lang.Object)

nodeAppended

public void nodeAppended(Node childNode)
Update the current node with the given node if it is an element, comment, text, or PI.

Specified by:
nodeAppended in interface XMLListener
Parameters:
childNode - The new context node.
See Also:
XMLListener.nodeAppended(org.w3c.dom.Node)

convertSAXToDOM

public boolean convertSAXToDOM(XMLReader reader)
                        throws ExecutionException,
                               SAXException
Indicate to convert SAX to DOM.

Specified by:
convertSAXToDOM in interface XMLListener
Parameters:
reader - Unused.
Returns:
true
Throws:
ExecutionException
SAXException - When the input document can't be parsed.
See Also:
XMLListener.convertSAXToDOM(org.xml.sax.XMLReader)

textUpdated

public void textUpdated(Text text)
Do nothing.

Specified by:
textUpdated in interface XMLListener
Parameters:
text - Unused.
See Also:
XMLListener.textUpdated(org.w3c.dom.Text)