C# Class Treefrog.Framework.XmlHelper

A collection of helper methods for parsing XML trees.
显示文件 Open project: jaquadro/Treefrog

Public Methods

Method Description
CheckAttributes ( XmlReader reader, List reqAttribs ) : string>.Dictionary

Returns a key/value set of all attributes in the element, and checks that an instance of each required key exists in the set.

SwitchAll ( XmlReader reader, string>.Action action ) : void

Read all top-level elements in a sub-tree, invoking an action on each element.

This helper method automatically advances to the next element after executing an element. If the action itself advances the reader, use SwitchAllAdvance instead.

SwitchAllAdvance ( XmlReader reader, Func func ) : void

Read all top-level elements in a sub-tree, invoking an action on each element and conditionally advancing to the next element.

If the action method returns true, this helper method will advance the reader to the next element. Otherwise, it will resume parsing from the reader without automatically advancing.

Method Details

CheckAttributes() public static method

Returns a key/value set of all attributes in the element, and checks that an instance of each required key exists in the set.
public static CheckAttributes ( XmlReader reader, List reqAttribs ) : string>.Dictionary
reader System.Xml.XmlReader An pointing to the element to fetch attributes from.
reqAttribs List A list of all attributes which are required to be present in the element.
return string>.Dictionary

SwitchAll() public static method

Read all top-level elements in a sub-tree, invoking an action on each element.
This helper method automatically advances to the next element after executing an element. If the action itself advances the reader, use SwitchAllAdvance instead.
public static SwitchAll ( XmlReader reader, string>.Action action ) : void
reader System.Xml.XmlReader The to parse from.
action string>.Action A no-return function that takes an and element name as parameters.
return void

SwitchAllAdvance() public static method

Read all top-level elements in a sub-tree, invoking an action on each element and conditionally advancing to the next element.
If the action method returns true, this helper method will advance the reader to the next element. Otherwise, it will resume parsing from the reader without automatically advancing.
public static SwitchAllAdvance ( XmlReader reader, Func func ) : void
reader System.Xml.XmlReader The to parse from.
func Func A function that takes an and element name as parameters, and returns a value indicating whether to advance to the next element.
return void