|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |
Provides a class for wrapping a list of JDOM objects primarily for use in template engines and other kinds of text transformation tools. It has a {@link #toString()} method that will output the XML serialized form of the nodes it contains - again focusing on template engine usage, as well as the {@link #selectNodes(String)} method that helps selecting a different set of nodes starting from the nodes in this list. The class also implements the {@link java.util.List} interface by simply delegating calls to the contained list (the {@link #subList(int, int)} method is implemented by delegating to the contained list and wrapping the returned sublist into a
NodeList).
Constructor Summary | |
---|---|
NodeList() Creates an empty node list. |
|
NodeList(System.Xml.XmlDocument document) Creates a node list that holds a single {@link Document} node. |
|
NodeList(System.Xml.XmlElement element) Creates a node list that holds a single {@link Element} node. |
|
NodeList(object object_Renamed) | |
NodeList(System.Collections.IList nodes) Creates a node list that holds a list of nodes. |
|
NodeList(System.Collections.IList nodes, bool copy) Creates a node list that holds a list of nodes. |
|
NodeList(System.Xml.XmlNodeList list, bool copy) | |
NodeList(System.Xml.XmlAttributeCollection attributes) |
Property Summary | |
---|---|
int | Count |
bool | IsFixedSize |
bool | IsReadOnly |
bool | IsSynchronized |
object | Item[int index] |
System.Collections.IList |
List
Retrieves the underlying list used to store the nodes. Note however, that you can fully use the underlying list through the Listinterface of this class itself. You would probably access the underlying list only for synchronization purposes. |
object | SyncRoot |
Method Summary | |
---|---|
int | Add(object o) |
void | Clear() |
object |
Clone() Returns a NodeList that contains the same nodes as this node list. @throws CloneNotSupportedException if the contained list's class does not have an accessible no-arg constructor. |
bool | Contains(object value) |
void | CopyTo(System.Array array, int index) |
bool |
Equals(object o) Tests for equality with another object. |
System.Collections.IEnumerator | GetEnumerator() |
int |
GetHashCode() Returns the hash code of the contained list. |
int | IndexOf(object value) |
void | Insert(int index, object value) |
void | Remove(object value) |
void | RemoveAt(int index) |
NVelocity.NAnt.Anakia.NodeList |
selectNodes(string xpathString) Applies an XPath expression to the node list and returns the resulting node list. In order for this method to work, your application must have access to werken.xpath library classes. The implementation does cache the parsed format of XPath expressions in a weak hash map, keyed by the string representation of the XPath expression. As the string object passed as the argument is usually kept in the parsed template, this ensures that each XPath expression is parsed only once during the lifetime of the template that first invoked it. |
string |
ToString() This method returns the string resulting from concatenation of string representations of its nodes. Each node is rendered using its XML serialization format. This greatly simplifies creating XML-transformation templates, as to output a node contained in variable x as XML fragment, you simply write ${x} in the template (or whatever your template engine uses as its expression syntax). |
Methods inherited from class System.Object |
---|
Finalize, GetType, MemberwiseClone |
Constructor Detail |
---|
public NodeList()
Creates an empty node list.
public NodeList(System.Xml.XmlDocument document)
Creates a node list that holds a single {@link Document} node.
public NodeList(System.Xml.XmlElement element)
Creates a node list that holds a single {@link Element} node.
public NodeList(object object_Renamed)
public NodeList(System.Collections.IList nodes)
Creates a node list that holds a list of nodes.
Parameters:
nodes
- the list of nodes this template should hold. The created
template will copy the passed nodes list, so changes to the passed list
will not affect the model.
public NodeList(System.Collections.IList nodes, bool copy)
Creates a node list that holds a list of nodes.
Parameters:
nodes
- the list of nodes this template should hold.copy
- if true, the created template will copy the passed nodes
list, so changes to the passed list will not affect the model. If false,
the model will reference the passed list and will sense changes in it,
altough no operations on the list will be synchronized.
public NodeList(System.Xml.XmlNodeList list, bool copy)
public NodeList(System.Xml.XmlAttributeCollection attributes)
Property Detail |
---|
public int Count
public bool IsFixedSize
public bool IsReadOnly
public bool IsSynchronized
public object this[int index]
public System.Collections.IList List
Retrieves the underlying list used to store the nodes. Note however, that you can fully use the underlying list through the
Listinterface of this class itself. You would probably access the underlying list only for synchronization purposes.
public object SyncRoot
Method Detail |
---|
public int Add(object o)
public void Clear()
public object Clone()
Returns a NodeList that contains the same nodes as this node list. @throws CloneNotSupportedException if the contained list's class does not have an accessible no-arg constructor.
public bool Contains(object value)
public void CopyTo(System.Array array, int index)
public bool Equals(object o)
Tests for equality with another object.
Parameters:
o
- the object to test for equality
public System.Collections.IEnumerator GetEnumerator()
public int GetHashCode()
Returns the hash code of the contained list.
public int IndexOf(object value)
public void Insert(int index, object value)
public void Remove(object value)
public void RemoveAt(int index)
public NVelocity.NAnt.Anakia.NodeList selectNodes(string xpathString)
Applies an XPath expression to the node list and returns the resulting node list. In order for this method to work, your application must have access to werken.xpath library classes. The implementation does cache the parsed format of XPath expressions in a weak hash map, keyed by the string representation of the XPath expression. As the string object passed as the argument is usually kept in the parsed template, this ensures that each XPath expression is parsed only once during the lifetime of the template that first invoked it.
Parameters:
xpathExpression
- the XPath expression you wish to applypublic string ToString()
This method returns the string resulting from concatenation of string representations of its nodes. Each node is rendered using its XML serialization format. This greatly simplifies creating XML-transformation templates, as to output a node contained in variable x as XML fragment, you simply write ${x} in the template (or whatever your template engine uses as its expression syntax).
|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |