Search Results

Search found 3646 results on 146 pages for 'osb validate xquery xpath'.

Page 11/146 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • PHP DOMXml XPath of recursive Xpointer

    - by user256007
    My xml document reflects an Object. as referential Recursion is possible in objects and arrays. I need to reflect that in reproduced XML Structure too. Currently I am using Unique IDs to identify each node separately and a node like <recursion refer="IDREF"> and specifying the ID of the referenced Element. But in This way I need My Own Custom XPath resolver cause I want to let the users go deeper into the recursive node through the Identifying IDREF (Hope I am able to make you understand). So is there any better/liteweight solution ?? might be XPointer or XLink (I am not sure). Any help ??

    Read the article

  • Check for default value of attribute in XPath

    - by iref
    Hi, i have XML schema: <xsd:complexType name="contactsType"> <xsd:sequence> <xsd:element name="contact" type="contactType" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> <xsd:attribute name="visible" type="xsd:boolean" default="true"/> </xsd:complexType> and i want to find all contacts which have @visible=true, //contacts[@visible='true'] but this expression doesn' t return nodes without set @visible like this: <contacts /> so i want to know if there is any function in XPath which returns also default values of attributes Thanks Jan

    Read the article

  • Xpath how to select an element based on an order and dependent of its existence

    - by hokkos
    Hi, how to select an element based on an order and dependent of its existence in XPath ? For example how to select the best quality video if it exist. <VIDEOS> <LOW_RES>video_L.flv</LOW_RES> <HI_RES>video_H.flv</HI_RES> <HD/> </VIDEOS> this should return video_H.flv because the hd version doesn't exist this case can exist (the videos names can be random): <VIDEOS> <LOW_RES>video_L.flv</LOW_RES> <HI_RES>video_H.flv</HI_RES> <HD>video_hd.mp4</HD> </VIDEOS> this should return video_hd.mp4 because the hd version exist. Many thanks.

    Read the article

  • How to simplify this Xpath expression ?

    - by Stephan
    Hi , I have the following XML code : <root> <a><l_desc/></a> <b><l_desc>foo</l_desc></b> <c><l_desc>bar</l_desc></c> </root> I want to match the l_desc nodes with a or b nodes as parent. For now, i use this xpath expression : //a/l_desc/.. | //b/l_desc/.. I would prefer writing something like this : //(a|b)/l_desc/.. Unfortunately, this expression is invalid. Do you have any idea for reducing the first expression ? Stéphan

    Read the article

  • Most Lite-Weight XML Parser with XPath and Wide-char Support

    - by Mystagogue
    I want a lite-weight C++ XML parser/DOM that: Can take UTF-8 as input, and parse into UTF-16. Maybe it does this directly (ideal!), or perhaps it provides a hook for the conversion (such as taking a custom stream object that does the conversion before parsing). Offers some XPath support. I've been looking at RapidXML, the Kranf xmlParser, and pugiXML. The first two of those might permit requirement #1 by way of a hook. The third, pugiXML, supports the #2 requirement. But none of those three fulfill both requirements. What is the smallest (free) library that can handle both requirements?

    Read the article

  • finding highlighted(preselcted) text using xpath or css

    - by doneright
    In following 2 snippets of html code, I'm trying to create xpath or css for finding if span(Element1 in snippet 1 and Element 2 in snippet 2) are highlighted(preselected) when page is loaded <div id="idc" class="tre"> <ul id="idCatT_srt_ul" class="abc"> <li class="treN treB treSelected" title="Element1 title"> <span class="spclass">Element1</span> </li> </ul> </div> Element 2 Text

    Read the article

  • XML, XPATH adding values

    - by user575373
    hello, i have XML files which contain records with the following structure: <payment contractType="1"> <income type="0"> <gr code="1" amount="1506.00"/> <gr code="4" amount="35.00"/> <gr code="10" amount="288.14"/> <de code="3011300" amount="138.72"/> <de code="3081100" amount="48.81"/> <de code="3082400" amount="109.84"/> </income> <netAmount1 value="765.00"/> <netAmount2 value="765.00"/> </payment> each file has many records of type payment and i want the final xml to contain one payment record by adding all the amount values for every differrent code value I think XPath can be used for this, but I never used it before , could someone show me some Java (or else) code for this?

    Read the article

  • Invalid Token when using XPath

    - by Andy5
    Hi I am making a modification to a web application using XPath, and when executed I get an error message - Invalid token! This is basic what I am doing public xmlNode GetSelection (SelectParams params, xmldocument docment) { xpathstring = string.format("Name =\'{0}' Displaytag = \'{1}' Manadatory=\'{2}', params.Name, params.Displaytag, params.Manadatory); return document.selectsinglenode(xpathstring); } As you can see, I am making a string and setting values on the nodes I am trying to find against my xml document, and thus returning xml data that matches my parameters. What is happening is that I am getting an xpathexeception error in Visual Studio and it says invalid token. I do know that in the xml document that the parameters I am looking in the tags have double quotes, for example, Name="ABC". So, I thought the problem could be solved using an "\". Can anyone help? Update from comments In the Xml Document, the tag has attributes where they are set as Name="ABC" Displaytag="ATag" Manadatory="true".

    Read the article

  • Java xpath selection

    - by Travis
    I'm having a little trouble getting values out of an XML document. The document looks like this: <marketstat> <type id="35"> <sell> <median>6.00</median> </sell> </type> <type id="34"> <sell> <median>2.77</median> </sell> </type> </marketstat> I need to get the median where type = x. I've always had trouble figuring out xpath with Java and I can never find any good tutorials or references for this. If anyone could help me figure this out that would be great.

    Read the article

  • Xpath - How to get all the attribute names and values of an element

    - by BBDeveloper
    I am using xpath in java. I want to get all the attributes (name & Value) of an element. I found the query to get the attribute values of an element, now I want to get attribute names alone or names and values in single query. <Element1 ID="a123" attr1="value1" attr2="value2" attr3="value3" attr4="value4" attr5="value5" /> Here using the following query to get all the attribute values of Element1 XmlUtils.getAttributes(Path, String.format("//*/@*")); Using this format //*/@* I can get the values. result would be value1 value2 value3 value4 value5 a123 Now I want to know the query to get all the attribute names, or query to get all the attributes name and value.

    Read the article

  • Get a string sequence from a node-set in xpath 1.0

    - by Miguel
    I'm using xpath 1.0 to parse an html file and I want to get a string sequence from a node-set. First I select a node-set (eg: //div) and then I want the string-value of each node of the set. I've tried with string(//div) but it only returns the string-value of the first node in the set. Example <foo> <div> bbbb<p>aaa</p> </div> <div> cccc<p>aaa</p> </div> </foo> I expect a result like ('bbbbaaa', 'ccccaaa') but I only get 'bbbaaa'

    Read the article

  • Get a single element with PHP and XPath

    - by daliz
    Lots of tutorials around the net but none of them can explain me this: How do I select a single element (in a table, for example), having its absolute XPath? Example: I have this: /html/body/table/tbody/tr[2]/td[2]/table/tbody/tr/td/table[3]/tbody/tr/td/table/tbody/tr[3]/td/table/tbody/tr[4]/td[5]/span What's that PHP function to get the text of that element?! Really I could not find an answer. Found lots of guides and hints to get all the elements of the table, all the buttons of a form, etc, but not what I need. Thank you.

    Read the article

  • XPath conditional text node selection

    - by Reinderien
    Hi there. I need to construct an xpath string to select all descendants of a certain table with these conditions: The table is a descendant of a form with a specific action attribute value. The selected descendants are text nodes. The text node content can only contain whitespace. It'll probably look something like: //form[@action = "submit.html"]//table//text()[ ...? ] Any tips would be appreciated. Thanks. Edit: For clarity, here is my current (working) compromise: function KillTextNodes(rootpath) { XPathIterate(rootpath + '//text()', function(node) { var tagname = node.parentNode.tagName; if (tagname != 'OPTION' && tagname != 'TH') Kill(node); }); }

    Read the article

  • PHP XPath - how to get value from result

    - by LeeTee
    I have the followng XML file from Ebay <GeteBayDetailsResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>2012-07-04T12:02:14.541Z</Timestamp><Ack>Success</Ack><Version>779</Version><Build>E779_INTL_BUNDLED_14986004_R1</Build><SiteDetails><Site>US</Site><SiteID>0</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Canada</Site><SiteID>2</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>UK</Site><SiteID>3</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Germany</Site><SiteID>77</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Australia</Site><SiteID>15</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>France</Site><SiteID>71</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>eBayMotors</Site><SiteID>100</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Italy</Site><SiteID>101</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Netherlands</Site><SiteID>146</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Spain</Site><SiteID>186</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>India</Site><SiteID>203</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>HongKong</Site><SiteID>201</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Singapore</Site><SiteID>216</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Malaysia</Site><SiteID>207</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Philippines</Site><SiteID>211</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>CanadaFrench</Site><SiteID>210</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Poland</Site><SiteID>212</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Belgium_Dutch</Site><SiteID>123</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Belgium_French</Site><SiteID>23</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Austria</Site><SiteID>16</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Switzerland</Site><SiteID>193</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><SiteDetails><Site>Ireland</Site><SiteID>205</SiteID><DetailVersion>1</DetailVersion><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></SiteDetails><UpdateTime>2009-07-09T10:48:17.000Z</UpdateTime></GeteBayDetailsResponse> I need to get the value of node SiteID where the node Site matches whatever variable I pass. The code I have is: $xml_file ='SiteDetails.xml'; $xmlDoc = new DomDocument(); $xmlDoc->load($xml_file); $xpath = new DOMXpath($xmlDoc); $siteIDList = $xpath->query("/GeteBayDetailsResponse/SiteDetails[Site=$site]/SiteID"); var_dump($siteIDList); echo $siteIDList->SiteID; I get the following result: object(DOMNodeList)#11 (0) { } Can anyone help? I want to get a value of 3.

    Read the article

  • XPath : finding an attribute node (and only one)

    - by subtenante
    What is the XPath to find only ONE node (whichever) having a certain attribute (actually I'm interested in the attribute, not the node). For example, in my XML, I have several tags having a lang attribute. I know all of them must have the same value. I just want to get any of them. Right now, I do this : //*[1][@lang]/@lang, but it seems not to work properly, for an unknown reason. My tries have led me to things ranging from concatenation of all the @lang values ('en en en en...') to nothing, with sometimes inbetween what I want but not on all XML. EDIT : Actually //@lang[1] can not work, because the function position() is called before the test on a lang attribute presence. So it always takes the very first element found in the XML. It worked best at the time because many many times, the lang attribute was on root element.

    Read the article

  • xslt and xpath: match preceding comments

    - by miasbeck
    given this xml: <root> <list> <!-- foo's comment --> <item name="foo" /> <item name="bar" /> <!-- another foo's comment --> <item name="another foo" /> </list> </root> I'd like to use a XPath to select all item-nodes that have a comment immediately preceding them, that is I like to select the "foo" and "another foo" items, but not the "bar" item. I already fiddled about the preceding-sibling axis and the comment() function but to no avail.

    Read the article

  • XPath 1.0 to find if an element's value is in a list of values

    - by user364902
    Is there a way to construct an XPath that evaluates whether an element's value is in a predefined list of values? Something akin to this: /Location/Addr[State='TX or AL or MA'] Which would match nodes whith State elements for Texas, Alabama, or Massachusetts? I know that I can unpack the expression: /Location/Addr[State='TX] or /Location/Addr[State='AL'], etc... But this is a bit cumbersome since the xpaths are quite long, as is the list of values. My google-fu isn't turning up much on the issue...

    Read the article

  • How to write a xpath to match all elements except a particular element

    - by Unmesh Kondolikar
    I am writing an XSL transformation. I want to write a template which matches all the child elements of the document except one particular node. My xml looks like this - <Document> <NodeA><\NodeA> <NodeB><\NodeB> <ServiceNode><\ServiceNode> <NodeX><\NodeX> </Document> I want to write a template that matches all nodes except ServiceNode i.e. NodeA to NodeX. How to write this Xpath to get - <xsl:template match="ALL Nodex Except ServiceNode">

    Read the article

  • xpath nearest element to a given element

    - by nologo
    hi, having trouble returning an element using xpath.. i need to get the text from the 2nd TD.. <tr> <td> <label for="PropertyA">Some text here </label> </td> <td> TEXT!! </td> </tr> i'm able to find the label element but then im having trouble selecting the td following to return the text. this is how i select the label: "//label[@for='PropertyA']" thanks

    Read the article

  • Improve XPath efficiency for repeated, parameterized queries

    - by Chris Allan
    Hi, I am repeatedly performing the following XPath query (though parameterized by 'keywordText') around 40,000 times: String query = SystemGlobal.YAHOO_KEYWORDSSUBNODE + "/" + SystemGlobal.YAHOO_KEYWORDNODE + "[" + SystemGlobal.YAHOO_ATTRKEYPHRASE + "='" + keywordText + "']"; CachedXPathAPI cachedXPathAPI = new CachedXPathAPI(); NodeIterator nl = cachedXPathAPI.selectNodeIterator(doc.getElementsByTagName(SystemGlobal.YAHOO_KEYWORDSROOT).item(0), query); Node n; if ((n = nl.nextNode()) != null) { keyword.setKeywordId(Long.parseLong(cachedXPathAPI.selectSingleNode(n, SystemGlobal.YAHOO_ATTRKEYID).getTextContent())); keyword.setKeyPhrase(cachedXPathAPI.selectSingleNode(n, SystemGlobal.YAHOO_ATTRKEYPHRASE).getTextContent()); keyword.setStatus(mapStatus(cachedXPathAPI.selectSingleNode(n, SystemGlobal.YAHOO_ATTRSTATUS).getTextContent())); keyword.setCampaignId(Long.parseLong(cachedXPathAPI.selectSingleNode(n, "../../" + SystemGlobal.YAHOO_ATTRCAMPAIGNID).getTextContent())); keyword.setAdGroupId(Long.parseLong(cachedXPathAPI.selectSingleNode(n, "../" + SystemGlobal.YAHOO_ATTRADGROUPID).getTextContent())); On the first run of the script, all 40,000 runs of this piece of code will have nl.nextNode() == null, and everything runs quite quickly. However, on the following runs, when nl.nextNode() != null, then things slow down a lot - this takes around an additional 40min to run (whereas the first run takes maybe 1 minute). Oh, and the doc is constructed like so: InputSource in = new InputSource(new FileInputStream(filename)); DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); dfactory.setNamespaceAware(true); doc = dfactory.newDocumentBuilder().parse(in); I tried including the following lines reportEvaluator = new XPathEvaluatorImpl(reportDoc); reportResolver = reportEvaluator.createNSResolver(reportDoc); and rather creating a NodeIterator, instead creating an XPathResult: XPathResult result = (XPathResult)reportEvaluator.evaluate(query, doc.getElementsByTagName(SystemGlobal.YAHOO_KEYWORDSROOT).item(0), reportResolver, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null); however this ran even slower Is there a way in which I can speed up the running of this script? I have seen references to precompiled queries, though I haven't seen many actual details. Also, as seen in the code, I am using CachedXPathAPI, though the benefit for this case is not so great. Any help is much appreciated! Chris Allan

    Read the article

  • Xpath that evaluates -all- attributes?

    - by Tres
    I maybe be trying to do something invalid here, but maybe someone smarter than me knows the correct syntax to solve my problem. Given: <group code="vehicle"> <line code="car"> <cell> <box code="price">1000.00</box> </cell> </line> <line code="car"> <cell code="sports"> <box code="price">500.00</box> </cell> </line> </group> If I use //*[@code="vehicle"]//*[@code="car"]//*[@code="price"], I will get both boxes returned (1000.00 and 500.00)--as expected but not what I want. Is there an xpath syntax that will evaluate against all nodes that have an attribute of @code rather than skipping it if it doesn't match with the end result being that I only get back the first box (price of 1000.00)? Like asking, choose the first node with @code and that @code must equal "vehicle", then choose the next node with @code and that @code must equal "car", then choose the next node with @code and @code must equal "price".

    Read the article

  • XPath expression for a phpBB forum

    - by Biff
    I'm writing a Greasemonkey script, and I wanted to change the text of a forum post on a phpBB2 forum by using XPath to select the body of the post that occurs after a certain username, but the whole thing is a giant mess of tables. <tr> <td> <span class="name"> <a> <b>username</b> </span> <span></span> </td> <td> <table> <tbody> <tr></tr> <tr></tr> <tr> <td> <span class="postbody">text of post</span> <span></span> </td> </tr> </tbody> </table> </td> </tr> I need to get the postbody span that happens after the username in the b tag equals a certain name, and then mess with the text.

    Read the article

  • Matching first set of elements with xpath...

    - by Ugo Enyioha
    I have an xml document that looks like this. <foo> <bar type="artist"/> Bob Marley </bar> <bar type="artist"/> Peter Tosh </bar> <bar type="artist"/> Marlon Wayans </bar> </foo> <foo> <bar type="artist"/> Bob Marley </bar> <bar type="artist"/> Peter Tosh </bar> <bar type="artist"/> Marlon Wayans </bar> </foo> <foo> <bar type="artist"/> Bob Marley </bar> <bar type="artist"/> Peter Tosh </bar> <bar type="artist"/> Marlon Wayans </bar> </foo> I would like to construct an xpath that returns only the first set: <bar type="artist"/> Bob Marley </a> <bar type="artist"/> Peter Tosh </a> <bar type="artist"/> Marlon Wayans </a> How would one go about this? I have tried //bar[@type='artist'] but it's obvious there's more to this. Thanks in advance.

    Read the article

  • Using Base SAS to validate Windows Password

    - by Bazil
    We have a signon script that requires a Windows password in order to access and validate against the SAS metadata server. The problem is that if the windows password is changed, and the script is run a few without being updated, then the user gets locked out and has to call IT support for a password reset. What is the simplest way of using Base SAS to validate a windows password? ie to enable a warning to the user if the password provided is not valid... EDIT: The concern is not whether or not this SHOULD be done, only HOW it could be done!

    Read the article

  • Find position of a node within a nodeset using xpath

    - by Phil Nash
    After playing around with position() in vain I was googling around for a solution and arrived at this older stackoverflow question which almost describes my problem. The difference is that the nodeset I want the position within is dynamic, rather than a contiguous section of the document. To illustrate I'll modify the example from the linked question to match my requirements. Note that each <b> element is within a different <a> element. This is the critical bit. <root <a <bzyx</b </a <a <bwvu</b </a <a <btsr</b </a <a <bqpo</b </a </root Now if I queried, using XPath for a/b I'd get a nodeset of the four <b> nodes. I want to then find the position within that nodeset of the node that contains the string 'tsr'. The solution in the other post breaks down here: count(a/b[.='tsr']/preceding-sibling::*)+1 returns 1 because preceding-sibling is navigating the document rather than the context node-set. Is it possible to work within the context nodeset?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >