dom

JavaScript: Given the DOM, find the largest piece of continuous text (content part)

Hi Folks, The goal is to find the largest piece of contiguous text in a document. The problem is that the largest piece does not lie under a single element, e.g. a blog post which has <p> tags in it so iterating nodes and comparing innerHTMLs is not going to work. And by getting innerText of an element, the root node always contains big...

Scala: Convert org.w3c.dom.Document to scala.xml.NodeSeq

Hey folks, Title is pretty self-explanatory. How can I convert an instance of org.w3c.dom.Document to a Scala NodeSeq, to enjoy it's facilitation? Cheers Parsa ...

recommend php library for parsing and modifying dom

i have to modify dom. i.e. remove few elements and add few. kindly recommend any php library that can parse and modify DOM. ...

PHP Using DOM to output XLS

I'm trying to output an XLS file in the XML format. This is what the data should look like for Excel 2003 to render (can be saved as an xls file): <? xml version='1.0' ?> <? mso-application progid='Excel.Sheet' ?> <Workbook xmlns='urn:schemas-microsoft-com:office:spreadsheet' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='u...

Display current webpage size

Is there an easy way to show the size of an aspx webpage in bytes (i.e length not screen size) - to save clicking File..Properties in the browser. Possibly some javascript method, or a way of getting it from the Response object perhaps? ...

Copy (e.g. with load or find) with jQuery an HTML Markup with included Inline Script - How to realize?

Hey Stack'er I want to crop a part of an HTML markup with Inline-JavaScript included. Example: <div id="foo"> <div id="bar"> <script> ..some function.. </script> <p>...</p> </div> </div> With the jQuery functions find() and load() you are not able to copy the whole markup WITH the JS-Snippet includet...

How to find out DOM and CSS address to an element for Selenium?

I have a following element (Login box): <input type="text" style="font-family: Verdana; font-size: 11px; width: 180px;" id="ctl00_Content_ctl00_Login2_UserName" maxlength="50" name="ctl00$Content$ctl00$Login2$UserName"> Because I have a Firebug, if I right click on on the element it gives me XPath address (//*[@id="ctl00_Content_ctl00...

Disable link using javascript

I have following HTML and would like to disable the link using javascript. <a style="white-space: nowrap;" onclick="return InstallWebApp(true);" id="uc_ii_lnkInstall" href="javascript:__doPostBack('uc_ii$lnkInstall','')"> <img style="border-width: 0pt; margin-right: 3px;" id="uc_ii_lnkInstallImg" alt="Install" title="Install" src="/Cort...

Removing a node from xml file

I have an xml file <?xml version="1.0"?> <category> <name>SWEATERS</name> <name>WATCHES</name> <name>PANTS</name> <name>test</name> <name>1</name> </category> How i can remove the node <name>test</name> using xpath ,xquery and php. I used this code $name='test; $xmlfile="config/shop_categories.xml"; $xml = simple...

Adding a stylesheet declaration to ci_reporter xml files automatically

Hey all, I am not a programmer, so please be forgiving if my problem is fairly easy to solve for many of you (yet I still might find it confusing). The problem I am having is with ci_reporter, a gem for use with Watir and Test/Unit. It is outputting the test results from a Watir test to an xml file. Great so far. Unfortunately I can...

What do people mean when they say "DOM Manipulation"?

I always hear people talk about DOM this, manipulate the DOM, change the DOM, traverse the DOM; but what exactly does this mean? What is the DOM and why would I want to do something with it? Thanks a bunch for the info guys! ...

jQuery .attr('type', 'submit') on a button element giving me a strange error in IE7

I'm parsing a JSON response via $.ajax() and building a form from this object's values. The script I've written is long, but here's what it's doing: Dynamically creating: ~ a form element, ~ a fieldset element, ~ a button element, ~ 20 or so text inputs and label elements Appending the inputs and labels to the fieldset Appending the b...

Javascript INDEX_SIZE_ERR: DOM Exception 1 Error for ranges

Using the following code, I get a INDEX_SIZE_ERR: DOM Exception 1 error on the thisRange.setStart line. The code is meant to go through a whole page, find instances of the searchString, and then add a link in front of that search string. For example, if it finds 5 instances of the string, right now it will add the link in front of the fi...

Retrieve form's "name" attribute in Javascript whereas an input exists with name "name"

Hi there ! I have something like this HTML structure : <form name="myvalue" id="hello"> <input type="text" name="name" /> </form> I'd like to retrieve the form's name attribute in Javascript, with a cross browser solution. Obviously, document.getElementById("hello").name won't work because it will return the corres...

Inversing DOM with jQuery

Input: <content> <dom id=1>a</dom> <dom id=2>b</dom> <dom id=3>c</dom> <dom id=4>d</dom> </content> Output: <content> <dom id=4>d</dom> <dom id=3>c</dom> <dom id=2>b</dom> <dom id=1>a</dom> </content> I'm looking for a function (if exists) like this: $('content').inverse(); ...

How can I remove the text of a node without removing child nodes?

I'm working on creating XML docs from values in a database. Initially, the program exports this XML: <customDataElementlanguage>English</customDataElementlanguage> I've created this PHP to change the XML tree: if ($Element->nodeValue = "EN") { $Element->nodeValue = "English"; } $doc2 = $Element->ownerDocument; $titleElem...

How is document.createEvent supposed to work with key events?

I'am trying to simulate keypresses in a web application, it is for an embedded system but it uses a Webkit derived browser. I have tested the code in Chrome and get the same error. I tried to use code snippets from this example from Yahoo, but I keep getting the same error when firing the event using dispatchEvent. "target" is an HTML e...

Odd problem with input hidden and innerHTML

I have a text area with some text. I also have an "onsubmit" event handler. In that I have an alert of the text area's innerHTML and I get back the text that is inside of the textarea. I then try to assign this to the "value" attribute of a hidden input element. However the value is never assigned, when the form posts, the hidden element...

DOM parsing in server-side

Is there any framework on which I can access the DOM when a user send the data back to the server? It would be useful for changing the page content using directly the DOM structure. It would sound as a server-side javascript on which i could write document.getElementById. ...

Extract content with XPath?

I have html content that I am storing as an XML document (using HTML Agility Pack). I know some XPath, but I am not able to zero into the exact content I need. In my example below, I am trying to extract the "src" and "alt" text from the large image. This is my example: <html> <body> .... <div id="large_image_display"> <img...