JavaScript: parseXMLString() – a reminder to myself…

If you have a string containing a XML-document you need to tell the browser to parse the the DOM. Otherwise you can not access the nodes and work with it. Makes sense you say?!

yeah… but I’ve wasted far to much time on that. 

So remember: If you have a XML in a string convert it to a DOM-object to work with it otherwise you will see very strange results.

Here is a sample function: 

 
function parseXMLString(xmlString) {
  //for IE
  if (window.ActiveXObject) {
    var xml_tree = new ActiveXObject("Microsoft.XMLDOM");
    xml_tree.async = "false";
    xml_tree.loadXML(xmlString);
  }
  //for Mozilla, Firefox, Opera, etc.
 else if (document.implementation && document.implementation.createDocument) {
    var parser = new DOMParser();
    var xml_tree = parser.parseFromString(xmlString,"text/xml");
  }
  return xml_tree;
}

 
This function accepts a string as parameter and uses ActiveXObject(“Microsoft.XMLDOM”) [IE] or DOMParser() [the rest of the gang] to parse it.

William Shatner Loves TechCrunch and Railslove loves William Shatner

Who would have thought it?
At 14. August 2008 William Shatner has confirmed that he loves TechChrunch
and exactly seven days later we have confirmed that we love William Shatner…
if you don’t believe us, have a look at http://dontforgetthewurst.com.

say "its awsome"

Payment processing mit Rails, Activemerchant (PayPal) und Finite State Machine

Wer schon überlegt hat PayPal als Bezahlungsmöglichkeit auf seiner Rails-Platform zu integrieren, stößt schnell auf die aufschlußreiche Lektüre der Pragmatic Programmers: Payment Processing with Paypal and Ruby. Dieses Buch legt einen sehr guten Grundstein für weitere Ideen wie sich eine Bezahlung via PayPal in einer RubyOnRails Anwendung realisieren lässt.
In diesem Blog-Post soll eine weitere Alternative vorgestellt werden, wie durch den Einsatz von Active Merchant und des Finite State Machine-Plugins eine einfache PayPal Express Bezahlung in Rails realisiert werden kann. Basierend auf dem Blogeintrag von Cody Fauser PayPal Express Payments with ActiveMerchant und, ebenso von Cody Fauster veröffentlichtem eBook Active Merchant; Show me the money! möchte ich den Paymentprozess mit Paypal um das FSM-Plugin erweitern.
Read more

cool stuff on GitHub: sintaxi’s gap

phonegap.com: ”bridging the gap between the web and the iphone SDK”

“PhoneGap is a free open source development tool and framework that allows web developers to take advantage of the powerful features in the iPhone SDK from HTML and JavaScript. We’re trying to make iPhone app development easy and open. For many applications a web application is the way to but in Safari you don’t get access to the native iPhone APIs, and the that’s the problem we’re trying to solve.”

Get the source from GitHub.

tumble.railslove.com

Yeah… this blog has a little brother: tumble.railslove.com – our little tumblelog.
Not everything is worth a full blog post (ok perhaps sometimes I’m just to lazy) but pretty much everything is worth mentioning and spreading.

So we’ve started tumble.railslove.com. Over there we post stuff! ;)
(mainly about web, development, ruby, erlang, javascript, you name it.)

So hop over or subscribe to the feed.

Next Page →