I would like to update an XML document using XQuery.
I have got the following xquery statement:
String updatestring = “update for $a in input()/molecule/string[@title = ‘NSC’] where $a = '”+number+"’ do insert “+include+” following $a";
include contains another .
Then I do:
TXQuery query = TXQuery.newInstance(updatestring);
TResponse response = accessor.xquery(query);
That works, the only problem is that I dont get
<string …>…old…<string …>…new…
So there is no newline included!
I tried a lot of different approaches, like \n or
String newline = System.getProperty(“line.separator”);
but the result is always the same.
Does anybody have an idea??
Thank you very much!
I think Tamino will always strip whitespace between sibling elements unless the parent is defined as mixed content in the schema (and you might even have to specify xml:space=“preserve”). If this sort of thing is important you may be better off running query results through some sort of ?pretty printer? filter.