Search Results

Search found 1542 results on 62 pages for 'xsl xpath'.

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

  • Weird XPath behavior in libxml2

    - by Josh K
    I have this XML tree that looks like this (I've changed the tag names but if you're really clever you may figure out what I'm actually doing.) <ListOfThings> <Thing foo:action="add"> <Bar>doStuff --slowly</Bar> <Index>1</Index> </Thing> <Thing foo:action="add"> <Bar>ping yourMother.net</Bar> <Index>2</Index> </Thing> </ListOfThings> With libxml2, I want to programmatically insert a new Thing tag into the ListOfThings with the Index being the highest current index, plus one. I do it like this (sanity checking removed for brevity): xpath = "//urn:myformat[@foo='bar']/" "urn:mysection[@name='baz']/" "urn:ListOfThings/urn:Thing/urn:Index"; xpathObj = xmlXPathEvalExpression(xpath, xpathCtx); nodes = xpathObj->nodesetval; /* Find last value and snarf the value of the tag */ highest = atoi(nodes->nodeTab[nodes->nodeNr - 1]->children->content); snprintf(order, sizeof(order), "%d", highest + 1); /* highest index plus one */ /* now move up two levels.. */ cmdRoot = nodes->nodeTab[nodes->nodeNr - 1]; ASSERT(cmdRoot->parent && cmdRoot->parent->parent); cmdRoot = cmdRoot->parent->parent; /* build the child tag */ newTag = xmlNewNode(NULL, "Thing"); xmlSetProp(newTag, "foo:action", "add"); /* set new node values */ xmlNewTextChild(newTag, NULL, "Bar", command); xmlNewChild(newTag, NULL, "Index", order); /* append this to cmdRoot */ xmlAddChild(cmdRoot, newTag); But if I call this function twice (to add two Things), the XPath expression doesn't catch the new entry I made. Is there a function I need to call to kick XPath in the shins and get it to make sure it really looks over the whole xmlDocPtr again? It clearly does get added to the document, because when I save it, I get the new tags I added. To be clear, the output looks like this: <ListOfThings> <Thing foo:action="add"> <Bar>doStuff --slowly</Bar> <Index>1</Index> </Thing> <Thing foo:action="add"> <Bar>ping yourMother.net</Bar> <Index>2</Index> </Thing> <Thing foo:action="add"> <Bar>newCommand1</Bar> <Index>3</Index> </Thing> <Thing foo:action="add"> <Bar>newCommand2</Bar> <Index>3</Index> <!-- this is WRONG! --> </Thing> </ListOfThings> I used a debugger to check what happened after xmlXPathEvalExpression got called and I saw that nodes->nodeNr was the same each time. Help me, lazyweb, you're my only hope!

    Read the article

  • XPath expression with condition on multiple ancestors

    - by Rest Wing
    The application I am developing receives an XML structure similar to following: <Root> <Valid> <Child name="Child1" /> <Container> <Child name="Child2" /> </Container> <Container> <Container> <Child name="Child3"/> <Child name="Child4"/> </Container> </Container> <Wrapper> <Child name="Child5" /> </Wrapper> <Wrapper> <Container> <Child name="Child19" /> </Container> </Wrapper> <Container> <Wrapper> <Child name="Child6" /> </Wrapper> </Container> <Container> <Wrapper> <Container> <Child name="Child20" /> </Container> </Wrapper> </Container> </Valid> <Invalid> <Child name="Child7" /> <Container> <Child name="Child8" /> </Container> <Container> <Container> <Child name="Child9"/> <Child name="Child10"/> </Container> </Container> <Wrapper> <Child name="Child11" /> </Wrapper> <Container> <Wrapper> <Child name="Child12" /> </Wrapper> </Container> </Invalid> </Root> I need to get a list of of Child elements under following conditions: Child is n generation descendant of Valid ancestor. Child may be m generation descendant of Container ancestor which is o generation descendant of Valid ancestor. Valid ancestors for Child element are Container elements as m generation ancestors and Valid element as first generation ancestor. where m, n, o are natural numbers. I need to write following XPath expressions Valid/Child Valid/Container/Child Valid/Container/Container/Child Valid/Container/Container/Container/Child ... as a single XPath expression. For provided example, the XPath expression would return only Child elements having name attribute equal to Child1, Child2, Child3 and Child4. The closest I have come to solution is following expression. Valid/Child | Valid//*[self::Container]/Child However, this would select Child element with name attribute equal to Child19 and Child20. Does XPath syntax supports either optional occurrence of an element or setting condition similar to self in previous example to all ancestors between Child and Valid elements?

    Read the article

  • test="" on a boolean always returns true

    - by user70448
    Why does <xsl:if test="<XPATH to boolean value here>"> ... </xsl:if> ALWAYS return true? Since boolean can be 0,1,"false" and "true" by definition, the ONLY way to test for a boolean value is to do string comparison against these. This can't be right.

    Read the article

  • Oracle performance problems with large batch of XSL operations

    - by FrustratedWithFormsDesigner
    I have a system that is performing many XSL transformations on XMLType objects. The problem is that the system gradually slows down over time, and sometimes crashes when it runs out of memory. It seems that the slow down (and possibly memory crash) is around the dbms_xslprocessor.processXSL function call, which gradually takes longer and longer to complete. The code looks like this: v_doc dbms_xmldom.DOMDocument; v_transformer dbms_xmldom.DOMDocument; v_XSLprocessor dbms_xslprocessor.Processor; v_stylesheet dbms_xslprocessor.Stylesheet; v_clob clob; ... transformer := PKG_STUFF.getXSL(); v_transformer := dbms_xmldom.newDOMDocument(transformer); v_XSLprocessor := Dbms_Xslprocessor.newProcessor; v_stylesheet := dbms_xslprocessor.newStylesheet(v_transformer, ''); ... for source_data in (select id in source_tbl) loop begin v_doc := PKG_CONVERT.convert(in_id => source_data.id); --start time of operation v_begin_op_time := dbms_utility.get_time; --reset the CLOB v_clob := ' '; --Apply XSL Transform dbms_xslprocessor.processXSL(p => v_XSLprocessor, ss => v_stylesheet, xmldoc => v_Doc, cl => v_clob); v_doc := dbms_xmldom.newDOMDocument(XMLType(v_clob)); --end time v_end_op_time := dbms_utility.get_time; --calculate duration v_time_taken := (((v_end_op_time - v_begin_op_time))); --log the duration PKG_LOG.log_message('Time taken to transform XML: '||v_time_taken); ... ... DBMS_XMLDOM.freeDocument(v_Doc); DBMS_LOB.freetemporary(lob_loc => v_clob); end loop; The time taken to transform the XML is slowly creeping up (I suppose it might also be the call to dbms_xmldom.newDOMDocument, but I had thought that to be fairly straightforward). I have no idea why.... :( (Oracle 10g)

    Read the article

  • Validate xsl fo in xslt styleesheet

    - by Biegal
    Hi, i have a little problem with validating xml, xslt in details. I have a xslt stylesheet that, transforms xml data source to xsl:fo document. Something like this: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <xsl:template match="/"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns="http://www.w3.org/1999/xhtml"> <fo:layout-master-set> <fo:simple-page-master margin-top="25mm" margin-bottom="25mm" margin-left="25mm" margin-right="25mm" page-width="210mm" page-height="297mm" master-name="simplePageLayout"> <fo:region-body region-name="xsl-region-body" column-gap="0.25in" /> <fo:region-before region-name="xsl-region-before" display-align="after" extent="0.1mm" padding-top="0pt" padding-left="0.4in" padding-right="0.4in" padding-bottom="0pt" /> <fo:region-after region-name="xsl-region-after" display-align="before" extent="0.4in" padding-top="4pt" padding-left="0.4in" padding-right="0.4in" padding-bottom="0pt" /> </fo:simple-page-master> <fo:page-sequence-master master-name="default-sequence"> <fo:repeatable-page-master-reference master-reference="simplePageLayout" /> </fo:page-sequence-master> </fo:layout-master-set> <fo:page-sequence master-reference="default-sequence"> <fo:flow flow-name="xsl-region-body"> <fo:block font-family="Segoe UI" color="#000000" font-size="9pt" /> </fo:flow> </fo:page-sequence> </fo:root> </xsl:template> What I want to do, is to validate written xsl:fo elements, ignoring xsl tags. Is it posible? For now I use dtd validation (I have xsd schema too) for validating Fo, but it give me an error on each xsl tag. Summary. Is it posiible to validate only fo elements against the schema, ignoring xsl tags, and how should I do it? Maybe a code snnippet in C#, or a hint how to modify documents? Thanks in advance!

    Read the article

  • i have code below where i need to develop the xsl-fo file using loop

    - by karthick
    <?xml version="1.0" encoding="iso-8859-1"?> <!--<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">--> <!-- Generator: Arbortext IsoDraw 7.0 --> <?xml-stylesheet type="text/xsl" href="file:///C:/Documents%20and%20Settings/Admin/Desktop/Info%20Tech/task--2/taskbaba.xsl"?> <svg width="100%" height="100%" viewBox="0 0 214.819 278.002"> <g id="Catalog"> <text transform="matrix(0.984 0 0 0.93 183.515 265.271)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174"/> <text transform="matrix(0.994 0 0 0.93 7.235 265.3)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174">087156-8-</text> <text transform="matrix(0.995 0 0 0.93 21.708 265.357)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174" font-weight="bold">AB</text> <text x="103.292" y="265.298" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174">P. 1/1</text> <g id="IC_TextBlock.1"> <g> <text transform="matrix(0.994 0 0 0.93 192.812 8.076)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="4.586" font-weight="bold">Fittings</text> <text transform="matrix(0.994 0 0 0.93 188.492 13.323)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="4.586" font-weight="bold">Raccords</text> <text transform="matrix(0.994 0 0 0.93 183.431 18.571)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="4.586" font-weight="bold">Conexiones</text> </g> </g> </svg>

    Read the article

  • XSL-stylesheet URI using JAX-WS and Glassfish v3.

    - by Tony
    Hi there. I'm trying to use XSL-stylesheets in order to transform some generated XML-data to HTML-output. The architecture that I'm using is as follows: [Client Side] Web-Browser = [Server Side: Glassfish v3] JSP-pages - Web-Services. My web service generates some XML-data, then I want to format it with XSL-stylesheet, pass the result to JSP-page and show to user. I'm using JAXP for XSL-transformations and I want to create a javax.xml.transform.stream.StreamSource object with XSL-file stream for the javax.xml.transform.Transformer object, but I'm having a difficulty with specifying the path/URL for the XSL-file. So the question is: where should I put my XSL-stylesheets in a project and how should I access them from code? I'm using Glassfish v3 and NetBeans 6.8. Thanks.

    Read the article

  • Retrieving XML node from a path specified in an attribute value of another node

    - by Olivier PAYEN
    From this XML source : <?xml version="1.0" encoding="utf-8" ?> <ROOT> <STRUCT> <COL order="1" nodeName="FOO/BAR" colName="Foo Bar" /> <COL order="2" nodeName="FIZZ" colName="Fizz" /> </STRUCT> <DATASET> <DATA> <FIZZ>testFizz</FIZZ> <FOO> <BAR>testBar</BAR> <LIB>testLib</LIB> </FOO> </DATA> <DATA> <FIZZ>testFizz2</FIZZ> <FOO> <BAR>testBar2</BAR> <LIB>testLib2</LIB> </FOO> </DATA> </DATASET> </ROOT> I want to generate this HTML : <html> <head> <title>Test</title> </head> <body> <table border="1"> <tr> <td>Foo Bar</td> <td>Fizz</td> </tr> <tr> <td>testBar</td> <td>testFizz</td> </tr> <tr> <td>testBar2</td> <td>testFizz2</td> </tr> </table> </body> </html> Here is the XSLT I currently have : <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="html" indent="yes"/> <xsl:template match="/ROOT"> <html> <head> <title>Test</title> </head> <body> <table border="1"> <tr> <!--Generate the table header--> <xsl:apply-templates select="STRUCT/COL"> <xsl:sort data-type="number" select="@order"/> </xsl:apply-templates> </tr> <xsl:apply-templates select="DATASET/DATA" /> </table> </body> </html> </xsl:template> <xsl:template match="COL"> <!--Template for generating the table header--> <td> <xsl:value-of select="@colName"/> </td> </xsl:template> <xsl:template match="DATA"> <xsl:variable name="pos" select="position()" /> <tr> <xsl:for-each select="/ROOT/STRUCT/COL"> <xsl:sort data-type="number" select="@order"/> <xsl:variable name="elementName" select="@nodeName" /> <td> <xsl:value-of select="/ROOT/DATASET/DATA[$pos]/*[name() = $elementName]" /> </td> </xsl:for-each> </tr> </xsl:template> </xsl:stylesheet> It almost works, the problem I have is to retrieve the correct DATA node from the path specified in the "nodeName" attribute value of the STRUCT block.

    Read the article

  • Store variables during loop and use in it another template

    - by krisvandenbergh
    Is there a way to store a variable/param during a for-each loop in a sort of array, and use it in another template, namely <xsl:template match="Foundation.Core.Classifier.feature">. All the classname values that appear during the for-each should be stored. How would you implement that in XSLT? Here's my current code. <xsl:for-each select="Foundation.Core.Class"> <xsl:for-each select="Foundation.Core.ModelElement.name"> <xsl:param name="classname"> <xsl:value-of select="Foundation.Core.ModelElement.name"/> </xsl:param> </xsl:for-each> <xsl:apply-templates select="Foundation.Core.Classifier.feature" /> </xsl:for-each> Here's the template in which the classname parameters should be used. <xsl:template match="Foundation.Core.Classifier.feature"> <xsl:for-each select="Foundation.Core.Attribute"> <owl:DatatypeProperty rdf:ID="{Foundation.Core.ModelElement.name}"> <rdfs:domain rdf:resource="$classname" /> </owl:DatatypeProperty> </xsl:for-each> </xsl:template> The input file can be found at http://krisvandenbergh.be/uml_pricing.xml

    Read the article

  • How do I check for the existence of an external file with XSL?

    - by LOlliffe
    I've found a lot of examples that reference Java and C for this, but how do I, or can I, check for the existence of an external file with XSL. First, I realize that this is only a snippet, but it's part of a huge stylesheet, so I'm hoping it's enough to show my issue. <!-- Use this template for Received SMSs --> <xsl:template name="ReceivedSMS"> <!-- Set/Declare "SMSname" variable (local, evaluates per instance) --> <xsl:variable name="SMSname"> <xsl:value-of select=" following-sibling::Name"/> </xsl:variable> <fo:table font-family="Arial Unicode MS" font-size="8pt" text-align="start"> <fo:table-column column-width=".75in"/> <fo:table-column column-width="6.75in"/> <fo:table-body> <fo:table-row> <!-- Cell contains "speakers" icon --> <fo:table-cell display-align="after"> <fo:block text-align="start"> <fo:external-graphic src="../images/{$SMSname}.jpg" content-height="0.6in"/> What I'd like to do, is put in an "if" statement, surronding the {$SMSname}.jpg line. That is: <fo:block text-align="start"> <xsl:if test="exists( the external file {$SMSname}.jpg)"> <fo:external-graphic src="../images/{$SMSname}.jpg" content-height="0.6in"/> </xsl:if> <xsl:if test="not(exists( the external file {$SMSname}.jpg))"> <fo:external-graphic src="../images/unknown.jpg" content-height="0.6in"/> </xsl:if> </fo:block> Because of "grouping", etc., I'm using XSLT 2.0. I hope that this is something that can be done. I hope even more that it's something simple. As always, thanks in advance for any help. LO

    Read the article

  • How do i selext text nodes using XSL

    - by user323719
    How do i select all the text nodes within a specific element node using XSL? Input xml: <node1 id="1"> <node2 id="2"> <node3 id="3" /> <node4 id="4"> <node5 id="5">Text node1</node5> <node6 id="6">Text node2</node6> </node4> </node2> <node7 id="7">Text node3 <node8 id="8">Text node4</node8> <node9 id="9">Text node5</node9> </node7> <node10 id="10">Text node6</node10> <node11 id="11">Text node3 <node12 id="12">Text node4</node12> <node13 id="13">Text node5</node13> </node11> </node1> Input Param: List of ids of the element nodes whose txt nodes are to be retrieved. <nodes><node>4</node><node>7</node><node>10</node></nodes> Expected Output: Text node1 Text node2 Text node3 Text node4 Text node5 Text node6 How can this be achieved using XSL? Please share your ideas.

    Read the article

  • Delete Nodes + attributes that match Xpath except specific attributes

    - by Ryan Ternier
    I'm trying to find the best (efficient) way of doing this. I have a medium sized XML document. Depending on specific settings certain portions of it need to be filtered out for security reasons. I'll be doing this in XSLT as it's configurable and no code should need changing. I've looked around, but not getting much luck on it. For example: I have the following XPath: //*[@root='2.16.840.1.113883.3.51.1.1.6.1'] Whicrooth gives me all nodes with a root attribute equal to a specific OID. In these nodes I want to have all attributes except for a few (ex. foo and bar) erased, and then having another attribute added (ex. reason) I also need to have multiple XPath expressions that can be ran to zero down on a specific node and clear it's contents out in a similar fashion, with respect to nodes with specific attributes. I'm playing around with information from: XPath expression to select all XML child nodes except a specific list? and XSLT Remove Elements and/or Attributes by Name per XSL Parameters Will update shortly when I can have access what what I"ve done so far. Example: XML Before Transformation <root> <childNode> <innerChild root="2.16.840.1.113883.3.51.1.1.6.1" a="b" b="c" type="innerChildness"/> <innerChildSibling/> </childNode> <animals> <cat> <name>bob</name> </cat> </animals> <tree/> <water root="2.16.840.1.113883.3.51.1.1.6.1" z="zed" l="ell" type="liquidLIke"/> </root> After <root> <childNode> <innerChild root="2.16.840.1.113883.3.51.1.1.6.1" flavor="MSK"/> <!-- filtered --> <innerChildSibling/> </childNode> <animals> <cat flavor="MSK" /> <!-- cat was filtered --> </animals> <tree/> <water root="2.16.840.1.113883.3.51.1.1.6.1" flavor="MSK"/> <!-- filtered --> </root>

    Read the article

  • Is there an online tester for xPath selectors?

    - by alex
    I know there are some online regex evaluators.. very useful, matching in real time. They are like web applications of RegexBuddy. I was wondering if there is a similar thing for xPath selectors? I am just learning them and it would be valuable to me. Is there an online tester that allows you to input XML and then an xPath selector and match (live would be better, but I doubt someone has written a JavaScript interpreter?) them? Thanks

    Read the article

  • XPath and special characters

    - by Bryan
    I am having an issue with an XPath query I'm performing for a Sitecore CMS system. This query works fine: /root/content/Meta-Data/Tips/* But when I try this: /root/content/Meta-Data/Tips/*[@SomeAttribute='somekey'] I get an error which says "End of string expected at position 22" which is where the dash character is found. I was under the impression that the dash was not a special character in XML... am I doing something wrong here? Do I need to encode this in some way? Or is this a bug in the XPath parser? Any suggested workarounds?

    Read the article

  • breakdown xpath

    - by lovetoknow
    I am looking at the website. Trying to transfer selenium html to junit but could not get it to work because it keeps saying Error: Element not found. Maybe syntax error because I was able to break it down to the shortest path in firebug but still could not get to compile..What do you do in this case ? Enrollment I use firebug Xpath to get the value of the above link /html/body/div[@id='contentDisplayPane']/div[@id='mainDiv']/div[@id='mainDivContent']/div[@id='simpleBox']/table/tbody/tr[2]/td[@id='fb_PageContent']/table/tbody/tr/td/table/tbody/tr/td[4]/a Using firebug xpath, I was able to break it down to this and able to access Enrollment link..However when I put this in the junit test case selenium.click(("//div[@id='simpleBox']/table/tbody/tr[2]/td[@id='fb_PageContent']/table/tbody/tr/td/table/tbody/tr/td[4]/a"); I get ERROR: Element //div[@id='simpleBox']/table/tbody/tr[2]/td[@id='fb_PageContent']/table/tbody/tr/td/table/tbody/tr/td[4]/a") not found Any help or tip is appreciated

    Read the article

  • XPath: How to check multiple attributes across similar nodes

    - by Justin
    Hi, If I have some xml like: <root> <customers> <customer firstname="Joe" lastname="Bloggs" description="Member of the Bloggs family"/> <customer firstname="Joe" lastname="Soap" description="Member of the Soap family"/> <customer firstname="Fred" lastname="Bloggs" description="Member of the Bloggs family"/> <customer firstname="Jane" lastname="Bloggs" description="Is a member of the Bloggs family"/> </customers> </root> How do I get, in pure XPath - not XSLT - an xpath expression that detects rows where lastname is the same, but has a different description? So it would pull the last node above? Thanks a mill if you can help, been scratching at it for ages, and I can't find it by searching (apologies if it is) Cheers, J

    Read the article

  • How do I guarante node order for an Xpath 'OR' query

    - by Tom Carter
    I have a snippet of XML that looks like <body> Some text.... <nodeA>....</nodeA> more text <someOtherNode> <nodeA>.......</nodeA> </someOtherNode> <nodeB>.......</nodeB> etc..... </body> I'm selecting all nodeA and NodeB nodes inside <body> using an XPATH query similar to "//nodeA|//nodeB" As I understand it, .NET supports XPATH 1.0 which does not guarantee node order. How can I guarantee selected nodes are returned in document order in my OR query : that's to say : nodeA, nodeA, nodeB

    Read the article

  • Performing complicated XPath queries in Scala

    - by Ken Bloom
    What's the simplest API to use in scala to perform the following XPath queries on a document? //s:Annotation[@type='attitude']/s:Content/s:Parameter[@role='type' and not(text())] //s:Annotation[s:Content/s:Parameter[@role='id' and not(text())]]/@type The only documentation I can find on Scala's XML libraries has no information on performing complicated real XPath queries. I used to like JDOM for this purpose (in Java), but since JDOM doesn't support generics, it will be painful to work with in Scala. (Other XML libraries for Java have tended to be even more painful in Java, but I admit I don't know the landscape real well.)

    Read the article

  • Absolute Xpath to get list of childnodes?

    - by Googler
    Hi this my xml file, <?xml version="1.0"?> <worldpatentdata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <meta name="elapsed-time" value="329" xmlns="http://ops.epo.org"/> <exchange-documents xmlns="http://www.epo.org/exchange"> <exchange-document country="AT" doc-number="380509" family-id="38826527" kind="T" system="ops.epo.org"> <bibliographic-data> <publication-reference data-format="docdb"> <document-id> <country>AT</country> <doc-number>380509</doc-number> <kind>T</kind> <date>20071215</date> </document-id> </publication-reference> <parties> <applicants> </applicants> <inventors> </inventors> </parties> </bibliographic-data> </exchange-document> </exchange-documents> </worldpatentdata> For the above xml file, i need the xpath to receive the childnodes below it: Output i need is : <exchange-documents xmlns="http://www.epo.org/exchange"> <exchange-document country="AT" doc-number="380509" family-id="38826527" kind="T" system="ops.epo.org"> <bibliographic-data> <publication-reference data-format="docdb"> <document-id> <country>AT</country> <doc-number>380509</doc-number> <kind>T</kind> <date>20071215</date> </document-id> </publication-reference> <parties> <applicants> </applicants> <inventors> </inventors> </parties> </bibliographic-data> </exchange-document> I using Linq-Xml to get the following data: This is my Xpath and code: var list = doc1.XPathSelectElement("exchange-document"); I couldnt retreive the needed output.It returns null for the above code. Can anyone pls help on this by providing the correct xpath to retieve the child nodes. Else is there any other way to retrieve it.

    Read the article

  • finding an adjacent node in xml through xpath

    - by kolosy
    i have a deeply nested structure (actually parsing out xhtml, so lots of nasty), like so: <tr> <td> <font id="blah"> stuff </font> </td> </tr> <tr> <td> more stuff </td> </tr> and this repeats in a long table. i need an xpath expression that will select the second font tag (or rather it's text()). i was looking at the preceding-sibling axis, but something isn't quite working right. something along the lines of (and pardon me if this is ridiculous, my xpath is rusty) //tr[preceding-sibling::tr/td/font/b]/td/text()

    Read the article

  • Extra characters Extracted with XPath and Python (html)

    - by Nacari
    I have been using XPath with scrapy to extract text from html tags online, but when I do I get extra characters attached. An example is trying to extract a number, like "204" from a <td> tag and getting [u'204']. In some cases its much worse. For instance trying to extract "1 - Mathoverflow" and instead getting [u'\r\n\t\t 1 \u2013 MathOverflow\r\n\t\t ']. Is there a way to prevent this, or trim the strings so that the extra characters arent a part of the string? (using items to store the data). It looks like it has something to do with formatting, so how do I get xpath to not pick up that stuff?

    Read the article

  • case-insensitive matching in xpath?

    - by Ethan
    For example, for the xml below <CATALOG> <CD title="Empire Burlesque"/> <CD title="empire burlesque"/> <CD title="EMPIRE BURLESQUE"/> <CD title="EmPiRe BuRLeSQuE"/> <CD title="Others"/> <CATALOG> How to match the first 4 records with xpath like //CD[@title='empire burlesque']. Is there xpath function to do this? Other solutions like PHP function are also accepted.

    Read the article

  • XSLT; parse escaped text to a node-set and extract subelements

    - by Tom W
    Hello SO; I've been fighting with this problem all day and am just about at my wit's end. I have an XML file in which certain portions of data are stored as escaped text but are themselves well-formed XML. I want to convert the whole hierarchy in this text node to a node-set and extract the data therein. No combination of variables and functions I can think of works. The way I'd expect it to work would be: <xsl:variable name="a" select="InnerXML"> <xsl:for-each select="exsl:node-set($a)/*"> 'do something </xsl:for-each> The input element InnerXML contains text of the form <root><element a>text</element a><element b><element c/><element d>text</element d></element b></root> but that doesn't really matter. I just want to navigate the xml like a normal node-set. Where am I going wrong?

    Read the article

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