Linkwerk Logo

E4X Expression Tester

This is a test application for E4X scripting. It's target audience are Web/Software Developers. The application is use-at-your-own-risk-software ;-). Read the notes below.

Step 1 (Alternative A): Load an XML document

URL:

  1. Note: The document is loaded Ajax-style (asynchronous); after clicking, wait for the document to appear in the text box below.

  2. Note: For the document to work with Firefox 1.5 Beta 1 the XML document must not contain an XML declaration. That means: The line <?xml version="1.0" ...?> must not be contained in the document.

  3. Note: Since E4X implementations are in an early development state, it is recommended to check the JavaScript console for execptions. The E4X Expression Tester was tested with Firefox 1.5 Beta 1 only. This browser version identifies itself on Windows XP as

    • Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050908 Firefox/1.4

    Your browser identifies itself as

    If there are any differences you might discover problems with this application.

  4. Note: An unsigned script may not access data on a remote server unless you gave the permission. That means: If you try to load an XML document from a server other than the originating server (linkwerk.com), you have to

    • Adjust the configuration of your Firefox (type about:config in the address field). Change the value of signed.applets.codebase_principal_support from false to true. It is recommended to set this back to false after finishing your tests. Be careful: This effects the security of your browser! More information about signed scripts is available on mozilla.org.
    • Grant the privileges. Your browser will (should!) ask you when loading the remote document.

Step 1 (Alternative B): Type an XML document

Step 1 (Alternative C): Turn this page into an XML object

Note: This is kind of a fake. An ECMA-357 implementation may allow to map the W3C DOM (document object) to an E4X XML object with var xmlDocument = XML(document). Changing xmlDocument would then change the web page live. At the time of writing this, Firefox throws an exception when trying to create an XML object from the document object. A workaround uses new XML(XMLSerializer().serializeToString(...)) to create an XML object from the serialization of the HTML node. The resulting XML object is suitable for read-only testing E4X expressions, but since there is no connection between the XML object and the DOM document object, any changes made to the XML object do not effect the web page.

Step 2: Try an E4X expression

The loaded XML document is bound to an object named xmlDocument. Add whatever you like after xmlDocument in the expression box below to complete your E4X expression and click evaluate. For example: Typing and evaluating ".*[0]" prints the first child element (index 0) of the root element.

Examples (1a): If you loaded the default XML document, you might want to try the one of these expressions (copy & paste them to the input box):

Examples (1b): Meaningful examples depend on your XML instance. At least you can try something like "..*" (all elements) or ".*[0]" (first child of root element).

Examples (1c): You can access all elements and attributes of this web page. Please note that element names are upper-case. Try "..P" to get all paragraphs or "..INPUT.(@TYPE == 'button')" to get alle buttons.

E4X expression: xmlDocument

Links

© 2005 Stefan Mintert, Linkwerk.com

Valid XHTML 1.0 Strict