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

php proDOM parsing error

I am using the following code for parsing dom document but at the end I get the error "google.ac" is null or not an object line 402 char 1 What I guess, line 402 contains tag and a lot of ";", How can I fix this?
Zaffar Saffee
  • 6,167
  • 5
  • 39
  • 77
0
votes
1 answer

Having Two HTML issues with PHP DOM: 1.) DOMDocument::createEntityReference $name values and 2.) how to add multiple CSS classes an element?

Working with PHP DOM - HTML manipulation. Got 2 questions Recently read that, there is better way to output special html characters (e.g. ©): DOMDocument::createEntityReference() method. Main advantage is, you don't need to use htmlentities, it…
Tural Ali
  • 22,202
  • 18
  • 80
  • 129
0
votes
1 answer

DOMDocument - createTextNode, encoding issue

I have a problem with createTextNode method e special characters like '>', '<': Dim xmlDoc As DOMDocument Dim codeXML as String Dim n As IXMLDOMNode codeXML = 'value' Set n = xmlDoc.createTextNode(codeXML) I need a result like…
epi82
  • 497
  • 2
  • 10
  • 21
0
votes
1 answer

strip outer element, ie. remove parent with php parser

I am using a parser to change certain span elements to corresponding heading elements. I have the following code: $headingReplace[1]['h'] = 'h1'; $headingReplace[1]['string'] = '/html/body//span[@class="heading1"]'; …
Inigo
  • 8,110
  • 18
  • 62
  • 110
0
votes
1 answer

How to get feedburner origLink from xml source

$data = file_get_contents('xml-file.xml'); $doc = new DOMDocument(); @$doc->loadHTML($data); $elements = $doc->getElementsByTagName('item'); $url = $elements->item(0)->getElementsByTagName('feedburner:origLink')->item(0)->nodeValue; on the other…
0
votes
2 answers

How to make a small php link "spider" and extract data?

I want to spider a simple white website that has lot's of html links that represent a phone number' name and address. From each page i want to extract the exact 3 fields that are between the 3 TD's such as:
Tom
  • 9,275
  • 25
  • 89
  • 147
0
votes
2 answers

php DomDocument + directly access xml element

Can anyone advise on the fastest, least resource intensive method by which I can see whether 'Column Name=Error' exists please? I don't want to parse the document, but simply check if elements exist. Thanks in advance,
rix
  • 10,104
  • 14
  • 65
  • 92
0
votes
0 answers

PHP DOMDocument Strings to Objects

I have created a php script in PHP Dom where multiple html files are scraped to look for all P tags that contain a specific class. I then want to get the values inside those p tags and build an unordered list in PHP Dom. My problem is, while I can…
0
votes
2 answers

PHP: Error in Error Checking

if($xml->getElementsByTagName($elmnt) && $xml->getElementsByTagName($elmnt)->length > 0) This line is intended to check for errors. All I want is to, instead of breaking the entire page, make a legible error message. It is included in a function…
Dissident Rage
  • 2,610
  • 1
  • 27
  • 33
0
votes
2 answers

DomDocument failing to add a "link" element for RSS feed

I am trying to create an RSS feed in PHP using DomDocument but every time I try to make a node like http://domain.com the script fails $oDomDocument = new DOMDocument( "1.0", "iso-8859-1" ); // Create the root now $oRootNode =…
michael
  • 4,427
  • 6
  • 38
  • 57
0
votes
1 answer

PHP Scrape nested pages

I am new to web scrapes, and need to learn quickly for work. I am having trouble scraping a clients web page because the content I need to aquire is nested uniquely to each record on the main page (300+ times), some fields on the child pages are…
Frantumn
  • 1,725
  • 7
  • 36
  • 61
0
votes
1 answer

Set the Content of the Msxml2.DOMDocument to a textarea

With the below code I am able to load the XML file successfully. But I want to set the total content to a textarea How can i do that Dim xmlDoc, objNodeList, plot Set xmlDoc = CreateObject("Msxml2.DOMDocument") xmlDoc.load("\ReadIT.xml") 'I want to…
user817507
0
votes
1 answer

why does DOMDocument turn UTF-8 encoded umlauts into numeric entities?

If I output the string before adding it as a text node to the DOMDocument tree then I can see that the original UTF-8 encoding is preserved. All umlauts are UTF-8 encoded - for sure. Then I add the string and output the DOM-tree-object through…
Raffael
  • 19,547
  • 15
  • 82
  • 160
0
votes
1 answer

DOMDocument and FBML/Google + Button not working

Well I'm having a bit of an issue, I have an application that uses DOMDocument to display some content but it is removing some code that is needed for FBML and a Google +1 button to display. For example, Facebook's like button is , it is…
Jared
  • 2,006
  • 4
  • 23
  • 43
0
votes
1 answer

Importing data from an HTML file (with embedded JavaScript) into MySQL database

Please who knows how to import this content into a mysql database? I want to get the data from this HTML into the database. I have a 5000 of such files and I want to import them. The problem is that there is an embedded JavaScript in the file.…