Search Results

Search found 803 results on 33 pages for 'xpath'.

Page 1/33 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • xpath query in a servlet gives exception

    - by user1401071
    I have a Document object initialized in the init() method of the servlet and use it in the doPost() method to service the requests. selectNodeList() xpath query gives exception when the servlet services many request at same time. The Exception is shown below: Caused by: javax.xml.transform.TransformerException: -1 at org.apache.xpath.XPath.execute(XPath.java:331) at org.apache.xpath.CachedXPathAPI.eval(CachedXPathAPI.java:328) at org.apache.xpath.CachedXPathAPI.selectNodeList(CachedXPathAPI.java:255) at org.apache.xpath.CachedXPathAPI.selectNodeList(CachedXPathAPI.java:235) at com.pro.bb.servlets.Controller.getDataOrPeriodForReport(Controller.java:511) ... 23 more Caused by: java.lang.ArrayIndexOutOfBoundsException: -1 at org.apache.xpath.XPathContext.pushCurrentNode(XPathContext.java:808) at org.apache.xpath.axes.PredicatedNodeTest.acceptNode(PredicatedNodeTest.java:447) at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java:409) at org.apache.xpath.axes.WalkingIterator.nextNode(WalkingIterator.java:176) at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:320) at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:474) at org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:257) at org.apache.xpath.axes.LocPathIterator.execute(LocPathIterator.java:257) at org.apache.xpath.XPath.execute(XPath.java:308) Help me sort out the issue.

    Read the article

  • Can I use relative XPath expressions in libxml2?

    - by brbr
    I am wondering whether it is possible to use relative XPath expressions in libxml2. This is from the javax.xml.xpath API and I would like to do the similar thing using libxml2: Node widgetNode = (Node) xpath.evaluate(expression, document, XPathConstants.NODE); With a reference to the element, a relative XPath expression can now written to select the child element: XPath xpath = XPathFactory.newInstance().newXPath(); String expression = "manufacturer"; Node manufacturerNode = (Node) xpath.evaluate(expression, **widgetNode**, XPathConstants.NODE);

    Read the article

  • BizTalk Testing Series - The xpath Function

    - by Michael Stephenson
    Background While the xpath function in a BizTalk orchestration is a very powerful feature I have often come across the situation where someone has hard coded an xpath expression in an orchestration. If you have read some of my previous posts about testing I've tried to get across the general theme like test-driven or test-assisted development approaches where the underlying principle is that your building up your solution of small well tested units that are put together and the resulting solution is usually quite robust. You will be finding more bugs within your unit tests and fewer outside of your team. The thing I don't like about the xpath functions usual usage is when you come across an orchestration which has something like the below snippet in an expression or assign shape: string result = xpath(myMessage,"string(//Order/OrderItem/ProductName)"); My main issue with this is that the xpath statement is hard coded in the orchestration and you don't really know it works until you are running the orchestration. Some of the problems I think you end up with are: You waste time with lengthy debugging of the orchestration when your statement isn't working You might not know the function isn't working quite as expected because the testable unit around it is big You are much more open to regression issues if your schema changes     Approach to Testing The technique I usually follow is to hold the xpath statement as a constant in a helper class or to format a constant with a helper function to get the actual xpath statement. It is then used by the orchestration like follows. string result = xpath(myMessage, MyHelperClass.ProductNameXPathStatement); This means that because the xpath statement is available outside of the orchestration it now becomes testable in its own right. This means: I can test it in its own right I'm less likely to waste time tracking down problems caused by an error in the statement I can reduce the risk or regression issuess I'm now able to implement some testing around my xpath statements which usually are something like the following:    The test will use a sample xml file The sample will be validated against the schema The test will execute the xpath statement and then check the results are as expected     Walk-through BizTalk uses the XPathNavigator internally behind the xpath function to implement the queries you will usually use using the navigators select or evaluate functions. In the sample (link at bottom) I have a small solution which contains a schema from which I have generated a sample instance. I will then use this instance as the basis for my tests.     In the below diagram you can see the helper class which I've encapsulated my xpath expressions in, and some helper functions which will format the expression in the case of a repeating node which would want to inject an index into the xpath query.             I have then created a test class which has some functions to execute some queries against my sample xml file. An example of this is below.         In the test class I have a couple of helper functions which will execute the xpath expressions in a similar way to BizTalk. You could have a proper helper class to do this if you wanted.         You can see now in the BizTalk expression editor I can use these functions alongside the xpath function.         Conclusion I hope you can see with very little effort you can make your life much easier by testing xpath statements outside of an orchestration rather than using them directly hard coded into the orchestration.     This can also save you lots of pain longer term because your build should break if your schema changes unexpectedly causing these xpath tests to fail where as your tests around the orchestration will be more difficult to troubleshoot and workout the cause of the problem.     Sample Link The sample is available from the following link: http://code.msdn.microsoft.com/testbtsxpathfunction     Other Tools On the subject of using the xpath function, if you don't already use it the below tool is very useful for creating your xpath statements (thanks BizBert) http://www.bizbert.com/bizbert/2007/11/30/XPath+The+Hidden+Language+Of+BizTalk.aspx

    Read the article

  • how to use nokogiri methods .xpath & .at_xpath

    - by Radek
    I'm learning how to use nokogiri and few questions came to me based on the code below require 'rubygems' require 'mechanize' post_agent = WWW::Mechanize.new post_page = post_agent.get('http://www.vbulletin.org/forum/showthread.php?t=230708') puts "\nabsolute path with tbody gives nil" puts post_page.parser.xpath('/html/body/div/div/div/div/div/table/tbody/tr/td/div[2]').xpath('text()').to_s.strip.inspect puts "\n.at_xpath gives an empty string" puts post_page.parser.at_xpath("//div[@id='posts']/div/table/tr/td/div[2]").at_xpath('text()').to_s.strip.inspect puts "\ntwo lines solution with .at_xpath gives an empty string" rows = post_page.parser.xpath("//div[@id='posts']/div/table/tr/td/div[2]") puts rows[0].at_xpath('text()').to_s.strip.inspect puts puts "two lines working code" rows = post_page.parser.xpath("//div[@id='posts']/div/table/tr/td/div[2]") puts rows[0].xpath('text()').to_s.strip puts "\none line working code" puts post_page.parser.xpath("//div[@id='posts']/div/table/tr/td/div[2]")[0].xpath('text()').to_s.strip puts "\nanother one line code" puts post_page.parser.at_xpath("//div[@id='posts']/div/table/tr/td/div[2]").xpath('text()').to_s.strip puts "\none line code with full path" puts post_page.parser.xpath("/html/body/div/div/div/div/div/table/tr/td/div[2]")[0].xpath('text()').to_s.strip is it better to use // or / in xpath? @AnthonyWJones says that 'the use of an unprefixed //' is not so good idea I had to remove tbody from any working xpath otherwise I got 'nil' result. How is possible to remove an element from the xpath to get things work? do I have to use .xpath twice to extract data if not using full xpath? why I cannot make .at_xpath working to extract data? it works nicely here what is the difference?

    Read the article

  • Why doesn't libxml2 support XPath 2.0?

    - by Peter Krauss
    Libxml2 is the faster, stable and most popular "open DOM engine"... And the "XML C parser and toolkit of Gnome". The initial release of Libxml2 was September 1999, 13 years ago. XPath v1.0 was also released at 1999. XPath v2.0 became a recommendation on January 2007, 6 years ago. We can suppose that the Libxml2 community have time and people to develop a XPath2... So, what is the problem? Why doesn't libxml2 (or a "libxml2 fork" or an "experimental lib"!) support XPath 2.0? Some raised hypotheses to discussion at answers, Because Libxml2 community (and Gnome community) dislikes and have no motivation to develop something to XPath2 or xQuery. 1.1. XPath2 needs (by mathematical proof) a very heavy parser, much slower, etc. that is not suitable to real-world Libxml2 applications. 1.2. Other "ideologic" dislikes/motivations. Because it is written with C, and for XPath2 is better to develop with C++. Because the above hypothesis of "Libxml2 community have time and people" is false. Because XPath2 became stable in 2010 with its "Second Edition" release, and ~2.5 years is not (?) enough time.

    Read the article

  • Xpath question Xml Xpath

    - by Ibrar Afzal
    I need an xpath expression that would return the value of I need to get the value of this node. the value to extract is my xpath expression is //rates/rate[loantype='30-Year Fixed Rate'] The issue hre is that there are three value each node has a subtype element. Beside fileter for loantype I also need to filter for subtype. I am not sure how to do it in xpath. I have the following xml 40-Year Fixed Rate A 3 5.375 1.000 5.491 0 1 40-Year Fixed Rate B 5.500 0.500 5.579 0 1 40-Year Fixed Rate C 5.625 0.000 5.667 0 1 30-Year Fixed Rate A 3 5.000 1.000 5.134 0 1 30-Year Fixed Rate B 5.125 0.500 5.215 0 1 30-Year Fixed Rate C 5.250 0.000 5.297 0 1 20-Year Fixed Rate A 3 4.875 1.000 5.055 0 1 20-Year Fixed Rate B 5.000 0.500 5.121 0 1 20-Year Fixed Rate C 5.125 0.000 5.187 0 1 15-Year Fixed Rate A 3 4.250 1.000 4.467 0 1 15-Year Fixed Rate B 4.375 0.500 4.512 0 1 15-Year Fixed Rate C 4.500 0.000 4.570 0 1 10-Year Fixed Rate A 3 4.125 1.000 4.435 0 1 10-Year Fixed Rate B 4.250 0.500 4.454 0 1 10-Year Fixed Rate C 4.375 0.000 4.473 0 1 High-Balance 15-Year Fixed Rate D 3 4.250 1.000 4.461 0 1 High-Balance 15-Year Fixed Rate B 4.375 0.500 4.512 0 1 High-Balance 15-Year Fixed Rate C 4.500 0.000 4.563 0 1 High-Balance 30-Year Fixed Rate D 3 5.000 1.000 5.130 0 1 High-Balance 30-Year Fixed Rate B 5.125 0.500 5.211 0 1 High-Balance 30-Year Fixed Rate C 5.250 0.000 5.293 0 1 30-Year Fixed Rate Jumbo A 2 5.125 1.000 5.254 1 1 30-Year Fixed Rate Jumbo B 5.250 0.500 5.336 1 1 30-Year Fixed Rate Jumbo C 5.375 0.000 5.417 1 1 -- 15-Year Fixed Rate Jumbo A 2 5.000 1.000 5.220 1 1 15-Year Fixed Rate Jumbo B 5.125 0.500 5.270 1 1 15-Year Fixed Rate Jumbo C 5.250 0.000 5.320 1 1 -- 3/1 30-Year Adjustable Rate A 3 3.625 1.000 3.431 0 0 3/1 30-Year Adjustable Rate B 3.875 0.500 3.448 0 0 3/1 30-Year Adjustable Rate C 4.125 0.000 3.465 0 0 3/1 40-Year Adjustable Rate A 3 3.875 1.000 3.438 0 0 3/1 40-Year Adjustable Rate B 4.125 0.500 3.453 0 0 3/1 40-Year Adjustable Rate C 4.375 0.000 3.467 0 0 5/1 30-Year Adjustable Rate A 3 3.375 1.000 3.401 0 0 5/1 30-Year Adjustable Rate B 3.625 0.500 3.457 0 0 5/1 30-Year Adjustable Rate C 3.875 0.000 3.514 0 0 5/1 40-Year Adjustable Rate A 3 3.625 1.000 3.441 0 0 5/1 40-Year Adjustable Rate B 3.875 0.500 3.481 0 0 5/1 40-Year Adjustable Rate C 4.125 0.000 3.531 0 0 7/1 30-Year Adjustable Rate A 3 3.875 1.000 3.670 0 0 7/1 30-Year Adjustable Rate B 4.125 0.500 3.755 0 0 7/1 30-Year Adjustable Rate C 4.375 0.000 3.841 0 0 10/1 30-Year Adjustable Rate A 3 4.375 1.000 4.092 0 0 10/1 30-Year Adjustable Rate B 4.625 0.500 4.217 0 0 10/1 30-Year Adjustable Rate C 4.875 0.000 4.342 0 0 -- 2/2 ARM 30-Year (Purchase only) DH 5.250 0.000 3.709 0 0 -- High-Balance 5/1 30-Year Adjustable Rate D 3 3.375 1.000 3.366 0 0 High-Balance 5/1 30-Year Adjustable Rate B 3.625 0.500 3.404 0 0 High-Balance 5/1 30-Year Adjustable Rate C 3.875 0.000 3.454 0 0 High-Balance 7/1 30-Year Adjustable Rate D 3 3.875 1.000 3.670 0 0 High-Balance 7/1 30-Year Adjustable Rate B 4.125 0.500 3.755 0 0 High-Balance 7/1 30-Year Adjustable Rate C 4.375 0.000 3.841 0 0 3/1 30-Year Jumbo Adjustable Rate A 2 4.875 1.000 3.719 1 0 3/1 30-Year Jumbo Adjustable Rate B 5.000 0.500 3.708 1 0 3/1 30-Year Jumbo Adjustable Rate C 5.125 0.000 3.704 1 0 -- 3/1 40-Year Jumbo Adjustable Rate A 2 5.250 1.000 3.733 1 0 3/1 40-Year Jumbo Adjustable Rate B 5.375 0.500 3.727 1 0 3/1 40-Year Jumbo Adjustable Rate C 5.500 0.000 3.725 1 0 -- 5/1 30-Year Jumbo Adjustable Rate A 3 4.375 1.000 3.791 1 0 5/1 30-Year Jumbo Adjustable Rate B 4.500 0.500 3.803 1 0 5/1 30-Year Jumbo Adjustable Rate C 4.625 0.000 3.814 1 0 5/1 40-Year Jumbo Adjustable Rate A 2 5.000 1.000 3.922 1 0 5/1 40-Year Jumbo Adjustable Rate B 5.125 0.500 3.925 1 0 5/1 40-Year Jumbo Adjustable Rate C 5.250 0.000 3.936 1 0 -- 7/1 30-Year Jumbo Adjustable Rate A 3 4.950 1.000 4.261 1 0 7/1 30-Year Jumbo Adjustable Rate B 5.075 0.500 4.286 1 0 7/1 30-Year Jumbo Adjustable Rate C 5.200 0.000 4.311 1 0 2/2 ARM 30-Year Jumbo (Purchase only) DH 6.500 0.000 4.260 1 0 -- 30 Due in 7 Fixed Rate JUMBO Balloon A 6.375 1.000 6.613 1 0 30 Due in 7 Fixed Rate JUMBO Balloon B 6.500 0.500 6.625 1 0 40 due in 7 Fixed Rate offer1 5.250 0.000 5.374 0 0 1 40 Due in 7 Fixed Rate JUMBO Balloon offer2 6.500 0.000 6.625 1 0 1 Interest Only HELOC A To 80% LTV 3.250 0 1 Home Equity Loan - 7Yrs A Up to $100,000.00 Up to 75% LTV 6.000 6.000 0 2 Home Equity Loan - 7Yrs A $100,000.01 - $250,000.00 Up to 75% LTV 6.00 6.153 0 2 Home Equity Loan - 7Yrs A Up to $100,000.00 Up to 80% LTV 6.250 6.250 0 2 Home Equity Loan - 7Yrs A $100,000.01 - $250,000.00 Up to 80% LTV 6.25 6.403 0 2 Home Equity Loan - 7Yrs B $100,000.01 - $250,000.00 Up to 90% LTV 6.99 7.145 0 2 Home Equity Loan - 10,15Yrs C $5,000-$250,000.00 To 75% LTV 6.50 6.612 0 2 Home Equity Loan - 10,15Yrs C $5,000-$250,000.00 To 80% LTV 6.75 6.863 0 2 Home Equity Loan - 10,15Yrs D $5,000-$250,000.00 Up to 90% LTV 7.50 7.614 0 2 Home Equity Loan - 20Yrs E $5,000-$250,000.00 To 75% LTV 7.50 7.566 0 2 Home Equity Loan - 20Yrs E $5,000-$250,000.00 To 80% LTV 7.75 7.817 0 2 Home Equity Loan - 20Yrs F $5,000-$250,000.00 Up to 90% LTV 8.50 8.569 0 2 Equity Edge $5,000-$25,000.00 Up to 125% LTV 12.00 12.188 Current Index 0.350 Prime Index 3.250 03/26/2010

    Read the article

  • The XPath @root-node-position attribute info

    - by Igor Savinkin
    I couldn't find the @root-node-position XPath attribute info. Would you give me a link of where i can read about it? Is it XPath 2.0? The code (not mine) is ../preceding-sibling::div[1]/div[@root-node-position]/div applied to this HTML: <div class="left"> <div class='prod2'> <div class='name'>Dell Latitude D610-1.73 Laptop Wireless Computer </div>2 GHz Intel Pentium M, 1 GB DDR2 SDRAM, 40 GB </div> <div class='prod1'> <div class='name'>Samsung Chromebook (Wi-Fi, 11.6-Inch) </div>1.7 GHz, 2 GB DDR3 SDRAM, 16 GB </div> </div> <div class="right"> <div class='price2'>$239.95</div> <div class='price1 best'>$249.00</div> </div> Firstly i fetch a price text under class='right' with this query : //DIV[contains(@class,'best')] and then i apply the above mentioned XPath with @root-node-attribute under class='left' to retrieve the rest of the record info.

    Read the article

  • XPath to find element based on another XPath element

    - by martymcfly
    Hi, I have an Java AST and I try to find a variable inside it via XPath. Lets say the variable is called 'foobar' I could use //VariableDeclarator/VariableDeclaratorId[@Image='foobar'] but what if I dont know the text 'foobar', but want to read it from another element //VariableDeclarator/VariableDeclaratorId[@Image=//SynchronizedStatement/Expression/PrimaryExpression/PrimaryPrefix/Name] the 'Name' node has the information 'foobar' in @Image, but PrimaryPrefix/Name[@Image] does not work. How must I rewrite the condition //SynchronizedStatement/Expression/PrimaryExpression/PrimaryPrefix/Name that it is the same as @Image='foobar' ? Thanks

    Read the article

  • Short hand for number of tags having lengthier [and almost same] Xpath

    - by infant programmer
    For example : this is an xslt <xsl:template match="/root/sub-root/parent/child/grand_child/dummy1/dummy2/dummy3/dummy4/node_1 |/root/sub-root/parent/child/grand_child/dummy1/dummy2/dummy3/dummy4/node_2 |/root/sub-root/parent/child/grand_child/dummy1/dummy2/dummy3/dummy4/node_3 . . |/root/sub-root/parent/child/grand_child/dummy1/dummy2/dummy3/dummy4/node_N"/> In the above code can I use the XPath /root/sub-root/parent/child/grand_child/dummy1/dummy2/dummy3/dummy4 only once [use the braces or whatever] and reduce the bulkiness of the code? As you can see, all the nodes are siblings of each-other, so except their name their Xpath is same. Is there any short-hand property ? Does XSLT 1.0 (or Xpath1.0) allows it?

    Read the article

  • VBScript and Xpath excluding duplicates [closed]

    - by Malachi
    I am trying to pull names from an XML Document using a vbscript. XML Document structure <Aliases> <Alias PartyType="DF" CaseID="000000" NameType=""> Name Name</Alias> <Alias PartyType="DF" CaseID="000000" NameType=""> Name Name</Alias> <Alias PartyType="DF" CaseID="000000" NameType=""> Name Name</Alias> ... </Aliases> the XML File might have 100 rows with the same name coming from several different CaseID's because for this part of my vbscript I am trying to pull all the different Names from all cases, but here is the issue, I don't want to return duplicates. is there a way to do this with an xPath Expression or should I try to do this with VBScript? EDIT I am pretty sure that I am going to have to do this with VBScript. Would it be Faster and more efficient to solve this issue in VBScript, xPath, or in populating the XML I am retrieving information from ( this might prove more difficult than the other two options ) I am also asking a Similar question on stackoverflow

    Read the article

  • xpath find if node exists

    - by EddyR
    Using a xpath query how do you find if a node (tag) exists at all? For example if I needed to make sure a website page has the correct basic structure like /html/body and /html/head/title

    Read the article

  • XPath select certain amount of levels only

    - by Psytronic
    If I have an xml structure like this <root <sub <node / <node / </sub <sub <node / <sub <sub <sub <node / </sub </sub <sub <sub <sub <node / </sub <node / </sub </sub <node / <node / </root Is there an xpath syntax which will only select the first three levels of nodes? so it will collect <root <sub <node / <node / </sub <sub / <sub <sub / </sub <sub <sub / </sub <node / <node / </root Thanks, Psy

    Read the article

  • XPATH Query: How to get two elements?

    - by Damiano
    Hello My HTML code is: <table> <tr> <td class="data1"><p>1</td></td> <td class="data1"><p>2</td></td> <td class="data1"><p>3</td></td> <td class="data1"><p>4</td></td> </tr> <tr> <td class="data1"><p>5</td></td> <td class="data1"><p>6</td></td> <td class="data1"><p>7</td></td> <td class="data1"><p>8</td></td> </tr> </table> My query is: xpath='//tr//td[@class="data1"][4]/p' The results is: <p>4</p> <p>8</p> The results is correct! but, if I want to get example: <p>3</p> <p>4</p> <p>7</p> <p>8</p> So [3]/p and [4]/p How to get these two elements each <tr> ? Thank you so much!

    Read the article

  • Dynamic Grouping and Columns

    - by Tim Dexter
    Some good collaboration between myself and Kan Nishida (Oracle BIP Consulting) over at bipconsulting on a question that came in yesterday to an internal mailing list. Is there a way to allow columns to be place into a template dynamically? This would be similar to the Answers Column selector. A customer has said Crystal can do this and I am trying to see how BI Pub can do the same. Example: Report has Regions as a dimension in a table, they want the user to select a parameter that will insert either Units or Dollars without having to create multiple templates. Now whether Crystal can actually do it or not is another question, can Publisher? Yes we can! Kan took the first stab. His approach, was to allow to swap out columns in a table in the report. Some quick steps: 1. Create a parameter from BIP server UI 2. Declare the parameter in RTF template You can check this post to see how you can declare the parameter from the server. http://bipconsulting.blogspot.com/2010/02/how-to-pass-user-input-values-to-report.html 3. Use the parameter value to condition if a particular column needs to be displayed or not. You can use <?if@column:.....?> syntax for Column level IF condition. The if@column is covered in user documentation. This would allow a developer to create a report with the parameter or multiple parameters to allow the user to pick a column to be included in the report. I took a slightly different tack, with the mention of the column selector in the Answers report I took that to mean that the user wanted to select more of a dimensional column and then have the report recalculate all its totals and subtotals based on that selected column. This is a little bit more involved and involves some smart XSL and XPATH expressions, but still very doable. The user can select a column as a parameter, that is passed to the template rather than the query. The parameter value that is actually passed is the element name that you want to regroup the data by. Inside the template we then reference that parameter value in our for-each-group loop. That's where we need the trixy XSL/XPATH code to get the regrouping to happen. At this juncture, I need to hat tip to Klaus, for his article on dynamic sorting that he wrote back in 2006. I basically took his sorting code and applied it to the for-each loop. You can follow both of Kan's first two steps above i.e. Create a parameter from BIP server UI - this just needs to be based on a 'list' type list of value with name/value pairs e.g. Department/DEPARTMENT_NAME, Job/JOB_TITLE, etc. The user picks the 'friendly' value and the server passes the element name to the template. Declare the parameter in RTF template - been here before lots of times right? <?param@begin:group1;'"DEPARTMENT_NAME"'?> I have used a default value so that I can test the funtionality inside the template builder (notice the single and double quotes.) Next step is to use the template builder to build a re-grouped report layout. It does not matter if its hard coded right now; we will add in the dynamic piece next. Once you have a functioning template that is re-grouping correctly. Open up the for-each-group field and modify it to use the parameter: <?for-each-group:ROW;./*[name(.) = $group1]?> 'group1' is my grouping parameter, declared above. We need the XPATH expression to find the column in the XML structure we want to group that matches the one passed by the parameter. Its essentially looking through the data tree for a match. We can show the actual grouping value in the report output with a similar XPATH expression <?./*[name(.) = $group1]?> In my example, I took things a little further so that I could have a dynamic label for the parameter value. For instance if I am using MANAGER as the parameter I want to show: Manager: Tim Dexter My XML elements are readable e.g. DEPARTMENT_NAME. Its a simple case of replacing the underscore with a space and then 'initcapping' the result: <?xdoxslt:init_cap(translate($group1,'_',' '))?> With this in place, the user can now select a grouping column in the BIP report viewer and the layout will re-group the data and any calculations based on that column. I built a group above report but you could equally build the group left version to truly mimic the Answers column selector. If you are interested you can get an example report, sample data and layout template here. Of course, you can combine Klaus' dynamic sorting, Kan's conditional column approach and this dynamic grouping to build a real kick ass report for users that will keep them happy for hours..

    Read the article

  • Finding the XPath with the node name

    - by julien.schneider(at)oracle.com
    A function that i find missing is to get the Xpath expression of a node. For example, suppose i only know the node name <theNode>, i'd like to get its complete path /Where/is/theNode.   Using this rather simple Xquery you can easily get the path to your node. declare namespace orcl = "http://www.oracle.com/weblogic_soa_and_more"; declare function orcl:findXpath($path as element()*) as xs:string { if(local-name($path/..)='') then local-name($path) else concat(orcl:findXpath($path/..),'/',local-name($path)) }; declare function orcl:PathFinder($inputRecord as element(), $path as element()) as element(*) { { for $index in $inputRecord//*[local-name()=$path/text()] return orcl:findXpath($index) } }; declare variable $inputRecord as element() external; declare variable $path as element() external; orcl:PathFinder($inputRecord, $path)   With a path         <myNode>nodeName</myNode>  and a message         <node1><node2><nodeName>test</nodeName></node2></node1>  the result will be         node1/node2/nodeName   This is particularly useful when you use the Validate action of OSB because Validate only returns the xml node which is in error and not the full location itself. The following OSB project reuses this Xquery to reformat the result of the Validate Action. Just send an invalid xml like <myElem http://blogs.oracle.com/weblogic_soa_and_more"http://blogs.oracle.com/weblogic_soa_and_more">      <mySubElem>      </mySubElem></myElem>   you'll get as nice <MessageIsNotValid> <ErrorDetail  nbr="1"> <dataElementhPath>Body/myElem/mySubElem</dataElementhPath> <message> Expected element 'Subelem1@http://blogs.oracle.com/weblogic_soa_and_more' before the end of the content in element mySubElem@http://blogs.oracle.com/weblogic_soa_and_more </message> </ErrorDetail> </MessageIsNotValid>   Download the OSB project : sbconfig_xpath.jar   Enjoy.            

    Read the article

  • Using XPath on String in Android (JAVA)

    - by Rav
    I am looking for some examples of using xpath in Android? Or if anyone can share their experiences. I have been struggeling to make tail or head of this problem :-( I have a string that contains a standard xml file. I believe I need to convert that into an xml document. I have found this code which I think will do the trick: public static Document stringToDom(String xmlSource) throws SAXException, ParserConfigurationException, IOException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(new InputSource(new StringReader(xmlSource))); } Next steps Assuming the code above is OK, I need to apply xpath to get values from cat: "/animal/mammal/feline/cat" I look at the dev doc here: http://developer.android.com/reference/javax/xml/xpath/XPath.html and also look online, but I am not sure where to start! I have tried to use the following code: XPathFactory xPathFactory = XPathFactory.newInstance(); // To get an instance of the XPathFactory object itself. XPath xPath = xPathFactory.newXPath(); // Create an instance of XPath from the factory class. String expression = "SomeXPathExpression"; XPathExpression xPathExpression = xPath.compile(expression); // Compile the expression to get a XPathExpression object. Object result = xPathExpression.evaluate(xmlDocument); // Evaluate the expression against the XML Document to get the result. But I get "Cannot be resolved". Eclipse doesn't seem to be able to fix this import. I tried manually entering: javax.xml.xpath.XPath But this did not work. Does anyone know any good source code that I can utilise, for Android platform? 1.5

    Read the article

  • Select on multiple criteria with XPath

    - by Matt Thrower
    I have an XML document which looks something like this: <meadinkent> <record> <comp_div>MENSWEAR</comp_div> <sty_ret_type>ACCESSORIES</sty_ret_type> <sty_pdt_type>BELTS</sty_pdt_type> <pdt_category>AWESOME_BELTS</pdt_category> </record> <medinkent> I want to useXPath to select nodes which match all four elements and I'm having trouble getting the boolean syntax right. I'm trying this to match the first two just as a test: "/meadinkent/record/comp_div[.='" & comp_div & "'] and /meadinkent/record/sty_ret_type[.='" & sty_ret_type & "']" Which is failing, saying no nodes are returned. Obviously I'm being very stupid - what am I doing wrong? Cheers, mAtt

    Read the article

  • Xpath help. Get childnode with variable name

    - by Kim Andersen
    I have the following XML: <StatsContainer> <Variant1>0</Variant1> <Variant2>0.5</Variant2> <Variant3>1.2</Variant3> <Variant4>4.1</Variant4> <Variant5>93.9</Variant5> <Variant6>0.3</Variant6> <Variant7>0</Variant7> <Variant8>0</Variant8> <Variant9>0</Variant9> <Variant10>0</Variant10> <Variant11>0</Variant11> <Variant12>0</Variant12> <GlobalVariant1>4.6</GlobalVariant1> <GlobalVariant2>40.4</GlobalVariant2> <GlobalVariant3>13.8</GlobalVariant3> <GlobalVariant4>2.8</GlobalVariant4> <GlobalVariant5>35.6</GlobalVariant5> <GlobalVariant6>2.8</GlobalVariant6> <GlobalVariant7>0</GlobalVariant7> <GlobalVariant8>0</GlobalVariant8> <GlobalVariant9>0</GlobalVariant9> <GlobalVariant10>0</GlobalVariant10> <GlobalVariant11>0</GlobalVariant11> <GlobalVariant12>0</GlobalVariant12> <MosaicType>Boligtype</MosaicType> <OverRepresentedVariant>5</OverRepresentedVariant> </StatsContainer> As you can see I have a number in the "OverRepresentedVariant"-tag. This number can change from time to time. What i Need is to grab the "Variant"-tag with the right number. In the above case I need to get the value from the "Variant5"-tag (93.9). Tomorrow the "OverRepresentedVariant"-value might have changed to 3, this would mean that I should now grab the "Variant3"-value instead. So this is what I got. I have a variable called $btOver which contains the above XML. I also have a variable called $btId which contains the "OverRepresentedVariant"-value like this: <xsl:variable name="btId" select="$btOver/OverRepresentedVariant" /> So now I need some help finding the Variant-tags with the right ID. The tags that I need will always be named "Variant" followed by an id. So how can I get the right tag? Thanks a lot in advance folks. /Kim Andersen

    Read the article

  • XPath - Quering two XML documents

    - by Arnej65
    I have have two xml docs: XML1: <Books> <Book id="11"> ....... <AuthorName/> </Book> ...... </Books> XML2: <Authors> <Author> <BookId>11</BookId> <AuthorName>Smith</AuthorName> </Author> </Authors> I'm trying to do the following: Get the value of XML2/Author/AuthorName where XML1/Book/@id equals XML2/Author/BookId. XML2/Author/AuthorName[../BookId = XML1/Book/@id]

    Read the article

  • XPath - get parent node

    - by chris.shi
    //* [ local-name()='component' and namespace-uri()='urn:hl7-org:v3' ] using thispath ,I can get a node like this: <component xmlns="urn:hl7-org:v3"> <structuredBody> <component> <section> <code code="10164-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/> <title>History of Present Illness</title> <text> </text> </section> </component> <component> ...... </component> <component> ...... </component> <structuredBody/> <component/> in order to get the node as below: <component> <section> <code code="10164-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/> <title>History of Present Illness</title> <text> </text> </section> </component> I change the path to : //* [ local-name()='component' and namespace-uri()='urn:hl7-org:v3' and position()=1] but ,how can I get the same result by using [code="10164-2"] as a qualification. ( I do not know how to describe this question ,as a result ,the title of this question is a little simple ,sorry .) thanks

    Read the article

  • XPath select tags by id not descendants of

    - by Stefano
    I have the following code and I have to select all the nodes with id="text" but not the nodes that already have a parent with id="text": test00 test01 test02 * test03 * so in this example the query have to return only the two fo:block with content test00 and test03. Thank you.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >