Getting the Value of XElement including tags
I have an XElement and I want to get its value, including any child elements of it expressed as tags.
So for example, I have
And I want to get
1<a>2</a>3
as a string.
What's an easy way to do that?10 Replies
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
Then it's a bad example I guess. Idk enough of the xml standard to see why that's wrong.
This is the real xml https://raw.githubusercontent.com/EverestAPI/Everest/dev/lib-stripped/Celeste.xml
I'll have an XElement for one of the <member> elements and I want to get anything inside it
XmlDocument has InnerXml for a node, in XElement there should be something similar
maybe you can do node.ToString()?
Hmm, ToString() kind of works. I could take all the child nodes, ToString them and concat together
I could also switch to XmlDocument tbh
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
Might be, although it seems like your first suggestion wouldn't let me take the innerXML (or equivalent) as a string
I did a little research into the second option when I started this but didn't find anything immediate, I'll check a little harder though
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
Yeah, so I took a look at DocFx, they're just using XElement and have a ton of code that I don't need at all for my use-case. I ended up just switching my existing approach to XmlDocument and it seems to work pretty well
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
I'm not sure what the benefit would I be since my approach is already working, and their code is tailored to their use case and would need to be altered a bunch