scriptella.driver.xpath

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Natural Language Processing
51.Net
52.Parser
53.PDF
54.Portal
55.Profiler
56.Project Management
57.Report
58.RSS RDF
59.Rule Engine
60.Science
61.Scripting
62.Search Engine
63.Security
64.Sevlet Container
65.Source Control
66.Swing Library
67.Template Engine
68.Test Coverage
69.Testing
70.UML
71.Web Crawler
72.Web Framework
73.Web Mail
74.Web Server
75.Web Services
76.Web Services apache cxf 2.2.6
77.Web Services AXIS2
78.Wiki Engine
79.Workflow Engines
80.XML
81.XML UI
Java Source Code / Java Documentation  » Scripting » scriptella » scriptella.driver.xpath 
scriptella.driver.xpath

XPath Driver for Scriptella.

Allows querying an XML file based on XPath expressions.

General information

Driver class:scriptella.driver.xpath.Driver
URL:XML file URL. URIs are resolved relative to a script file directory.
Runtime dependencies:None

Driver Specific Properties

Name Description Required
trim Value of true specifies that the leading and trailing whitespaces in text file lines should be omitted.. No, the default value is true.

Query Syntax

XPath driver supports XPath syntax to query text files.

The query is executed on a XML Document and produces a rowset for matched nodes. The attribute and element values can be referenced from nested scripts/queries. The following example illustrates querying mechanism:

Example:

XPath: /A selects root element <A>

<A B="1">
    <B>2</B>
    <C>3</C>
</A>
Available variables for matched element <A>:
NameValue
A2 3
B1
C3
The value of variable A represents text content inside XML element <A>, the value of variable B represents value of B attribute and the value of variable C represents text content inside element <C>.

Additional notes:

  • Currently only Node Set can be selected in XPath expressions, i.e. attributes or elements but not String, Boolean or Number

Script Syntax

<script> elements are not supported by the driver.

Properties substitution

In query elements ${property} or $property syntax is used for properties/variables substition.

Examples

<connection id="in" driver="xpath" url="data.xml"/>
<connection id="out" driver="text" url="report.csv"/>

<query connection-id="in">
    /HTML/BODY/TABLE/TR
    <script connection-id="out">
        $rownum;${td[0]};${td[1]}
    </script>
</query>

Extracts rows from tables in data.xml file and produces report.csv.
Java Source File NameTypeComment
Driver.javaClass Represents a driver for querying XML files with XPath expressions.
XPathConnection.javaClass Represents a connection to an XML file.
XPathConnectionPerfTest.javaClass Tests for scriptella.driver.xpath.XPathConnection .
XPathDriverITest.javaClass Integration test for scriptella.driver.xpath.Driver XPath driver .
XPathExpressionCompiler.javaClass Represents a facade for compiling xpath expressions.
XPathProviderException.javaClass Thrown to indicate a problem with XML file querying.
XPathQueryExecutor.javaClass Executor for XPath queries.
XPathQueryExecutorTest.javaClass Tests for XPathQueryExecutor .
w_w__w__.j_a__v___a__2s_.c_om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.