dom

Dom Vs Sax - creating Xmls

Hey, I know the difference between Sax and Dom is pretty substantial regarding parsing Xml, but what about creating ones ? is there even a way to create new Xml using Sax or that if i want to create new Xml file based on my data in my program , i will have to use DOM ? Thanks ...

XML to dynamic select menu (with AJAX)

Hi, I'm new to AJAX and XML. I'm stuck on a school assignment.. The task is to process an XML file consisting of 2000 different places with name, name of city and name of county. and making a dropdown menu with the different counties, but only once. The XML file looks like this: <places> <place> <Name>Vestby</Name> <City>Vestby</...

Are DOM style calls limited by frequency?

I'm trying to resize an html element (flash object) but it doesn't seem to respond more than once per second? Is this a limitation imposed by browsers (both IE7 and FF3 do this)? Or should I be attempting to resize in a different/more efficient way? function setHeightNow(height) { if (document.getElementById) { if (height >...

XY positions of hyperlinks in Firefox plugin

Hi, I want to build a FireFox addon that can capture a webpage as an image (which seems simple using a canvas object) and also preserve the XY postions of the hyperlinks present in the webpage. I wanted to know if there are any DOM methods that can help me extract the geometry info (XY positions and the height and width) of all the hyp...

Screen Coordinates of a element, via Javascript

I'm trying to get the screen coordinates (that is, relative to the top left corner of the screen) of an element in a browser window. It's easy to get the size and position of the window (screenX, screenY) and it's easy (with jQuery) to get the offset of the element ($('element').offset().left). However, I need to know how many pixels it...

PHP DOMDocument - get html source of BODY

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->loadHTML('<div><p>Hello World'); $well_formed= $dom->saveHTML(); echo($well_formed); This does a beautiful job of parsing the fragment and...

Overriding native function?

The native document.createElement() is silly-stupid (it takes only a tag name and no attributes). How come I can't override it? How come this doesn't work? var originalFunction = document.createElement; document.createElement = function(tag, attributes) { var element = originalFunction(tag); if (attributes) { for (var...

How to get 'value' of select tag based on content of select tag, using Nokogiri

How would one get the contents of the 'value' attribute of a select tag, based on content of the select tag (i.e. the text wrapped by option), using Nokogiri? For example, given the following HTML: <select id="options" name="options"> <option value="1">First Option - 4</option> <option value="2">Second Option - 5</option> <op...

jQuery is mousedown on mouseover

I have a table where i want to change cell background on mouse over and mouse button down, my current solution doesn't work as I want it to : function ChangeColor(sender) { sender.style.backgroundColor = 'yellow'; } var clicking = false; $(document).mouseup(function() { clicking = false; }); $(document).ready(function() {...

Dom loads two times

Hello everybody! I have a very weird problem. I am using jQuery and i am using the $(function () to load functions when the dom is loaded. But with a unknown reason the code in the $(function () will run a second time. A preview is at: http://development.devhouse.nl/news/3/het-nieuwste-nieuwsbericht you will get 2 alert prompts, but the...

Is it possible to get pixel coordinates of text and draw a rectangular border around it using Javascript?

Dear all, I am evaluating technology options for an upcoming project, and one of the requirements is to draw a rectangle around certain groups of words in a text field. Each time the text is evaluated and parsed, certain recognized parts of it must be boxed with a rectangle, which should also respond to mouse clicks. There is even a re...

How to find elements by 'id' field in SVG file using Python

Below is an excerpt from an .svg file (which is xml): <text xml:space="preserve" style="font-size:14.19380379px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sa...

Java/Jsp XML Dom

Hi all, looks like I need help again! :-/ Im trying to read this XML file with Java/Jsp: <?xml version="1.0" encoding="iso-8859-1" ?> <universal_campaign> <campaign_details> <campaign_id></campaign_id> <campaign_title>Test Campaign</campaign_title> <campaign_sdate>2010-01-21</campaign_sdate> <campai...

How to easily parse large xml data with a DOM parser?

I am using DOM parser to parse xml data, but its taking lots of time to parse it on line 3 where "is" is the InputStrem object. Here is my code. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(is); how can i do it in a sma...

Does removing elements from the DOM affect their event handlers?

If I remove an element from the DOM which has event handlers attached, and subsequently add an element with the same ID somewhere, will the new element have handlers? ...

What information about a DOM element would allow JavaScript to identify it (somewhat) uniquely? (e.g. when it doesn't have `id`)

Here's what I'm trying to do: I have a bookmarklet that is looking for elements in the current page (which can be any site) and dispatch a click event on the ones that match. I have that part working. In some cases though, nothing matches automatically and I want to be able to show (by hovering it) what element should be activated and t...

jQuery events and .load()

Hi All Never ran into this problem with jQuery before. I have the following: $(document).ready(function() { $('#browser_cat a').click( function() { $('#browser_cat').hide(); $('#browser_cat').load('/api/browser/catchildren/'+$(this).attr('id')); $('#browser_cat').fadeIn(); return(false); }) }); ...

PHP: building (X)HTML output with DOM - pros and cons?

I just started out with a new site and I decided to use DOMImplementation for building the complete site. What do you think about this, is it fast enough? I expect it to be quite a bit slower than the basic print method. I prefer the DOM one because it allows greater flexibility when building the final output, not to mention the more er...

using the DOM to add elements, document.write

I have just learned (no thanks to IE) that I cannot use document.write scripts in XHTML. However, it seems there is a way around it by using the DOM to add elements. I don't know. It's foreign to me. Here's the JS: copyright=new Date(); update=copyright.getFullYear(); document.write("Copyright &copy; 2004-"+ update + " flip-flop media"...

Java Copy/Paste org.w3c.dom.Node between two running copies of the same program

I have a program that shows a tree representation of an XML file. Using a number of sources online I have Copy/Paste within a single instance of the program working. I am using the system Clipboard. What I need though is to be able to copy a node from one instance of the program and paste to a different instance of the same program. ...