¡@

Home 

php Programming Glossary: xpath

Remove a child with a specific attribute, in SimpleXML for PHP

http://stackoverflow.com/questions/262351/remove-a-child-with-a-specific-attribute-in-simplexml-for-php

is much more simple when you use XPath SimpleXMLElement xpath segs doc xpath ' seq @id A12 ' if count segs 1 seg segs 0 same.. simple when you use XPath SimpleXMLElement xpath segs doc xpath ' seq @id A12 ' if count segs 1 seg segs 0 same deletion procedure..

PHP SimpleXML: insert node at certain position

http://stackoverflow.com/questions/3361036/php-simplexml-insert-node-at-certain-position

nodeB Get the last nodeA element target current sxe xpath ' nodeA last ' Insert the new element after the last nodeA simplexml_insert_after..

Implementing condition in XPath [duplicate]

http://stackoverflow.com/questions/3448005/implementing-condition-in-xpath

to select the nodes xml simplexml_load_file file nodes xml xpath ' xml events' It will select all the nodes.I want to select.. want to select the nodes based on the date. php xml xpath attributes simplexml share improve this question Specify.. share improve this question Specify the date in the xpath expression i.e. nodes xml xpath ' xml events @date 14 12 2011..

Grabbing the href attribute of an A element

http://stackoverflow.com/questions/3820666/grabbing-the-href-attribute-of-an-a-element

directly with XPath dom new DOMDocument dom loadHTML html xpath new DOMXPath dom nodes xpath query ' a @href' foreach nodes.. DOMDocument dom loadHTML html xpath new DOMXPath dom nodes xpath query ' a @href' foreach nodes as href echo href nodeValue ..

DOMDocument in php

http://stackoverflow.com/questions/4979836/domdocument-in-php

inside it dom new DOMDocument @ dom loadHTML html xpath new DOMXPath dom tags xpath query '. div @id showContent ' foreach.. @ dom loadHTML html xpath new DOMXPath dom tags xpath query '. div @id showContent ' foreach tags as tag string string..

Parse XML with Namespace using SimpleXML

http://stackoverflow.com/questions/595946/parse-xml-with-namespace-using-simplexml

www.webex.com schemas 2002 06 service event' foreach xml xpath ' e event' as event var_export event xpath ' e sessionKey' .. foreach xml xpath ' e event' as event var_export event xpath ' e sessionKey' php xml namespaces simplexml share improve.. www.webex.com schemas 2002 06 service event' foreach xml xpath ' e event' as event event registerXPathNamespace 'e' 'http www.webex.com..

Ignore html tags in preg_replace

http://stackoverflow.com/questions/8193327/ignore-html-tags-in-preg-replace

you're done. Edit Finally some code First it makes use of xpath to locate elements that contain the search text. My query looks.. like this this might be written better I'm not a super xpath pro ' contains . '. search.' FALSE contains . '. search.' ..'.. character this would break it see Cleaning sanitizing xpath attributes for a workaround if you need quotes . This query..

SimpleXML: Selecting Elements Which Have A Certain Attribute Value

http://stackoverflow.com/questions/992450/simplexml-selecting-elements-which-have-a-certain-attribute-value

suggest a good better way to do so I'm all ears. php xml xpath simplexml netflix share improve this question Try this XPath.. this XPath object data @type me So myDataObjects simplexml xpath ' object data @type me ' And if object is not the root of your..

Remove a child with a specific attribute, in SimpleXML for PHP

http://stackoverflow.com/questions/262351/remove-a-child-with-a-specific-attribute-in-simplexml-for-php

selecting specific nodes is much more simple when you use XPath SimpleXMLElement xpath segs doc xpath ' seq @id A12 ' if count..

Robust and Mature HTML Parser for PHP [duplicate]

http://stackoverflow.com/questions/292926/robust-and-mature-html-parser-for-php

parsing and modifying real world broken HTML and it can do XPath queries . It is based on libxml . It takes some time to get.. interface for querying DOM documents utilizing both XPath and CSS selectors. QueryPath QueryPath is a PHP library for..

Simplify PHP DOM XML parsing - how?

http://stackoverflow.com/questions/3405117/simplify-php-dom-xml-parsing-how

