Skip to content

Tag: dom

PHP DOMDocument error Entity ‘nbsp’ not defined

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 error exactly: How to repair this error? Answer Use DOMDocument::loadHTMLFile() instead of load(). That’s…

get all child element of a form in J.S

how can i get all child element(like radio,checkbox,select,text,…) within a form and make them blank using javascript. My form has many other elements like table,div etc. but i dont want to changes on these other element. Any suitable idea to get these child element(form element) through the form name(f…

Scraping a messy html website with PHP

I am in the following situation. I am trying to convert a messy scraped html code to a nice and neat xml structure. A partial HTML code of the scraped website: Now I want to create the following xml structure with php: Have been trying the simple html dom method, but have no idea how to get the next sibling

Is there a way to get all of a DOMElement’s attributes?

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 beforehand what any of them are. The documentation doesn’t seem to offer anything like this. I know that…