Updating "mixed content" nodes not working

I’m working with S1000D schemas/collections and i’m having a hard time updating mixed content nodes in Tamino. Example XML:




Test information for
Figure-NSC Displays Overall Layout. The Upper Display is titled NSSMS…

Test text 1
Test text 2
Test text 3
Test text 4
The CONTROL WINDOW
provides the NSC operator the ability
to display the LLLTV video for the selected TIS. This display provides the selected TIS’s
radar bearing and elevation information.



I’ve been trying to update using the fully qualified xpath:

“/content/descript/para0/subpara1/subpara2[1]/para/randlist/item[5]/text()[1]”

Tamino returns an error:


<ino:message ino:returnvalue=“7740”>
<ino:messagetext ino:code=“INOXDE7740”>(cvc-complex-type.2.4): element child error</ino:messagetext>
ino:messageline
Line 0, Column 0: [element ‘item’ in element ‘item’]
</ino:messageline>
</ino:message>


This xquery appears to work, so my xpath is correct:
(obviously it wipes out the mixed content)
“/content/descript/para0/subpara1/subpara2[1]/para/randlist/item[5]”

I’ve tested this xpath with an XPath Validator in another program
with the same xml file and the XPath is perfectly valid.

Any help would be appreciated.

Hi,

I am sorry, but I do not understand the problem description at all.
There is no update in combina´tion with xpath in Tamino, only with XQuery. Maybe you are talking about a path expression in XQuery? In this case, please send the complete XQuery update statement.
You may try teh following XQuey statement whic actually works with your input data:
update replace input()//para/randlist/item[5]/text()[1] with “An”

What do you refer to by "(obviously it wipes out the mixed content) "
Your XQuery delivers the following result:


- <xq:result xmlns:xq="http://namespaces.softwareag.com/tamino/XQuery/result">
- <item>
  An 
  <emphasis emph="em01">CONTROL WINDOW</emphasis> 
  provides the NSC operator the ability to display the LLLTV video for the selected TIS. This display provides the selected TIS's radar bearing and elevation information. 
  </item>
  </xq:result>

Regards

Harald

Thanks for responding Harald. Hopefully this will help clarify.

I am passing an XQuery string into the class SoftwareAG.Tamino.Api.TaminoQuery(xquery)

The xquery looks like this:


declare namespace xlink=‘http://www.w3.org/1999/xlink
update for $dm in collection(‘COLLECTION_NAME’)/dmodule
let $dmc := $dm/idstatus/dmaddres/dmc
let $dmcagedash := zstring-join(($dmc/age/modelic,$dmc/age/supeqvc,$dmc/age/ecscs,$dmc/age/eidc,$dmc/age/cidc,$dmc/age/discode,$dmc/age/discodev,$dmc/age/incode,$dmc/age/incodev,$dmc/age/itemloc), ‘-’)
let $dmcaveedash := string-join(($dmc/avee/modelic,$dmc/avee/sdc,$dmc/avee/chapnum,$dmc/avee/section,$dmc/avee/subsect,$dmc/avee/subject,$dmc/avee/discode,$dmc/avee/discodev,$dmc/avee/incode,$dmc/avee/incodev,$dmc/avee/itemloc), ‘-’)
let $dmcdash := string-join(($dmcagedash ,$dmcaveedash), ‘’)
let $issno := string-join((string($dm/idstatus/dmaddres/issno/@issno), string($dm/idstatus/dmaddres/issno/@inwork)), ‘-’)
let $dmcdash_issno := string-join(($dmcdash, $issno), ‘_’)
let $old := $dm//content/descript/para0/subpara1/subpara2[3]/para/randlist/item[5]/text()[1]
let $new := element item{‘test update’} where $dmcdash_issno = ‘NSSMS-K-C2-0-0-00-03-A-161-A-Z_001-’
do (replace $old with $new)


This query (for simple xpaths) does work, its used for many other updates. The problem is that when you try to pass an XQuery to update ONLY the first “text” node of a “mixed content” node, the query fails.

Here’s an example of a path that works:
//content/descript/para0/subpara1/subpara2[3]/para/randlist/item[5]
…Which replaces all the content with the new value.

This does not work:
//content/descript/para0/subpara1/subpara2[3]/para/randlist/item[5]/text()[1]
… And it IS a fully qualified xpath pointing to only the first “text” node

The question is, why cant Tamino’s xquery engine understand “text()[N]”
and if its not Tamino, what would be the correct syntax?

Thanks again

Craig,

the isssue is NOT that Tamino does not understand text()[N].
It does. Your query will generate a document containing something like:


<item><item>test update</item><emphasis emph="em01">CONTROL WINDOW</emphasis> 
provides the NSC operator the ability 
to display the LLLTV video for the selected TIS. This display provides the selected TIS's 
radar bearing and elevation information.</item> 

because you replace a string by an element. The resulting document seems not to be valid according to your schema (item nested into item) - well, I do not know the schema, but that’s what the error message says.

Please check whether this is really teh update you want to do.

Regards

Harald