A C# XML parsing tool
CutFish is a C sharp XML parsing tool. Pass a filename to CutFish and it returns a set of objects wrapping: Element, attribute and values from that specific XML file.
The parser collects the XML on one pass, so it’s very quick.
Tested & Created for: Windows Visual C# (Visual Studio 2008) .net 3.5.
Inner working
XML Elements are encapsulated into an object, directly attached are the XML Attributes. Inner Elements are hold withing a list of inner elements recursively. Per Element there is a reference back to the original wrapping element. So it’s actually some kind of: Dequeue, Deck or Deque of elements. With the one exception of iterating down the ‘tree’ of Elements, and up using a single Element reference.
Schematic approach
XML:
<test>
<inner_one>
<inner_test>Test!</inner_test>
</inner_one>
<inner_two>Test 123</inner_two>
<inner_three>Test 321</inner_three>
</test>
Class Scheme:
RootElement (
test (
inner_one (
inner_test ( Value : ” Test!” ) ),
inner_two ( Value : “Test 123″ ) ,
inner_three ( Value: “Test 321″ )
)
So Element: “inner_test” is located within RootElement, test, and inner_one.
Use ContainElement.GetUpperElement() to iterate up the tree. And loop: ContainElement.Element to iterate down.
Shortcomings
- A valid XML file is required when working with CutFish;
- No XML correction or error checking whatsoever.
Future Expanding
- Future support will include quick creation of XML files (generator).
Source and Windows Download are available now:
