I have a variable in xQuery of type xs:string with the value of an encoded HTML snippet (the content of a twitter tweet). It looks like this:
Headline
Depends on which XQuery processor you are using... The easiest way is to be using a processor that has an extension that handles this for you. For instance, with Saxon and the following XML:
<c>asdf</c>
You can write an XQuery that uses the saxon:parse()
function to do what you want:
declare namespace saxon = "http://saxon.sf.net/";
{
saxon:parse(doc('test.xml')/a)
}
The result from that is:
asdf
I think most(?) XQuery processors will have an extension to do this for you. Hope that helps.