vgritsenko 2004/02/25 05:06:13
Modified: java/src/org/apache/xindice/core/query QueryUtil.java java/tests/src/org/apache/xindice/integration/client/services XPathQueryTest.java Log: Expand source for attribute/text/comment query results Revision Changes Path 1.5 +12 -4 xml-xindice/java/src/org/apache/xindice/core/query/QueryUtil.java Index: QueryUtil.java =================================================================== RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/core/query/QueryUtil.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- QueryUtil.java 25 Feb 2004 03:32:52 -0000 1.4 +++ QueryUtil.java 25 Feb 2004 13:06:12 -0000 1.5 @@ -80,7 +80,11 @@ holder.setAttribute(NodeImpl.XMLNS_PREFIX + ":xq", XindiceCollection.QUERY_NS); holder.setAttributeNode((Attr) doc.importNode(n, true)); - // TODO: expandSource + if (expandSource && n instanceof DBNode) { + ((DBNode) holder).setSource(((DBNode) n).getSource()); + ((DBNode) holder).expandSource(); + } + root.appendChild(holder); } else if (element instanceof Text || element instanceof Comment) { Node n = (Node) element; @@ -89,7 +93,11 @@ holder.setAttribute(NodeImpl.XMLNS_PREFIX + ":xq", XindiceCollection.QUERY_NS); holder.appendChild(doc.importNode(n, true)); - // TODO: expandSource + if (expandSource && n instanceof DBNode) { + ((DBNode) holder).setSource(((DBNode) n).getSource()); + ((DBNode) holder).expandSource(); + } + root.appendChild(holder); } else if (element instanceof ProcessingInstruction) { if (log.isWarnEnabled()) { 1.15 +9 -9 xml-xindice/java/tests/src/org/apache/xindice/integration/client/services/XPathQueryTest.java Index: XPathQueryTest.java =================================================================== RCS file: /home/cvs/xml-xindice/java/tests/src/org/apache/xindice/integration/client/services/XPathQueryTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- XPathQueryTest.java 25 Feb 2004 03:32:52 -0000 1.14 +++ XPathQueryTest.java 25 Feb 2004 13:06:13 -0000 1.15 @@ -469,14 +469,14 @@ // is caught and ignored forcing a collection scan (if logging WARN, you'll see stack trace) String query = "//person[substring(last, string-length(last) - two)='ith']"; - String document3 = - "<?xml version=\"1.0\"?>" + String document3 + = "<?xml version=\"1.0\"?>" + "<person>" - + "<first>Sally</first>" - + "<last>Smith</last>" - + "<one>1</one>" - + "<two>2.0</two>" - + "<phone call=\"no\" type=\"work\">555-345-6789</phone>" + + "<first>Sally</first>" + + "<last>Smith</last>" + + "<one>1</one>" + + "<two>2.0</two>" + + "<phone call=\"no\" type=\"work\">555-345-6789</phone>" + "</person>"; this.client.insertDocument(TEST_COLLECTION_PATH, "doc3", document3);