looks scary doc DOMDocument load 'data.xml' xpath new DOMXPath doc query ' pages page ' . page . ' ' page is fine was set earlier.. getElementById you can still very much fetch them with XPath xpath query ' pages page @id 1 ' would definitely work. And.. it. echo n n XPATH CAN FETCH NORMAL ID n n xPath new DOMXPath dom page2 xPath query ' pages page @id p2 ' item 0 foreach page2..

Implementing condition in XPath [duplicate]

http://stackoverflow.com/questions/3448005/implementing-condition-in-xpath

condition in XPath duplicate This question already has an answer here SimpleXML..

How do you parse and process HTML/XML in PHP?

http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php

parsing and modifying real world broken HTML and it can do XPath queries . It is based on libxml . It takes some time to get.. interface for querying DOM documents utilizing both XPath and CSS selectors. QueryPath QueryPath is a PHP library for..

How to parse HTML with PHP? [duplicate]

http://stackoverflow.com/questions/3650125/how-to-parse-html-with-php

parsing and modifying real world broken HTML and it can do XPath queries . It is based on libxml . It takes some time to get.. interface for querying DOM documents utilizing both XPath and CSS selectors. QueryPath QueryPath is a PHP library for..

Grabbing the href attribute of an A element

http://stackoverflow.com/questions/3820666/grabbing-the-href-attribute-of-an-a-element

You can also query for the href attribute directly with XPath dom new DOMDocument dom loadHTML html xpath new DOMXPath dom.. XPath dom new DOMDocument dom loadHTML html xpath new DOMXPath dom nodes xpath query ' a @href' foreach nodes as href echo..

How to replace text URLs and exclude URLs in HTML tags?

http://stackoverflow.com/questions/4003031/how-to-replace-text-urls-and-exclude-urls-in-html-tags

be converted to a link. p body html HTML Let's use an XPath that only fetches those elements that actually are textnodes.. dom new DOMDocument dom loadHTML html xPath new DOMXPath dom texts xPath query ' html body text not ancestor a and contains.. . http or contains . https or contains . ftp ' The XPath above will give us a TextNode with the following data and also..

DOMDocument in php

http://stackoverflow.com/questions/4979836/domdocument-in-php

it dom new DOMDocument @ dom loadHTML html xpath new DOMXPath dom tags xpath query '. div @id showContent ' foreach tags as.. the childNodes of the DIV or use getElementByTagName or XPath is up to you. You just have to understand that you are not working..

Ignore html tags in preg_replace

http://stackoverflow.com/questions/8193327/ignore-html-tags-in-preg-replace

you should make your function based on DOMDocument and DOMXPath rather than using regular expressions. Even those are quite.. always apply it's worth to make up one's mind about it. XPath allows you so find all texts that contain the search terms within.. search doc new DOMDocument doc loadXML str xp new DOMXPath doc anchor doc getElementsByTagName 'body' item 0 if anchor..

SimpleXML: Selecting Elements Which Have A Certain Attribute Value

http://stackoverflow.com/questions/992450/simplexml-selecting-elements-which-have-a-certain-attribute-value

have a certain value from the document. Do I need to use XPath and if so could you suggest the right syntax or is there a more.. simplexml netflix share improve this question Try this XPath object data @type me So myDataObjects simplexml xpath ' object..

Extracting data from HTML using PHP and xPath

http://stackoverflow.com/questions/15971715/extracting-data-from-html-using-php-and-xpath

data from HTML using PHP and xPath I am trying to extract data from a webpage to insert it to..

PHP: Strip a specific tag from HTML string?

http://stackoverflow.com/questions/3308530/php-strip-a-specific-tag-from-html-string

native DOM dom new DOMDocument dom loadHTML htmlString xPath new DOMXPath dom nodes xPath query ' @id anotherDiv ' if nodes.. dom loadHTML htmlString xPath new DOMXPath dom nodes xPath query ' @id anotherDiv ' if nodes item 0 nodes item 0 parentNode..

Simplify PHP DOM XML parsing - how?

http://stackoverflow.com/questions/3405117/simplify-php-dom-xml-parsing-how

