W
WTH
In C++ I had, long ago, written my own XML parsing class as I never found
even a half decent node based hierarchical solution that was simple, now
that I'm starting to develop tools in C# (as a precursor to moving our NT
services, COM/DCOM, and client apps into C#) I'm wondering if there's
something like this out there.
For example, to use my CXMLNode class you could just do this:
CXMLNode l_oRoot;
if( false == l_oRoot.Parse( in_strXML ) )
{
MessageBox( NULL, _T("You gave me crappy XML"), _T("XML be ungood"),
MB_OK );
return false;
}
//How many child nodes in this XML structure?
long l_nChildren = l_oRoot.GetNumberOfChildren();
//Get first node we have (the node used to start parsing XML is just a root
node/container for the 'real' XML nodes)
CXMLNode* l_pNode = l_oRoot.GetChild(0);
//Get an attribute off of this node
tstring l_strMyAttribute = l_pNode->GetAttribute( "MyAttribute" );
//Get a text value off this node if it has one
tstring l_strValue = l_pNode->GetTextValue();
//Find a child node from this node named MyHardToFindNode
CXMLNode* l_pNode2 = l_pNode->FindChildNode( "MyHardToFindNode" );
Et cetera, ad nauseum...
Is there something like this already in C# or am I heading for
"porting-ville"?
WTH
even a half decent node based hierarchical solution that was simple, now
that I'm starting to develop tools in C# (as a precursor to moving our NT
services, COM/DCOM, and client apps into C#) I'm wondering if there's
something like this out there.
For example, to use my CXMLNode class you could just do this:
CXMLNode l_oRoot;
if( false == l_oRoot.Parse( in_strXML ) )
{
MessageBox( NULL, _T("You gave me crappy XML"), _T("XML be ungood"),
MB_OK );
return false;
}
//How many child nodes in this XML structure?
long l_nChildren = l_oRoot.GetNumberOfChildren();
//Get first node we have (the node used to start parsing XML is just a root
node/container for the 'real' XML nodes)
CXMLNode* l_pNode = l_oRoot.GetChild(0);
//Get an attribute off of this node
tstring l_strMyAttribute = l_pNode->GetAttribute( "MyAttribute" );
//Get a text value off this node if it has one
tstring l_strValue = l_pNode->GetTextValue();
//Find a child node from this node named MyHardToFindNode
CXMLNode* l_pNode2 = l_pNode->FindChildNode( "MyHardToFindNode" );
Et cetera, ad nauseum...
Is there something like this already in C# or am I heading for
"porting-ville"?
WTH