Search code examples
c#arraysxmlparsinggraphml

C# split XML InnerText


I have a .graphml file which is based on the XML data format but allows us to represent graph structures. My problem is that I have many InnerText Elements in one Node and need to split them into an array.

...<y:AttributeLabel xml:space="preserve">+Name +Age -Id</y:AttributeLabel>...

From this example, I need +Name, +Age and -Id separately stored in an array. Can anyone help me out?

Btw the .graphml file is huge.


Solution

  • string splitOn = @"[\s+-]+";
    
    string[] stringArray= Regex.Split(InnerText, splitOn);