against it. echo n n XPATH CAN FETCH NORMAL ID n n xPath new DOMXPath dom page2 xPath query ' pages page @id p2 ' item.. XPATH CAN FETCH NORMAL ID n n xPath new DOMXPath dom page2 xPath query ' pages page @id p2 ' item 0 foreach page2 childNodes.. . echo n n XPATH CAN FETCH PRODUCTS FOR PAGE WITH ID n n xPath new DOMXPath dom foreach xPath query ' pages page @id p2 product'..

xPath finds nothing but *

http://stackoverflow.com/questions/3719616/xpath-finds-nothing-but

finds nothing but This is starting to piss me off real bad... dumped only newXML and gotten tons of data but the only xPath I've run that returned anything but an empty array was Isn't.. dumped only newXML and gotten tons of data but the only xPath I've run that returned anything but an empty array was So what..

How can I scrape a website with invalid HTML

http://stackoverflow.com/questions/3893375/how-can-i-scrape-a-website-with-invalid-html

index.aspx semester 2010f' libxml_clear_errors xPath new DOMXPath dom links xPath query ' div @class courseList_section.. 2010f' libxml_clear_errors xPath new DOMXPath dom links xPath query ' div @class courseList_section a' foreach links as link..

How to replace text URLs and exclude URLs in HTML tags?

http://stackoverflow.com/questions/4003031/how-to-replace-text-urls-and-exclude-urls-in-html-tags

of anchor elements. dom new DOMDocument dom loadHTML html xPath new DOMXPath dom texts xPath query ' html body text not ancestor.. DOMDocument dom loadHTML html xPath new DOMXPath dom texts xPath query ' html body text not ancestor a and contains . http or..

Xpath fails if an element has a a xmlns attribute [duplicate]

http://stackoverflow.com/questions/5285570/xpath-fails-if-an-element-has-a-a-xmlns-attribute

has a a xmlns attribute duplicate Possible Duplicate xPath finds nothing but Im trying to use xml to parse a .COLLADA file...

PHP & xPath Question

http://stackoverflow.com/questions/548744/php-xpath-question

xPath Question I'm using PHP and xPath to crawl into a website I.. xPath Question I'm using PHP and xPath to crawl into a website I own just crawl the html not going.. object model @ dom loadHTML html create domxpath instance xPath new DOMXPath dom get all elements with a particular id and then..

How do i make Xpath search case insensitive

http://stackoverflow.com/questions/10266210/how-do-i-make-xpath-search-case-insensitive

do i make Xpath search case insensitive I'm currently making a xpath search..

Implementing goMongoDB-like Query expression object evaluation

http://stackoverflow.com/questions/14972025/implementing-gomongodb-like-query-expression-object-evaluation

cover my needs not being an exact match because it uses Xpath like expressions the caveat is that it heavily relies on regular..

PHP DOMDocument getting Attribute of Tag

http://stackoverflow.com/questions/1597746/php-domdocument-getting-attribute-of-tag

echo linkthumb You may also want to look at SimpleXML and Xpath as it makes reading XML much easier than DOMDocument. share..

PHP/XML - how to read multible sub's

http://stackoverflow.com/questions/16713385/php-xml-how-to-read-multible-subs

type2 isin . This is either possible by making use of Xpath this website already has a lot of Q A material about that for..

Access an element's parent with PHP's SimpleXML?

http://stackoverflow.com/questions/2174263/access-an-elements-parent-with-phps-simplexml

syntax can be used parent_div div xpath .. via Common Xpath Cheats SimpleXML Type Cheatsheet Feb 2013 by hakre share improve..

PHP Xpath : get all href values that contain needle

http://stackoverflow.com/questions/2392393/php-xpath-get-all-href-values-that-contain-needle

Xpath get all href values that contain needle Working with PHP Xpath.. get all href values that contain needle Working with PHP Xpath trying to quickly pull certain links within a html page. The.. that contain certain parameters. Is that possible within a Xpath query or should I just start manipulating the output from the..

php regular expression to match specific url pattern

http://stackoverflow.com/questions/2532358/php-regular-expression-to-match-specific-url-pattern

find relative links. If you don't want those adjust the Xpath to ' a @href starts with . http ' Note that using Regex to match..

Modify XML attribute PHP DOM

http://stackoverflow.com/questions/2723816/modify-xml-attribute-php-dom

