I have this resulted QString from an http request, What I need to do is to extract only the string "一致" which is inside the tag
"TranslatedText>一致</TranslatedText>"
How to do this?
<GetTranslationsResponse xmlns="http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<From>en</From>
<Translations>
<TranslationMatch>
<Count>0</Count>
<MatchDegree>100</MatchDegree>
<MatchedOriginalText/>
<Rating>5</Rating>
<TranslatedText>一致</TranslatedText>
</TranslationMatch>
</Translations>
You would use a XPath query to do this.
Use the path:
/GetTranslationsResponse/Translations/TranslationMatch/TranslatedText/text()
To extract the value.
I'm not sure what platform/laguage you're using, so just investigate if QT has XPath support there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With