I have a string that starts with an xml element then proceeds with regular text after the Element has ended.
Like so:
<SomeElement SomeAtt="SomeValue><SomeChild/></SomeElement> More random text.
I want to parse the first part into an XElement and then separate out the following text into a string variable. I have considered just counting anglebrackets, but there is legal XML that would throw me off. I would prefer to use the out-of-the-box parsers. I have tried using XmlReader and XElement.Parse method. I would like them to stop after the element is read instead of throwing exceptions because of the unexpected text after the Xml element. I haven't been able to thus far. XmlReader has a ReadSubtree method, but I couldn't get it to work.
Any ideas?
Aucun commentaire:
Enregistrer un commentaire