the above XML file with a new attribute Using PHP DOM and Xpath. Any help is highly appreciated php xml share improve this.. with it DOMDocument loadXML Then you must instanciate DOMXpath on that document And use it to query the document DOMXPath query..

Php Tidy : remove link and style tags inside body

http://stackoverflow.com/questions/3053349/php-tidy-remove-link-and-style-tags-inside-body

Implementing condition in XPath [duplicate]

http://stackoverflow.com/questions/3448005/implementing-condition-in-xpath

or span. description event events xml And I am using this Xpath to select the nodes xml simplexml_load_file file nodes xml xpath..

Xpath not behaving for me in parsing basic html

http://stackoverflow.com/questions/5249492/xpath-not-behaving-for-me-in-parsing-basic-html

not behaving for me in parsing basic html I am trying to parse..

Finding links matching given string in xpath/domdocument query

http://stackoverflow.com/questions/5251282/finding-links-matching-given-string-in-xpath-domdocument-query

getting links that match a given word to display using Xpath and domDocument. Everything seems to work up to where for i..

Xpath fails if an element has a a xmlns attribute [duplicate]

http://stackoverflow.com/questions/5285570/xpath-fails-if-an-element-has-a-a-xmlns-attribute

fails if an element has a a xmlns attribute duplicate Possible..

Getting DOM elements by Class name

http://stackoverflow.com/questions/6366351/getting-dom-elements-by-class-name

php css class dom share improve this question Update Xpath version of @class~ 'my class' css selector So after my comment..

Create a complex structure with DOMDocument

http://stackoverflow.com/questions/6717098/create-a-complex-structure-with-domdocument

setAttribute PathToWeb PathToWeb Complex XML Creation with Xpath ELEMENT APPEND create questions into page href hrefs item 0.. tree without any temp variables and also without any Xpath simply by chaining method calls and traversing the DOM tree..

XPATH method for retuning multiple dynamic results from a XML file using PHP [closed]

http://stackoverflow.com/questions/16629935/xpath-method-for-retuning-multiple-dynamic-results-from-a-xml-file-using-php

method for retuning multiple dynamic results from a XML file.. echo image var_dump result The result from the first XPATH pass is correct if all that is set is ˜photographer_id if I then..

XPATH - Select all child nodes with a specific attribute

http://stackoverflow.com/questions/2488021/xpath-select-all-child-nodes-with-a-specific-attribute

Select all child nodes with a specific attribute What would..

PHP - templating with custom tags - is this a legit use of eval?

http://stackoverflow.com/questions/3326446/php-templating-with-custom-tags-is-this-a-legit-use-of-eval

that the HTML file is well formed XML solutions like XSLT XPATH won't be reliable. Instead we use a regex to look for tags with..

Simplify PHP DOM XML parsing - how?

http://stackoverflow.com/questions/3405117/simplify-php-dom-xml-parsing-how

Schema and the XML must be validated against it. echo n n XPATH CAN FETCH NORMAL ID n n xPath new DOMXPath dom page2 xPath query.. have to include the namespace e.g. @xml id p1 . echo n n XPATH CAN FETCH PRODUCTS FOR PAGE WITH ID n n xPath new DOMXPath dom..

Using xpath on a PHP SimpleXML object, SOAP + namespaces (not working..)

http://stackoverflow.com/questions/3864359/using-xpath-on-a-php-simplexml-object-soap-namespaces-not-working

worked 0119A 1 How can I get the SOAP message working with XPATH Thanks Roman php soap xpath simplexml share improve this..

Simple and clean xml manipulation in PHP

http://stackoverflow.com/questions/4343402/simple-and-clean-xml-manipulation-in-php

php xml xml parsing share improve this question I use XPATH and SimpleXML to change my file. A little example... The xml..

XPATH query with single quote

http://stackoverflow.com/questions/4452323/xpath-query-with-single-quote

query with single quote Anyone have any ideas how to resolve..

Create a complex structure with DOMDocument

http://stackoverflow.com/questions/6717098/create-a-complex-structure-with-domdocument

xml createElement 'Questions' href appendChild element XPATH EVALUATE hrefs xpath evaluate page Questions ELEMENT 1 APPEND..