[xquery-talk] how to construct XML via strings

Alexander Boldakov boldakov at ispras.ru
Fri Oct 6 14:09:31 PDT 2006

Hi all,

I'm a colleague of Maxim Grinev. I wan't to thank everyone for useful
answers and tell a few words about our use case.

We have an external full-text search system which is used to search
and hightlight results in the XML data. This is where foreign function
interface is used. The highligh function returns string - serialized
XML data with additional tag <hit>, ie something like this:

"<data>In the result some <hit>text</hit> is marked with tag</data>"

It is required to construct XML data with this fragment inside and
return the whole result as XML (to process via XSLT).

    <meta>{...some XQuery expression...}</meta>,
    "<data>In the result some <hit>text</hit> is marked with

We understand the solution with additional function that parses the
string into internal representation, but we believe that in our case
it leads to unacceptable extra overhead, because this strings are big
and contain a lot of tags.
We've looked through the output methods of "XSLT 2.0 and XQuery 1.0
Serialization" and found out that all methods doesn't satisfy our aims.
With XML,XHTML,HTML output method the "<" ">" symbols are escaped,
with TEXT method all tags will be lost.

The only solution we find to follow the standards is to use "Character
Maps". We are able to change the highlighting function to change
symbols "<" and ">" around tags with some specific symbols. If we
understand specification correctly, what we need after this is to
define character mapping of this special symbols to "<" and ">"

But we cannot find the syntax construction in XQuery to define
character mappings? Are they implementation depended?

Is character mapping the right choise in our use case?

Alexander Boldakov
Sedna team
boldakov at ispras.ru

С уважением,
 Alexander                          mailto:boldakov at ispras.ru

More information about the talk mailing list