XPATH Syntax
Simple question. Can someone please provide the proper syntax for placing an Input Variable into the query-database XPATH statement? I cannot even get this statement to compile (or any variants of it):
orcl:query-database('select ename from emp where empno = bpws:getVariableData('inputVariable','payload')',false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')
Here is the detailed error:
Error(30): [Error ORABPEL-10039]: invalid xpath expression [Description]: in line 30 of "C:\OraBPELPM_1\integration\jdev\jdev\mywork\BPELws\JDBC\JDBC.bpel", xpath expression "orcl:query-database('select ename from emp where empno = bpws:getVariableData('inputVariable')',false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')" specified in <from> is not valid, because XPath query syntax error. Syntax error while parsing xpath expression "orcl:query-database('select ename from emp where empno = bpws:getVariableData('inputVariable')',false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')", at position "79" the exception is Expected: ). Please verify the xpath query "orcl:query-database('select ename from emp where empno = bpws:getVariableData('inputVariable')',false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')" which is defined in BPEL process. . [Potential fix]: Please make sure the expression is valid.
I have been trying to XSQL to work and it suffers from XPATH issues at runtime.
Clemens, any suggestions here? I was thinking perhaps of using ora:parseEscapedXML to forceably create the proper expression after concatenating the orcl:query-database together with the EMPNO after it is assigned to a holding String variable. Not sure it would work though. It does not look like you can perform 2 successive COPY TO / FROM in one set of tags.
Thanks!
Does anybody have any suggestions for this issue? Has anyone gotten this aspect of XPATH to work correctly? HELP!
Similar Messages
-
Documaker 12.1 XPath Syntax Issue
We are moving to Documaker Studio 12.1 from Docucreate 11.0. So, I am importing few forms into 12.1 and doing test runs. I ran into a XPath syntax issue. We use XPath manual triggers to trigger forms and sections.
In 11.0, the following trigger (use as Search Mask (True/False) in Manual Triggers) works perfectly fine. But it doesn't work in 12.1
*!/Acord/Bills/Form/[FormNumber='U61']FormNumber*
In 12.1, I have to remove the "/" present before "[" to make it work - as shown below.
*!/Acord/Bills/Form[FormNumber='U61']FormNumber*
Is there a way we can make the old syntax work with 12.1 as well? It would save us from changing thousands of Form and Section Triggers?
Thank you,
SGov.I suspect the short answer is No. The initial xPath syntax appears invalid as you would not define a slash between the node and the attribute that belongs to the node. The fact that it somehow succeeded was an anomaly that must have been corrected.
-
Hello,
I am trying to write an XPath syntax query to retrieve some specific child nodes in a loop (in PLSQL) from the following document excerpt..
<?xml version="1.0" encoding="utf-8" ?>
<Request RequestNumber="">
<TargetServers>
<TargetServer>
<HARDWARE>
<HOSTNAME>HNSS1</HOSTNAME>
</HARDWARE>
<PRODUCTS>
<PRODUCT PRD_ID="123" QUANTITY="10">
<PERIOD></PERIOD>
<PROD_ATTRIBUTES>
<SUPP>ven1</SUPP>
<EDITION>ENTERPRISE</EDITION>
<VERSION>1.0</VERSION>
</PROD_ATTRIBUTES>
</PRODUCT>
<PRODUCT PRD_ID="234" QUANTITY="3">
<PERIOD></PERIOD>
<EXEMPTIONS>
<EXEMPTION_CODE>xxx1</EXEMPTION_CODE>
</EXEMPTIONS>
<EXCEPTIONS />
<PROD_ATTRIBUTES />
</PRODUCT>
<PRODUCT PRD_ID="345" QUANTITY="5">
<PERIOD></PERIOD>
<EXCEPTIONS />
<PROD_ATTRIBUTES />
</PRODUCT>
</PRODUCTS>
</TargetServer>
<TargetServer>
<HARDWARE>
<HOSTNAME>HNSS2</HOSTNAME>
</HARDWARE>
<PRODUCTS>
<PRODUCT PRD_ID="123" QUANTITY="10">
<PERIOD></PERIOD>
<PROD_ATTRIBUTES>
<SUPP>ven1</SUPP>
<EDITION>ENTERPRISE</EDITION>
<VERSION>1.0</VERSION>
</PROD_ATTRIBUTES>
</PRODUCT>
</PRODUCTS>
</TargetServer>
</TargetServers>
</Request>
What I am trying to do is retrieve only those products associated with a given hostname but the xpath query I have come up with returns ALL the products for the entire document.
I am using the following code
xpath.selectnodes(doc,'/Request/TargetServers/TargetServer/PRODUCTS/PRODUCT');
Which I think is correctly returning (in the example above) all three product nodes.
My question is how do I make the xpath query ONLY select the nodes for a given specific hostname ?
I tried adding an HN attribute to the TARGETSERVER node and then using the following syntax
xpath.selectnodes(doc,'/Request/TargetServers/TargetServer[@HN="HN1"]/PRODUCTS/PRODUCT');
but that didn't work..
Any other suggestions gratefully received.
ThanksHi,
Based on the sample document you provided, this should work :
/Request/TargetServers/TargetServer[HARDWARE/HOSTNAME="HNSS1"]/PRODUCTS/PRODUCT
I am using the following code
xpath.selectnodes(doc,'/Request/TargetServers/TargetServer/PRODUCTS/PRODUCT');You said you're using PL/SQL, but isn't that a Java method? -
In regex, it's [0-9]+ or \d+. I'm trying to use xpath to match a number that's any value of 18 digits long. What's the syntax?
DuckDuckGo: http://www.regular-expressions.info/xpath.html
-
Converting XPATH to SQL syntax?
HI, all
I am looking for a third party tool to convert XPATH syntax to SQL syntax?
XPATH is primary syntax to retrieve and locate data in XML structre, while SQL is the stand syntax to operate data in RDBMS. Please assume I have a way to map XML data to RDBMS.
Thanks in advance!
Tao
2002/11/15Did you ever find a solution?????... that�s exactly what I�m trying to do. Any help would be appreciated. Theres like no information on this stuff. Thanks
bpfl -
Hi all.
I have a JDOM XML document and I use JDOMXPath to apply XPath expressions on the XML document.
I have XPath expression for which JDOMXPath does not match any node:
//*[not(count(descendant::a) < 4)]
[not(descendant::node()[count(descendant::a)>3])]
[not(descendant::text()[normalize-space(string())!='']
[not(ancestor::a)])]
XML parser such as Saxon, MSXML, etc. correctly match this XPath on the document and find the appropriate node-set, so the XPath expression is 100% right from the XPath syntax perspective.
But in JDOM, it does not match.
Could anybody tell me what is the problem?
Thank you very much for help and sorry if this is the wrong place to ask this question - this is my first post here.
Thanks again,
AnnaSorry, forgot to tell something very important:
the XML node-set that I am trying to match is as follows:
<ul>
<li>Accessibility</li>
<li>Amaya</li>
<li>ABC</li>
<li>CC/PP</li>
</ul>
The interesting moment is, that if I change the node-set to look like this:
<ul><li>Accessibility</li><li>Amaya</li><li>ABC</li><li><a href="Mobile/CCPP/"></a></li></ul>
i.e. without any spaces, JDOMXPath will match for the above XPath.
Is there any problem with spaces in JDOM/JDOMXPath?
Thanks again
Anna -
I am trying to populate an accordion using an XML document as
follows:
<?xml version="1.0" encoding="iso-8859-1"?>
<images xmlns="
http://www.g-raff.com/images">
<groups>
<group groupname="Martyn's favourites">
<image>
<filename>atomic-kitten-1.jpg</filename>
<title>Atomic Kitten</title>
<date>23.8.2004</date>
<place>London</place>
</image>
<image>... </image>
etc.
</group>
<group groupname="Painting with light">
<image>
<filename>a.jpg</filename>
<title>a</title>
<date>15.4.2003</date>
<place>peckham rye</place>
</image>
etc.
</group>
<group groupname="Musicians">
<image>
<filename>atomic-kitten-1.jpg</filename>
<title>Atomic Kitten</title>
<date>23.8.2004</date>
<place>London</place>
<target>people1</target>
</image>
etc.
</group>
</groups>
</images>
Now - in creating the data sets, I want to generate a set of
thumbnails for each "group" - I have the following code:
var dsGroups = new Spry.Data.XMLDataSet("images.xml",
"/images/groups/group");
var dsImages = new Spry.Data.XMLDataSet("images.xml",
"/images/groups/group[@groupname =
'{dsGroups::@groupname}']/image")
I am then using the following to label the accordion and
populate the panels:
<div id="NavAcc" class="Accordion" spry:region="dsGroups
dsImages">
<div class="AccordionPanel" spry:repeat="dsGroups">
<div class="AccordionPanelLabel">
<h3>{dsGroups::@groupname}</h3>
</div>
<div class="AccordionPanelContent">
<div id="thumbs">
<div class="thumbnail" spry:repeat="dsImages">
<img class="thumb"
src="images/thumbnails/{dsImages::filename}"
alt="{dsImages::title}"
onclick="dsImages.setCurrentRow('{ds_RowID}');" width="92"
height="60" />
<p class="caption">{dsImages::title}</p>
</div>
</div>
</div>
</div>
</div>
Its not working - dsImages is failing. I know it must be to
do with the way I'm trying to filter by the attribute "groupname",
as I'm not sure whether the "@" is allowed in this context.
Can anyone point me at a fulfilling explanation of xPath
syntax so I can figure out how to achieve this?
Thanks yet again,
raff JI encountered the same (or very similar) problem. In my case,
with a photo album xml where the layout is similar (see below) and
I need to pull the image folder url from the parent dataset and the
image urls from a series of <img> tags. I also could not
figure out a way to do this, and would very much appreciate an
example of how it is done.
what did not work was setting up the datasets as
var dsPhotos = new Spry.Data.XMLDataSet("sample.xml",
"gallery/album")
var dsImages = new Spry.Data.XMLDataSet("sample.xml",
"gallery/album[@pID = '{dsPhotos::pID}']/img")
Sample XML:
<?xml version="1.0" encoding="utf-8"?>
<!-- XML Generated by SlpIDeShowPro Director v1.0.2 -->
<gallery>
<album pID="8" title="Rose River" description="Rose River
Hike" lgPath="
http://www.zakar.com/ssp_director/albums/RoseRiver/lg/"
tnPath="
http://www.zakar.com/ssp_director/albums/RoseRiver/tn/"
tn="
http://www.zakar.com/ssp_director/albums/RoseRiver/tn/P5030196.jpg">
<img src="P5030211.jpg" title="" caption="P5030211.jpg"
link="
http://" />
<img src="P5030196.jpg" title="" caption="P5030196.jpg"
link="
http://" />
<img src="P5030197.jpg" title="" caption="P5030197.jpg"
link="
http://" />
</album>
<album pID="9" title="Stony Man / Little Stony Man
Cliffs" description="Great views " lgPath="
http://www.zakar.com/ssp_director/albums/Stonyman/lg/"
tnPath="
http://www.zakar.com/ssp_director/albums/Stonyman/tn/"
tn="
http://www.zakar.com/ssp_director/albums/Stonyman/tn/P5020182.jpg">
<img src="P5020195.jpg" title="" caption="P5020195.jpg"
link="
http://" />
<img src="P5020178.jpg" title="" caption="P5020178.jpg"
link="
http://" />
<img src="P5020179.jpg" title="" caption="P5020179.jpg"
link="
http://" />
</album>
</gallery> -
Hi,
My wsdl contains:
<wsdl:message name="BPELProcess1RequestMessage">
<wsdl:part name="payload" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="BPELProcess1ResponseMessage">
<wsdl:part name="payload" type="xsd:string"/>
</wsdl:message>
In my soap request I am sending xml as part of soap body as string:
<soap:Body>
<Test>
<TestRequest>111</TestRequest>
<TestType tc="99">
</Test>
</soap:Body>
So in my bpel I want to access tc value i.e 99. Could you please share some sample code to access this attribute value. appreciate your quick inputs.
thanksfirst i would recommend changing the wsdl to have right complex type for the part instead of using xsd:string. once that is done, then you can use /Test/TestType/@tc to get the value of tc attribute. by using the complex type you can validate the incoming documents and eliminate other xpath syntax errors.
-
Hi again,
still a newb and stillsomequestions, but hope dies at last :)
I want to extract values from a xml file which is stored in a table.
i have the following code:
COLUMN div DEFAULT
SELECT extract(value(x), '//DIV/@ ID = ''FXAC93006ENC.0001.01.00''/text()').getStringVal() AS div
FROM versuch2 x;
With this code ive got the following Error Message: ORA:31012: Not supported XPath Statement.
I tried this XPath statement in SlyXML and got a boolean:true result, so i think its not a xpath problem.
Isthere a syntax problem?
Thx for help!The correct syntax for fetching attributes is different from what you did.
Not sure which syntax is the standard, but the Oracle Version seems more intuitive (too me). Why? Because an attribute is on the same hierachy level of the xml tag and therefore should not be queried with an additional /.
SQL> with versuch2 as (select xmltype('<doc><div id="FXAC93006ENC.0001.01.00">Test</div></doc>') xmlcol from dual)
2 SELECT extract(xmlcol, '//div[@id="FXAC93006ENC.0001.01.00"]/ text()').getStringVal() AS div
3 FROM versuch2 x;
DIV
Test
SQL>
SQL> btw: W3C XPath Syntax stuff: http://www.w3.org/TR/xpath#predicates
Message was edited by:
Sven W. -
[XML/XPATH] jaxen : problem with "parent" function
Hello
I have a problem with jaxen, when I try to use the XPath function parent :
When I try this :
import ...
DocumentNavigator dn=new DocumentNavigator();
try {
objet=dn.getDocument("TESTXPath.xml");
apath=dn.parseXPath("/Entry/Resultats/step/Population/individu/*");
result=apath.evaluate(objet);
System.out.println(result);
apath=dn.parseXPath("/Entry/Resultats/step/Population/parent::*");
result=apath.evaluate(objet); // ---> exception
System.out.println(result);
catch(Exception e) {
e.printStackTrace();
The first result is well displayed, but just before the second, I catch this exception:
Exception in thread "main" java.lang.NoSuchMethodError: org.jdom.Element.getParent()Lorg/jdom/Element; at org.jaxen.jdom.DocumentNavigator.getParentAxisIterator(DocumentNavigator.java: 252)
at org.jaxen.expr.iter.IterableParentAxis.iterator(IterableParentAxis.java:82)
at org.jaxen.expr.DefaultStep.axisIterator(DefaultStep.java:139)
at org.jaxen.expr.DefaultLocationPath.evaluate(DefaultLocationPath.java:188)
at org.jaxen.expr.DefaultAbsoluteLocationPath.evaluate(DefaultAbsoluteLocationPat h.java:126)
at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:107)
at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:716)
at org.jaxen.BaseXPath.selectNodes(BaseXPath.java:239)
at org.jaxen.BaseXPath.evaluate(BaseXPath.java:196)
at MainTestClass.main(MainTestClass.java:85)
However, the first query works good and I received list so I'm quite sure that it's not a problem of unfindable elements.
Finaly I can't be syccessful to use XPath parent function:
Either I catch an exception, or it returns nothing or empty list
Isn't the XPath syntax correct in my second expression ?
Can we do :
/.../.../parent::* ? ou //individu/parent::* ?Thanks
I think so, but.
In fact I don't think I'm using different version of JDOM.
I use eclipse with jdk1.4.2.
I have downloaded JDOM-b10 and the only things I have done is to extract zip archive and to add all .jar files of the jdom directory in my library path.
Do this is the only version of JDOM I'm using.
All works perfectly excepted only the XPath parent method. It's strange that the other methods work fine.
I don't knnow how to solve this problem ! so if you can help me I be very thankfull. -
Feature request: more xpath support in XMLElement
Hey guys,
Just wanted to submit a feature request. I'm trying to write code to find the number of Invocation service threads that Coherence uses. It would be very nice if I could use XPath syntax such as the following:
getSafeElement("cluster-config/services/service[@id='3']/init-params/init-param/param-value")
Since the API doesn't support that, I have to resort to something like the following:
XmlElement services = com.tangosol.net.CacheFactory.getClusterConfig().findElement(
"cluster-config/services");
List servicesList = services.getElementList();
for (Iterator i=servicesList.iterator(); i.hasNext(); ) {
XmlElement element = (XmlElement)i.next();
if (element.getAttribute("id").getInt() == 3) {
XmlElement value = element.findElement("init-params/init-param/param-value");
System.out.println("invocation threads: " + value.getInt());
}I haven't quite gotten that to work yet, but it's probably close. :)
Thanks,
MattMatt,
There is a helper function in com.tangosol.run.xml.XmlHelper class that makes it almost as easy as using the XPath.
XmlElement xmlCluster = CacheFactory.getClusterConfig();
XmlElement xmlInvocation = XmlHelper.findElement(xmlCluster,
"cluster-config/services/service/service-type", "Invocation");
XmlElement xmlThreads = XmlHelper.findElement(xmlInvocation,
"../init-params/init-param/param-value");
System.out.println("invocation threads: " + xmlThreads.getInt());Regards,
Gene -
Syntax for logical OR,AND and not equal to
Hi All,
In the rtf template we are in need of using logical OR,AND and not equal to .
<?choose:?><?when:(M= 0 & N=1) | (M= 1 & N=0)?>
<?end when?>
<?choose:?><?when:(M!= 0 & N=!1)?>
<?end when?>
<?otherwise:?><?end otherwise?><?end choose?>
Is the syntax used above is correct?
Thanks in AdvanceHi,
Been a while since I look at this sort of thing, but from what I can remember, here goes:
When you specify an element name in your XML you are actually specifying some XPath. This means you need to use XPath syntax in your <?when....?> clause.
I think you would need to re-write your statements as follows:
<?choose:?>
<?when:(M=0 and N=1) or (M=1 and N=0)?>
<? end when?>
<?when:not(M=0 and N=1)?>
<?end when?>
<?otherwise:?>
<?end otherwise?>
<?end choose?>
I hope this helps you.
Regards,
Cj -
Xpath problems...please help
Hi:
i m new to xpath. i am trying to use xpath to select data from xhtml.Can i know how can select only one of the child ? take for example:
- <table border="0" cellpadding="2" width="100%">
+ <tr>
+ <tr>
+ <tr>
+ <tr>
- <tr>
<td>Number of Kids</td>
- <td>
1
- <small>
Profile History
</small>
</td>
</tr>
+ <tr>
i only wan to get the info number of kids, so is 1. The xpath syntax that i put is ......tr[5]/td[2] but it give me all the children under td[2].....can anyone plz help?
thank youhi emily_spt
i m also doing the same project which converts html to xml in order to extract data.... from this website.:
http://www-106.ibm.com/developerworks/web/library/wa-wbdm/
i m not able to compile the programs XMLHelper.java and the other .
can u plz illustrate the steps u had done to run the ..
plzzzzzzzz reply as soon as possible -
Correct XPath to delete single keyword?
I am trying to update keywords in XMP data using the XMP toolkit. I don't seem to be able to get the correct XPath to delete only 1 keyword in the "subject" bag. My code looks like this:
// "Asia" does not get removed (no exceptions get thrown, either)
theMetaXAP->remove(XAP_NS_DC, "subject/*[.=\"Asia\"]");
I am able to successfully delete all keywords with this:
theMetaXAP->remove(XAP_NS_DC, "subject/*"); // succeeds
What is the correct XPath syntax to delete only one keyword? Or is this not supported?
DaveSelect images, Type in the Keyword you WANT to delete in the Add Keyword field at the bottom of the window (next to the keyword buttons) then - Shift-Apple + Return to Delete that word.
-
Etext, xpath and custom defined level
I am using XML Publisher in EBS.
I am running into an issue with xpath syntax in an etext template.
I have XML as follows:
OutboundPaymentInstruction
+PaymentInstructionInfo
+PaymentProcessProfile
+PaymentFormat
+Instruction Totals
+Instruction Grouping
+Payer
+BankAccount
</InstructionGrouping>
+OutboundPayment
</OutboundPaymentInstruction>
From OutboundPayment level, I can navigate back to payer info by using this syntax
../InstructionGrouping/Payer/Address/AddressLine1
However, I need to define an additional level as follows:
<DEFINE LEVEL> PaymentPayee
<BASE LEVEL> OutboundPayment
<GROUPING CRITERIA> SupplierNumber
<END DEFINE LEVEL> PaymentPayee
How do I get the payer information now? I thought it should be
../../InstructionGrouping/Payer/Address/AddressLine1
as OutboundPayment is now nested below PaymentPayee, but this doesn't work. Any suggestions please?
Thank you,
Tam.Hi
Sorry for the delay. My User got locked for some time.
I have seen the document you sent me on my email id.
<b> I noticed in the case where the Search help is working fine, there is no space in between the contents of the Fixed values and their short text under the value range tab of the Domain element.
But in the case, where there is a problem with the search help. There both the Fixed values and their short description is having a space in between the words.
Try maintaining COND_A instead of "COND A". Also with the short description use "COND_A" instead of "COND A".</b>
<u>I hope this will resolve the issue.</u>
<b>Update me once you have any issues.</b>
Please reward suitable points, incase it suits your requirements.
Regards
- Atul
Maybe you are looking for
-
A few weeks ago we were pitched a holiday deal to renew/upgrade for 2 years. This sounded like good value (upgraded equipment, new premium channels, etc), so we went for it. Unfortunately, we've had nothing but issues since. The main room STB (server
-
AirTunes not working over wireless from Windows 7
Setup: Dell Inspiron 15 laptop (Windows 7 Home Premium) Airport Express Network: ADSL router +- Desktop PC (ethernet to router) +- Airport Express (ethernet to router) +- Dell laptop (wireless to Airport Express) The Airport Express creates a wireles
-
SRM Proxy to PI to HTTP/Web Service
I have this following scenario: SRM PurchaseOrderRequest_Out (otbound proxy from SRM) to PI to Web/HTTP Service The SRM message is EOIO and Async. This needs to be posted to the receiver as a sync message after mapping. I am using a BPM to do this As
-
DAQmx has static readings on some channels
Hi, I'm writing a LabVIEW 2010 SP1 program for monitoring and recording and it records voltage readings from some sensors through a pair of USB6008s. I have it set to doing continuous sampling at 250 Hz for noise reasons and with a buffer size of 25
-
Blackberry Z10 saving and uploading issue
I got my blackberry a week ago, and I haven't been able to save files from the browser. When I click save, it doesn't do anything. I can't upload files to facebook or bbm straight from in the app either, I have to share them. I can only save images s