简体   繁体   中英

XQuery and SEPA style XML

I'm trying to query a XML that is used to send the SEPA file. I'm new with xquery and in the Base X program does not work this sentence

for $t in /CstmrCdtTrfInitn/PmtInf/CdtTrfTxInf return $t/Cdtr/Nm/node()

¿Can anyone help me?

thanks a lot

Presumably by "it doesn't work", you mean it returns nothing, with no error message?

We can't tell why that is without seeing the source document being queried. As Martin says, namespaces are a very likely culprit (on the basis that you're new to XQuery and that's what catches most people out).

Note that you can simplify your query to the simple path expression

/CstmrCdtTrfInitn/PmtInf/CdtTrfTxInf/Cdtr/Nm/node()

It might be that your elements are in the namespace urn:iso:std:iso:20022:tech:xsd:pain.001.001.11 so

declare default element namespace 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.11';

should help to select elements from that namespace; the schema I have found also suggests the root element is Document so /Document/CstmrCdtTrfInitn/PmtInf/CdtTrfTxInf is more likely to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM