topical media & game development

talk show tell print

basic-xml-11-DOMException.htm / htm

    <title>Raising a DOMException</title>
    <p>Deliberately raising a DOMException by trying to add a second child element to the Document node.</p>
    <script language="JScript" type="text/javascript">
    try {
      var strXML = "<?xml version='1.0' ?><AnyElement>Some text</AnyElement>"
      var objXMLDOM = new ActiveXObject("Msxml2.DOMDocument.3.0");
     var strXML2 = "DisallowedElement";
     var newElement = objXMLDOM.createElement(strXML2);
     alert("Everything is working nicely until now.");
     // If there is an exception it must be in the preceding statement
     // since the first alert box displayed correctly.
    catch (e)
      alert("An exception was raised.");

(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.