domdocument Questions
4
Solved
I have a string value that I'm trying to extract list items for. I'd like to extract the text and any subnodes, however, DOMDocument is converting the entities to the character, instead of leaving ...
Dray asked 8/9, 2011 at 4:56
5
Solved
I use DOMDocument for editing some HTML files, but some of theme have in their names spaces. So DOMDocument automaticly change the spaces to %20 and then can't find them.
This is how looks the erro...
Tinner asked 18/3, 2012 at 16:51
5
Solved
I have a function that replaces anchors' href attribute in a string using Php's DOMDocument. Here's a snippet:
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->loadHTML($text);
$anchors = $doc->...
Scorekeeper asked 27/4, 2009 at 5:38
2
Solved
Due to custom storage needs (the "why" is not important here, thanks!) I have to save html <a> links in a specific format such as this:
myDOMNode->setAttribute("href", "{{{123456}}}");
...
Lallans asked 4/4, 2015 at 15:25
5
Solved
I build a script that combines all css on a page together to use it in my cms. It worked fine for a long time now i i get this error:
Warning: DOMDocument::loadHTML()
[domdocument.loadhtml]: Ta...
Catboat asked 5/2, 2012 at 12:20
5
Solved
I am following the suggestion from this question Robust, Mature HTML Parser for PHP, about parsing html that may be malformed with DOMDocument.
Is there any easy way to loop over the parsed docume...
Grader asked 26/5, 2010 at 2:51
10
Solved
This is my code:
$oDom = new DOMDocument();
$oDom->loadHTML("èàéìòù");
echo $oDom->saveHTML();
This is the output:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http:/...
Kopeisk asked 4/7, 2011 at 15:12
10
when I want to test php array I use the following code
print_r($myarray);
but know I want to see the data of an object
my object is
$xpath = new DOMXPath($doc);
$myobject = $xpath->query...
Upspring asked 2/9, 2009 at 3:54
9
Solved
I have found several similar questions, but so far, none have been able to help me.
I am trying to output the 'src' of all images in a block of HTML, so I'm using DOMDocument(). This method is act...
Chamorro asked 1/2, 2013 at 14:25
3
I read everything I could about this error without being able to find any solution.
I have a simple page that looks like this:
$xmlfile = "/var/www/marees.xml"; //Fichier dans lequel récupérer ...
Ponton asked 6/5, 2014 at 8:39
2
Solved
I am trying to get the inner HTML of a DOMElement in PHP. Example markup:
<div>...</div>
<div id="target"><p>Here's some &nbsp; <em>funny</em> &nbsp; te...
Tremann asked 2/12, 2019 at 22:13
5
Solved
is there an option with DomDocument to remove the first line:
<?xml version="1.0" encoding="UTF-8"?>
The class instantiation automatically adds it to the output, but is it possible to get ...
Myiasis asked 18/4, 2011 at 16:42
5
Solved
I'm using PHP's DOMDocument to parse and normalize user-submitted HTML using the loadHTML method to parse the content then getting a well-formed result via saveHTML:
$dom= new DOMDocument();
$dom-...
Fourflush asked 27/2, 2010 at 0:15
8
Solved
Here are the codes:
$doc = new DomDocument('1.0');
// create root node
$root = $doc->createElement('root');
$root = $doc->appendChild($root);
$signed_values = array('a' => 'eee', 'b' =>...
Bigamous asked 23/12, 2011 at 11:18
6
Solved
I'm attempting to parse HTML code with DOMDocument, do stuff like changes to it, then assemble it back to a string which I send to the output.
But there a few issues regarding parsing, meaning tha...
Filterable asked 23/5, 2012 at 1:52
2
I have an HTML code where there are attributes like @click, @autocomplete:change used by some JS libraries.
When I parse the HTML using DOMDocument, these attributes are removed.
Sample code:
<?...
Immortelle asked 18/11, 2021 at 4:22
29
I'm the function below, I'm struggling to output the DOMDocument without it appending the XML, HTML, body and p tag wrappers before the output of the content. The suggested fix:
$postarray['post_c...
Biased asked 2/2, 2011 at 21:15
5
Solved
I'm adding a #b hash to each link via the DOMDocument class.
$dom = new DOMDocument();
$dom->loadHTML($output);
$a_tags = $dom->getElementsByTagName('a');
foreach($a_tags as $a)
{
$v...
Word asked 26/3, 2011 at 18:54
3
Solved
I'm reading some XML with PHP and currently using the DOMDocument class to do so. I need a way to grab the names and values of a tag's (instance of DOMElement) attributes, without knowing beforehan...
Operation asked 27/8, 2009 at 3:23
4
I'm trying to parse some HTML that includes some HTML entities, like ×
$str = '<a href="http://example.com/"> A &#215; B</a>';
$dom = new DomDocument;
$dom -> substitu...
Palmerpalmerston asked 28/8, 2011 at 11:46
4
Solved
If I make a selection in a html page and I do :
var a = document.getSelection()
I get an object with four properties :
anchorNode
baseNode
extentNode
focusNode
the values of first three i...
Ibo asked 2/12, 2014 at 3:18
5
Solved
Is it possible to delete element from loaded DOM without creating a new one? For example something like this:
$dom = new DOMDocument('1.0', 'utf-8');
$dom->loadHTML($html);
foreach($dom->ge...
Untuck asked 7/3, 2013 at 13:41
2
Why do I get warning for this code?
$content ='<p>
<a href="http://www.we.com/1000">text </a>
text
<a href="http://www.we.com/2345">text </a>
text
</p>
&...
Willtrude asked 3/3, 2015 at 12:51
3
Solved
I want to create and add a set of <style> tags to the head tags of an HTML document.
I know I can start out like this:
$url_contents = file_get_contents('http://example.com');
$dom = new DO...
Mcelroy asked 11/9, 2012 at 22:10
5
I have a Node from one Document. I want to take that Node and turn it into the root node of a new Document.
Only way I can think of is the following:
Node node = someChildNodeFromDifferentDocumen...
Travers asked 8/11, 2012 at 17:55
1 Next >
© 2022 - 2025 — McMap. All rights reserved.