Skip to content
Advertisement

Tag: dom

Remove Child does not contain attribute value

I am practicing with XML DOM PHP parsing. I have such XML file (shorter version): I created attribute with name “id” and value “2” for two Tag elements. Now I would like to: Get only Tag elements which did not contain attribute ‘id=”2″‘; Get only Tag elements which contain only ‘id=”2″‘. For first case I created such code. Don’t know

Why using DOMDocument makes site load slower?

I’m using DOMDocument with xpath to load some data to my site from external (fast) website. Right now I use 4 urls (please see below). I need to increase to 8 urls. What I have noticed, that the more of those you add, the more slower the site loads. Is there any way to use xpath for more faster load?

Create array from DOM node values in PHP

I’m trying to create an array of amazon product variants using DOM php, My desired array should look like; Here is my code: Though my code is working but there are some mistakes in code and it might wont work for all amazon products. so I need suggestions and improvement. and also my output is a json object : while

Replace a string of text from the dom with PHP

I am trying to access the value of 6200° from the dom and then replace it with new text. For example I would want to replace 6200 with 8500. This is what the code I have been using after doing some searching but still very new to php and cant get the value. $kelvin2700 = find(‘span[class=”.options_958_1_label”]’); Answer If I understand

How to Split the nodevalues on php dom element

i scrape the website, i am getting result of below in single element, i want to split the one by one element. code: input:- Current output:- expecting output:- Answer Each of the text parts is a part of the <div> tag, so this code just assumes that you want the text from each direct child not and adds it to

How can I show XML external entities in a php page?

I am currently working on a little library project using XML to define books, and php to do a search using title/author then showing that specific book in the browser. So I made a bunch of books in XML files, then linked those files as external entities in my main XML file. I used a DTD to define the entities,

Advertisement