How to read XmlElement contents

How do I read the text “hello” in this Element

“<“name type=“word”>hello”<”/name">"

I had to put quotes around the <> to get it to display here on the forum
getAllSubtext() does not return “hello”

In trying to help you I wrote a few lines of code to test it, and it seems to work in that context. Maybe there is a problem in the parsing of the xml document?

auto xmlelem { juce::XmlDocument::parse ("<name type = \"word\">hello</name>")};
auto thing { xmlelem->getAllSubText ()};

image

Thank you for your reply. Sure enough there is a funny character in the file I am trying to read.

slightly off-topic, but FYI:

putting three backticks ` will allow you to write “code” verbatim (and in monospace)

eg:

to get

<name type="word">hello</name>

just put

You can also use a single backtick to wrap a word inline and get the same monospace font.

Thank you for the tip.