Questions tagged [domdocument]

DOMDocument refers to a class encapsulating the DOM (Document Object Model). Various languages and technologies use the name DOMDocument for this purpose, for example PHP, COM, C++, and ActiveX

If you are thinking of using this tag, then you might be looking for the Document Object Model tag:

In PHP, for example, the DOMDocument class represents an entire HTML or XML document and serves as the root of the document tree.

2749 questions
0
votes
1 answer

Building an xml document from functions that return DOMNodes

My question is a rather simple one for anyone familiar with the DOM* classes in PHP. Basically i have different classes that i want to return to me something that I can append in my xml document Following pseudo-code should demonstrate better Class…
user253530
  • 2,583
  • 13
  • 44
  • 61
0
votes
1 answer

how to get a span text with xpath in php

HTML:
CITROEN
PHP: $dom = new DOMDocument(); @$dom->loadHTML($response); $xpath = new DOMXPath($dom); echo…
0
votes
0 answers

How do I prevent DomDocument from messing up with text?

I am aiming to replace the anchor text in anchor tags of given text block with the title of the page the href attribute points to. That is my html contains - "This is www.example.com" I'd like to replace it…
TheBigK
  • 451
  • 5
  • 17
0
votes
1 answer

DOMXPath: Find all H2 and H3 headlines with a specific character

I want to find every

and

tags which are a question. So I need to check if the headline contains a question mark ?. At the moment my code looks like this: $query = '//*[contains("h2 h3", name())]'; I saw in this answer, that there is some…

Cray
  • 5,307
  • 11
  • 70
  • 166
0
votes
2 answers

How can i read the first XML comment in PHP?

How can I read the first and only comment in PHP: using DOMDOcument object? $xml = new DOMDocument(); $libxml_error = 'Il file %s non risulta ben formato (%s).'; // Per…
gremo
  • 47,186
  • 75
  • 257
  • 421
0
votes
1 answer

What wrong with this php user defined function?

I cant find that what i have missed in this function so its generating this ERROR some time not always ? ERROR :- Notice: Undefined offset: 13 in /home/chandrak/public_html/tmp/c/Crawler.php on line 131 Line number 131 is defined in the below…
Bajrang
  • 8,361
  • 4
  • 27
  • 40
0
votes
0 answers

Altering in thousands of posts with DomDocument

I used the PHP DomDocument class to extract all the a tags from over 3000 posts and collected them in a database as follows - I used domDocument C14N() function to fill the existing_link table. id | existing_link | replacement_link 1 |
TheBigK
  • 451
  • 5
  • 17
0
votes
1 answer

Why can't the return type of document.createElement be assigned to a generic that's restricted to HTMLElement?

I'm writing a clone(el) function that must accept an HTMLElement or subtype, and should return the exact same type that it's given. How can I write this function's generic signature to be correct please? Thanks! Is no.2 where I'm going wrong, in how…
Henry Blyth
  • 1,700
  • 1
  • 15
  • 23
0
votes
0 answers

HTML to org.w3c.dom.Document using Thymeleaf

I am currently using Thymeleaf to parse a HTML document and output it as a String which is then used to perform further operations. I now need to pass Thymeleaf's output to a library which expects a org.w3c.dom.Document instead of a plain String,…
gscaparrotti
  • 663
  • 5
  • 21
0
votes
1 answer

Why does the node hierarchy in a PHP DOMDocument not match the given html hierarchy?

I have an html string that is formatted correctly for html. After I load a PHP DOMDocument object with it I read the node tree and it is wrong. The node tree does not match the html. The table node is inside a #text node. The 2nd td node is inside…
MAtkins
  • 53
  • 1
  • 8
0
votes
1 answer

How to delete all nodes from DOMDocument except custom ones?

I have a DOMDocument in PHP and I'm trying to delete all nodes except of a container with a specific ID. Lets say I have the following DOM Document:
  • Test
  • Test
Vueer
  • 1,432
  • 3
  • 21
  • 57
0
votes
0 answers

Loop All Attachment URL In Posts Wordpress

I Want to loop all attachment url and save new html. Sorry, I only script kiddies. I only understand some code. This my script php function get_all_image_clickable($content) { global $post; $args_img = array( 'order' => 'ASC', …
0
votes
0 answers

Get rid of warning generated by window.load and window.scroll

I currently have a sticky button component. However the window.load and window.scroll methods when fired are generating the following warning which I can't seem to rid of: 'The component Styled(text_Text) with the id of "sc-pQEbo" has been created…
vicgoyso
  • 636
  • 1
  • 14
  • 35
0
votes
1 answer

Scraping websites with PHP

I'm trying to scrap information directly from the maersk website. Exemple, i'm trying scraping the information from this URL https://www.maersk.com/tracking/221242675 I Have a lot of tracking nunbers to update every day on database, so I dicided…
0
votes
2 answers

problem with adding root path using php domdocument

I would like to add root path of the site for those anchor tag which have not root path using php dom document, Till now a have made a function to do this with str_replace function but for some links its adding three and for times root path. Then…
Bajrang
  • 8,361
  • 4
  • 27
  • 40
1 2 3
99
100