Although I know how to build a DOM the long, arduous way using the DOM API, I'd like to do something a bit better than that. Is there a nice, tidy way to build hierarchical documents with, say, an API that works something like Hibernate's Criteria API? So that I can chain calls together like this, for example:
Document doc = createDoc...
I'm working with a bit of html and Javascript code that I've taken over from someone else. The page reloads a table of data (via an asynchronous request) every ten seconds, and then re-builds the table using some DOM code. The code in question looks something like this:
var blah = xmlres.getElementsByTagName('blah');
for(var i = 0; i < ...
What might be changing the DOM of a web page after the browser receives the response?
I'm seeing this behavior in the value of a hidden input element that holds a single-use form token.
When I 'view source' in a browser, I see the correct value, as written out by the server. When I submit the form, view the current state of the DOM, or...
I've created two functions to load expanded views of a month in the archive section of my blog when it's link is clicked:
// Load open view of a month in the Archive section
function loadMonth(date) {
// Remove other open month
removeMonth();
// Hide opening month's link
// Define variable to hold month anchor tag
var m...
I have a form action that needs to have its value set from a variable. I need to set the variable once and it will be reflected many times throughout the DOM.
So:
variable = "somthing.html";
...
...
I'm trying to grab an image from a web site using simpleXML and am getting a PHP error saying that I'm trying to call to a member function xpath() on a non-object.
Below are the lines I'm trying to use to get the image's source tag:
$xpath = '/html/body/div/div/div[5]/div/div/div[2]/div/div[2]/img';
$html = new DOMDocument()...
Hi folks,
I am creating a java class that will search a directory for xml files. If the are some present it will use JDOM to parse these and create a simplified output outlined by the xslt. This will then be output to another directory while retaining the name of the original xml i.e. input xml is "sample.xml", output xml is also "sampl...
I would like to know how I can refer to a list item object if I had for example the following html list
<div id="subdiv_2">
<div id="subdiv_3">
<ul>
<li><a href="">Item1</a></li>
<li><a href="">Item2</a></li>
<li><a href="">Item3</a></li>
</ul>
</div>
</div>
How is it possible to register an onclick ...
I am using a third party application and would like to change one of its files. The file is stored in XML but with an invalid doctype.
When I try to read use a it errors out becuase the doctype contains "file:///ReportWiz.dtd"
(as shown, with quotes) and I get an exception for cannot find file. Is there a way to tell the docbuilder to i...
I have a product registration form that allows the user to add additional product fields by clicking "add product". When the user clicks add product, Javascript creates new product field in an existing div.
I currently allow up to 10 products to be added on the form, so I setup a div structure like this:
<div id="product1"></div>
<div ...
I would like to parse a document using SAX, and create a subdocument from some of the elements, while processing others purely with SAX. So, given this document:
<DOC>
<small>
<element />
</small>
<entries>
<!-- thousands here -->
</entries>
</DOC>
I would like to parse the DOC and DOC/entries elements...
I want to know the basic principle used for WYSIWYG pages on the web. I started coding it and made it using a text area, but very soon I realized that I cannot add or show images or any HTML in the text area. So I made it using DIV, but I did not understand how I could make it editable.
So, in gist, I want to know how(in principle) to m...
I have been tasked with finding an open source DOM XML parser. The parser must minimally support XPath 1.0. Schema support is desired, but not a deal breaker
The files we are parsing will be small so speed and memory consumption are not a large concern.
Any OO language (C++, C#, Java, etc.).
To clarify, the plan is to integrate ...
I am familiar with inserting text nodes after or before a given reference node. But, I would like to know how to insert a tag between text in a given node. For example,
Before insertion: <p>Lorem dolor</p>
After insertion: <p>Lorem <span>ipsum</span> dolor</p>
The span node must be inserted after N characters (I don't need user's cur...
I want find the index of a given DOM node. It's like the inverse of doing
document.getElementById('id_of_element').childNodes[K]
I want to instead extract the value of K given that I already have the reference to the child node and the parent node. How do I do this?
...
I hope this isn't a waste of time, however I have really been trying to figure this on out. Is it my syntax. I simply want to remove the parent div ".number-row" once the link with a class of ".remove-link" is clicked.
Thanks in advance
<script>
$(document).ready(function(){
$(".remove-link").click(function() {
$(this).parent(...
As far as I know, there's no way to use {% include %} within a dynamic JS file to include styles. But I don't want to have to make another call to the server to download styles.
Perhaps it would be possible by taking a stylesheet and injecting it into the head element of the document...has anyone does this before?
...
Trying to rotate a div element...This might be DOM blasphemy, could it work possibly with a canvas element? I'm not sure - if anybody has any ideas of how this could work or why it doesn't, I'd love to know. Thanks.
...
I'm trying to get:
document.createElement('div') //=> true
{tagName: 'foobar something'} //=> false
In my own scripts, I used to just use this since I never needed tagName as a property:
if (!object.tagName) throw ...;
So for the 2nd object, I came up with the following as a quick solution -- which mostly works. ;)
Problem is, i...
Consider the following:
<div onclick="alert('you clicked the header')" class="header">
<span onclick="alert('you clicked inside the header');">something inside the header</span>
</div>
How can I make it so that when the user clicks the span, it does not fire the div's onclick event?
...