| 1 |
|
| 2 |
dbStatements = new HashMap<String, String>(); |
| 3 |
dbStatements.put("getCreditDefaultSwapsByEntityName", |
| 4 |
"select xmldocument( " + |
| 5 |
"xmlquery(" + |
| 6 |
"'declare default element namespace \"http://www.fpml.org/2009/FpML-4-7\"; " + |
| 7 |
"$DOCUMENT/FpML/trade/creditDefaultSwap' ) " + |
| 8 |
" ) " + |
| 9 |
"from fpmladmin.fpml43 where comment like ? and " + |
| 10 |
"xmlexists(" + |
| 11 |
"'declare default element namespace \"http://www.fpml.org/2009/FpML-4-7\"; " + |
| 12 |
"$fpml/FpML/trade/creditDefaultSwap/generalTerms/referenceInformation/referenceEntity[entityName=$name]' " + |
| 13 |
"passing document as \"fpml\", " + |
| 14 |
"cast (? as varchar(100)) as \"name\")" |
| 15 |
); |
| 16 |
... |
| 17 |
|
| 18 |
Source source = new Source(FpMLServlet.class.getResource("/joinCreditDefaultSwap.xq").toString()); |
| 19 |
XQueryExecutable joinCreditDefaultSwapsXQ = factory.prepareXQuery(source, staticContext); |
| 20 |
... |
| 21 |
JDBCCollectionResolver inputResolver = new JDBCCollectionResolver(getConnection(), dbStatements); |
| 22 |
dynamicContext.setCollectionResolver(inputResolver); |
| 23 |
StreamSource source = new StreamSource(FpMLServlet.class.getResourceAsStream("/assets.xml")); |
| 24 |
dynamicContext.bind(new QName("http://com.ibm.xml.samples", "entityName"), name); |
| 25 |
XSequenceCursor output = joinCreditDefaultSwapsXQ.execute(source, dynamicContext); |