From: <bo...@us...> - 2010-05-03 10:26:29
|
Revision: 376 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=376&view=rev Author: bodewig Date: 2010-05-03 10:26:23 +0000 (Mon, 03 May 2010) Log Message: ----------- extract an interface Modified Paths: -------------- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/xpath/JAXPXPathEngine.java trunk/xmlunit/src/main/net-core/xpath/XPathEngine.cs Added Paths: ----------- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/xpath/IXPathEngine.java trunk/xmlunit/src/main/net-core/xpath/IXPathEngine.cs Added: trunk/xmlunit/src/main/java-core/net/sf/xmlunit/xpath/IXPathEngine.java =================================================================== --- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/xpath/IXPathEngine.java (rev 0) +++ trunk/xmlunit/src/main/java-core/net/sf/xmlunit/xpath/IXPathEngine.java 2010-05-03 10:26:23 UTC (rev 376) @@ -0,0 +1,39 @@ +/* + This file is licensed to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +package net.sf.xmlunit.xpath; + +import java.util.Map; +import javax.xml.transform.Source; +import org.w3c.dom.Node; + +/** + * Interface for XMLUnit's XPath abstraction. + */ +public interface IXPathEngine { + /** + * Returns a potentially empty collection of Nodes matching an + * XPath expression. + */ + Iterable<Node> selectNodes(String xPath, Source s); + /** + * Evaluates an XPath expression and stringifies the result. + */ + String evaluate(String xPath, Source s); + /** + * Establish a namespace context. + * + * @param prefix2Uri maps from prefix to namespace URI. + */ + void setNamespaceContext(Map<String, String> prefix2Uri); +} Property changes on: trunk/xmlunit/src/main/java-core/net/sf/xmlunit/xpath/IXPathEngine.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/xmlunit/src/main/java-core/net/sf/xmlunit/xpath/JAXPXPathEngine.java =================================================================== --- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/xpath/JAXPXPathEngine.java 2010-05-03 06:49:13 UTC (rev 375) +++ trunk/xmlunit/src/main/java-core/net/sf/xmlunit/xpath/JAXPXPathEngine.java 2010-05-03 10:26:23 UTC (rev 376) @@ -29,7 +29,7 @@ /** * Simplified access to JAXP's XPath API. */ -public class JAXPXPathEngine { +public class JAXPXPathEngine implements IXPathEngine { private final XPath xpath; public JAXPXPathEngine(XPathFactory fac) { @@ -49,8 +49,7 @@ } /** - * Returns a potentially empty collection of Nodes matching an - * XPath expression. + * {@inheritDoc} */ public Iterable<Node> selectNodes(String xPath, Source s) { try { @@ -64,7 +63,7 @@ } /** - * Evaluates an XPath expression and stringifies the result. + * {@inheritDoc} */ public String evaluate(String xPath, Source s) { try { @@ -75,9 +74,7 @@ } /** - * Establish a namespace context. - * - * @param prefix2Uri maps from prefix to namespace URI. + * {@inheritDoc} */ public void setNamespaceContext(Map<String, String> prefix2Uri) { xpath.setNamespaceContext(Convert.toNamespaceContext(prefix2Uri)); Added: trunk/xmlunit/src/main/net-core/xpath/IXPathEngine.cs =================================================================== --- trunk/xmlunit/src/main/net-core/xpath/IXPathEngine.cs (rev 0) +++ trunk/xmlunit/src/main/net-core/xpath/IXPathEngine.cs 2010-05-03 10:26:23 UTC (rev 376) @@ -0,0 +1,38 @@ +/* + This file is licensed to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +using System.Collections.Generic; +using System.Xml; + +namespace net.sf.xmlunit.xpath { + + /// <summary> + /// Interface for XMLUnit's XPath abstraction. + /// </summary> + public interface IXPathEngine { + /// <summary> + /// Returns a potentially empty collection of Nodes matching an + /// XPath expression. + /// </summary> + IEnumerable<XmlNode> SelectNodes(string xPath, ISource s); + /// <summary> + /// Evaluates an XPath expression and stringifies the result. + /// </summary> + string Evaluate(string xPath, ISource s); + /// <summary> + /// Establish a namespace context - maps from prefix to namespace URI. + /// </summary> + IDictionary<string, string> NamespaceContext { set; } + } +} \ No newline at end of file Property changes on: trunk/xmlunit/src/main/net-core/xpath/IXPathEngine.cs ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/xmlunit/src/main/net-core/xpath/XPathEngine.cs =================================================================== --- trunk/xmlunit/src/main/net-core/xpath/XPathEngine.cs 2010-05-03 06:49:13 UTC (rev 375) +++ trunk/xmlunit/src/main/net-core/xpath/XPathEngine.cs 2010-05-03 10:26:23 UTC (rev 376) @@ -23,7 +23,7 @@ /// <summary> /// Simplified access to System.Xml.XPath API. /// </summary> - public class XPathEngine { + public class XPathEngine : IXPathEngine { private XmlNamespaceManager nsContext; /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |