Questions tagged [xpathquery]
55 questions
                    
                    187
                    
            votes
                
                5 answers
            
        How to use "not" in XPath?
I want to write something of the sort:
//a[not contains(@id, 'xx')]
(meaning all the links who's 'id' attribute doesn't contain the string 'xx')
I can't find the right syntax.
        
        Guy
        
- 14,178
 - 27
 - 67
 - 88
 
                    28
                    
            votes
                
                3 answers
            
        PHP xpath contains class and does not contain class
The title sums it up. I'm trying to query an HTML file for all div tags that contain the class result and does not contain the class grid.
        skip this div
grab this one
Thanks!
        Rob
        
- 631
 - 1
 - 7
 - 20
 
                    21
                    
            votes
                
                1 answer
            
        Getting elements with default namespace (no namespace prefix) using XPath
In this SOAP XML file, how can I get the 7 on a using a XPath query?
        
            
            
                
                    
    
    
        
    
    
                
            
        
     
        user2411903
        
- 221
 - 1
 - 2
 - 3
 
                    8
                    
            votes
                
                1 answer
            
        How to negate xpath query?
I would like to do a negative xpath query like this:
$xpath->query(//a[DoesNotContain(@class,'some_class')]);
I know about this
$xpath->query(//a[contains(@class,'some_class')]);
        
        sam
        
- 193
 - 2
 - 12
 
                    5
                    
            votes
                
                1 answer
            
        XPath Query to parse all IDREFS in an attribute (containing possibly many of IDs)
I need to come up with a query that gives the products of the types from which no items were sold Meaning if an item is of the type clothing, and no clothing items appear in the list of transactions, I need to display it.
This is my XML file…
        
        CodyBugstein
        
- 21,984
 - 61
 - 207
 - 363
 
                    3
                    
            votes
                
                1 answer
            
        In CrafterCMS, how can I query a model to get an array with all the fields in a repeated group?
In CrafterCMS, I have a component Team with a itemSelector field where I'm assigning some instances of another component TeamMember. 
In the template of Team I'm using siteItemService.getSiteItem to get the model information of child…
        
        kmarcos
        
- 179
 - 6
 
                    3
                    
            votes
                
                1 answer
            
        PHP + XPath Query get Child Nodes and their values
I have a XML file record.xml which looks like:
    john 
    male 
    mathematics, english, science 
 
    jamie 
    female 
   … 
        
        Ajay
        
- 458
 - 4
 - 20
 
                    3
                    
            votes
                
                1 answer
            
        DomXPath: Search inside DomXPath query result?
How can I query an xpath result for a sub element, without querying the entire document again?
I query my document to find the last  with the class menu-item:
$doc = new DomDocument();
@$doc->loadHTML( $html );
// $html is invalid (and should be… 
        
        Nahydrin
        
- 13,197
 - 12
 - 59
 - 101
 
                    2
                    
            votes
                
                1 answer
            
        How do I write "if elsif" conditions using basic XPath?
I have a very basic XML and wanted to write an Xpath query to get a value.
Here is XML:
    
        STD 
        1234 
    
    
       … 
        
        kmatrix
        
- 21
 - 1
 
                    2
                    
            votes
                
                0 answers
            
        How to declare array in xpath query using oracle
I am trying to create an array in XPath query using oracle, but it is treating as a string, below is the code snippet, can someone please help me where I am doing wrong.
XMLQUERY('    
let $vals :=
    if (count($Cntnt/emp/emp_content/emp_part)=1)…
        
        Saritha
        
- 89
 - 1
 - 7
 
                    2
                    
            votes
                
                1 answer
            
        Xpath query with multiple nodes at different levels
I need a Xpath query to find a XML file with certain nodes. The nodes are located at different levels in the XML file, under different parents. So, it would be like if I want to recover a file like the one below using the nodes "author" and "ref…
        
        dev_dev
        
- 47
 - 7
 
                    2
                    
            votes
                
                2 answers
            
        Xpath Query to match immediate sibling nodes in a sequence
I'm new to XPATH and I'd like to know if there is a nice way to do this using XPATH queries. 
I want to match consecutive sibling nodes in a XML tree to certain predefined rules for example if there are three sibling nodes occurring immediately one…
        
        Pritam Damania
        
- 21
 - 1
 - 2
 
                    2
                    
            votes
                
                2 answers
            
        xpath query to search string in a webpage
I am using html agility for below task.
I am wondering what can be xpath query to get all the nodes containing a string search term. It should search both attributes and innertext of elements.
 
  
        
            
            
                
                    
    
    
        
    
    
                
            
        
    
                    Mr T for president
        sunder
        
- 1,803
 - 4
 - 29
 - 50
 
                    2
                    
            votes
                
                2 answers
            
        Get title tag from html page using XPath?
I have two pages that Im trying to extract the title tag from using an Xpath query. This page works:
http://www.hobbyfarms.com/farm-directory/category-home-and-barn-resources-1.aspx
This page…
        
        RachelD
        
- 4,072
 - 9
 - 40
 - 68
 
                    1
                    
            vote
                
                1 answer
            
        Warning: DOMXPath::query() does not accept the syntax
I'm trying to extract a DOMDocument in PHP with the help of DOMXPath. With the website http://xpather.com/ I tried to find the correct query for my needs.
The query is the following:
/*/* except /*/*[@id='test']
What I try to achieve: In a DOM…
        
        Vueer
        
- 1,432
 - 3
 - 21
 - 57