Type Node
Namespace ImageResizer.Configuration.Xml
No support for namespaces, no intention of eventual serialization.
Everything is case-insensitive, but preserves case. Not thread safe.
Methods
- childrenByName
- clearQueryCache
- deepCopy
- FromXmlFragment
- makeNodeTree
- query
- queryAttr
- queryAttr
- queryFirst
- queryUncached
- setAttr
- setAttr
- ToXmlElement
- ToXmlElement
Properties
Public instance methods
IList<Node> childrenByName(string elementName)
Returns the subset of Children with a matching element name. (Case-insensitive)
void clearQueryCache()
Node deepCopy()
Makes a recusive copy of the subtree, keeping no duplicate references to mutable types.
Node makeNodeTree(string selector)
Traverses the specified path, creating any missing elements along the way. Uses existing nodes if found.
ICollection<Node> query(string selector)
Same as query(), except results are cached until clearQueryCache() is called.
Faster, but can be incorrect if existing nodes are renamed, moved, or deleted.
string queryAttr(string selector)
Queryies the subtree for the specified attribute on the specified element. Example selector: element.element.attrname
Assumes that the last segment of the selector is an attribute name.
Throws an ArgumentException if there is only one segment ( element ).
Uses the cache.
string queryAttr(string nodeSelector, string attrName)
Node queryFirst(string selector)
ICollection<Node> queryUncached(string selector)
void setAttr(string selector, string attrValue)
Sets the specified attribute value, creating parent elements if needed. Clears the query cache.
void setAttr(string nodeSelector, string attrName, string attrValue)
Sets the specified attribute value, creating parent elements if needed. Clears the query cache.
XmlElement ToXmlElement()
XmlElement ToXmlElement(XmlDocument doc)
Public static methods
Public properties
NameValueCollection Attrs get; set;
Attributes
List<Node> Children get; set;
Child nodes
bool IsEmpty get;
Returns true if the element has neither attributes nor children.
string Item get; set;
Access attributes by name
string Name get; set;
The name of the element.
string TextContents get; set;
The concatenated text, significant whitespace, and entity references within this element.
Not XML compliant for sure.