Hi all,
I just ran into this building a Textbox control for my MVC framework, where just before finalizing the whole document I call PreRender on everything that inherits from ServerTag (which in turn inherits from DOMElement).
The only way i have found to change a DOMElement derived object's tagName is to replace it with a new one wit...
Hello,
In PHP with DOM, I have a DomElement object which represents an <identity/> element.
I have one case where I need to change this so its element name is <person/>, but keep the same child elements and attributes.
What would be the simplest way of changing an element name of a DomElement and keeping its children and attributes?
...
I have a lot of messages, and raw HTML that I hard code in my javascript code, such as:
var subjectId = $(subject).attr('subjectId');
var subjectName = $(subject).attr('subjectName');
var html = "<table id='invitations' class='invitations' width='100%'><tbody>";
$(subject).find('group').each( function() {
var groupId = $(this)...
i have an XML file with large number of tags. it has more than 2000 tag here and there. i want to delete all that htmlText Tag and save it as a new xml. how cani do that in PHP???
here is the code tht iam using
$remove = $doc->getElementsByTagName('htmlText');
$doc->removeChild($remove);
...
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 I can get an attribute's value if I have its n...
Hi, I am trying to inject html and js into an IE from a bho.
To get the body I use:
Code:
public static SHDocVw.WebBrowser webBrowser;
HTMLDocument document = (HTMLDocument)webBrowser.Document;
IHTMLElement body = (IHTMLElement)document.body;
My idea was to use body.appendChild but that will only work for the webbrowser control and no...
There's something I don't fully understand about node cloning with the PHP's DOM api. Here's a sample file that quickly duplicates the issue I'm coming across.
$doc = new DOMDocument( '1.0', 'UTF-8' );
$root = $doc->createElement( 'root' ); // This doesn't work either $root = new DOMElement( 'root' );
$doc->appendChild( $root );
$doc...
I'm trying to loop through multiple <LineItemInfo> products contained within a <LineItems> within XML I'm parsing to pull product Ids out and send emails and do other actions for each product.
The problem is that it's not returning anything. I've verified that the XML data is valid and it does contain the necessary components.
$itemLi...
Hello, i'm using DD_Belated.png to save all IE6 users from seeing the madness of unsupported png.
However, this great script takes either selector or DOM Element as parameter to it's only function to do it's magic and return working PNG to IE6.
Me, being lazy programmer, did something like this:
$("img[src$=png], #search").each (
fu...
Using PHP I'm attempting to take an HTML string passed from a WYSIWYG editor and replace the children of an element inside of a preloaded HTML document with the new HTML.
So far I'm loading the document identifying the element I want to change by ID but the process to convert an HTML to something that can be placed inside a DOMElement i...
How can I take all the attribute of an element? Like on my example below I can only get one at a time, I want to pull out all of the anchor tag's attribute.
$dom = new DOMDocument();
@$dom->loadHTML(http://www.example.com);
$a = $dom->getElementsByTagName("a");
echo $a->getAttribute('href');
thanks!
...
How could I extend objects provided with Document Object Model? Seems that there is no way according to this issue.
class Application_Model_XmlSchema extends DOMElement
{
const ELEMENT_NAME = 'schema';
/**
* @var DOMElement
*/
private $_schema;
/**
* @param DOMDocument $document
* @return void
...
my PHP code
$dom = new DOMDocument();
@$dom->loadHTML($file);
$xpath = new DOMXPath($dom);
$tags = $xpath->query('//div[@class="text"]');
foreach ($tags as $tag) {
echo $tag->textContent;
}
what i'm trying to do here is to get the content of the div that has class 'text' but the problem when i loop and echo the results i only ge...
I'm using readability's code to extract HTML from a web page. How do I display it on a page?
$content = grabArticle($webpage);
echo $content;
ERROR => Object of class DOMElement could not be converted to string...
...
I am programmatically updating the DOM on a WebKit webview via DOMElement objects - for complex UI, there is usually a javascript component to any element that I add. This begs the need to be notified when the updates complete -- is there any such event? I know regular divs dont fire an onload or onready event, correct? The other assumpt...
In one part of my code, I call getContext('2d') on a canvas element to produce a CanvasRenderingContext2D object. That object goes on to get passed around a fair bit from function to function, and at a later point in the code it'd be handy to be able to get a reference to the original canvas dom element that produced a given context. I ...
registerNodeClass is great for extending the various DOMNode-based DOM classes in PHP, but I need to go one level deeper.
I've created an extDOMElement that extends DOMElement. This works great with registerNodeClass, but I would like to have something that works more like this:
registerNodeClass("DOMElement->nodeName='XYZ'", 'extDOMXYZ...
I am calling a function test() on an anchor tag like this:-
<a class="link" onclick="test();">Hello</a>
And I am trying to access the class of the anchor inside the function test():-
function test()
{
alert($(this).attr("class"));
}
But this alerts undefined. I know that calling onclick=test(this); instead and having the followin...