Extract a QString from xml tag

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>

Answers


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.


Need Your Help

Understanding UpdatePanels

asp.net vb.net updatepanel

I am trying to understand UpdatePanels and best practise for using them.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.