Using System.xml I can loop through child and parent nodes of an xml file.
Although I'm still a little fuzzy on the term "node" and or "xml element",
What I plan to achieve is to get all the following data from any xml file:
INSIDE BRACKET TEXT:
<insideBracketText>
BRACKET VALUE:
bracketValue</insideBracketText>
ATTRIBUTE NAME:
xmlAttributeName=""
ATTRIBUTE VALUE:
="attributeValue"
As each piece of data is found I will add it to its corresponding List.
Because these xml files are not written by me, these xml files could be
nested or written any number of ways. As a result, using System.xml to my
knowledge can only get me so far with extracting the data this way.
I believe I will not be able to extract all of these things from any random
xml file without using a lot of .Substring() .Index() operations.
I have hundreds of lines of trial code but decided it was too messy and not
worth posting. My spaghetti code gets me 99% there with any xml file but
there's always one or two things not quite right about it.
Moreover, because my code is so excessive the errors are difficult to find.
My initial approach was to concatenate the entire file as a string and break
each line by the right bracket and equal sign to isolate each name and value.
This actually works well for simple xml files, but for more complex xml files
with bracket-attribute nested data (including CDATA bracket tags) it fails.
Simply asking if anyone has any cleaner recommendations for my goal.
My question...
Is there any program or .Net class that can extract these values the way I'm
trying to extract them more efficiently than looping through each line and
performing multiple .Substring() .IndexOf() operations?
Although I'm still a little fuzzy on the term "node" and or "xml element",
What I plan to achieve is to get all the following data from any xml file:
INSIDE BRACKET TEXT:
<insideBracketText>
BRACKET VALUE:
bracketValue</insideBracketText>
ATTRIBUTE NAME:
xmlAttributeName=""
ATTRIBUTE VALUE:
="attributeValue"
As each piece of data is found I will add it to its corresponding List.
Because these xml files are not written by me, these xml files could be
nested or written any number of ways. As a result, using System.xml to my
knowledge can only get me so far with extracting the data this way.
I believe I will not be able to extract all of these things from any random
xml file without using a lot of .Substring() .Index() operations.
I have hundreds of lines of trial code but decided it was too messy and not
worth posting. My spaghetti code gets me 99% there with any xml file but
there's always one or two things not quite right about it.
Moreover, because my code is so excessive the errors are difficult to find.
My initial approach was to concatenate the entire file as a string and break
each line by the right bracket and equal sign to isolate each name and value.
This actually works well for simple xml files, but for more complex xml files
with bracket-attribute nested data (including CDATA bracket tags) it fails.
Simply asking if anyone has any cleaner recommendations for my goal.
My question...
Is there any program or .Net class that can extract these values the way I'm
trying to extract them more efficiently than looping through each line and
performing multiple .Substring() .IndexOf() operations?