Warning: Undefined variable $mode in /var/www/virtual/qbnz.com/htdocs/highlighter/examples/actionscript/xml.php on line 6
GeSHi - Generic Syntax Highlighter :: Examples
 
Navigation
Home News Examples Demo Downloads FAQ Documentation Mailing Lists License
Support GeSHi!
If you're using GeSHi, why not help GeSHi out? You can link to GeSHi with this image:
Powered by GeSHi
Get the HTML

Project Status
The latest stable version of GeSHi is 1.0.8.11, released on the 19th of Aug, 2012.

Supported Languages:
*ABAP
*Actionscript
*ADA
*Apache Log
*AppleScript
*APT sources.list
*ASM (m68k)
*ASM (pic16)
*ASM (x86)
*ASM (z80)
*ASP
*AutoIT
*Backus-Naur form
*Bash
*Basic4GL
*BlitzBasic
*Brainfuck
*C
*C for Macs
*C#
*C++
*C++ (with QT)
*CAD DCL
*CadLisp
*CFDG
*CIL / MSIL
*COBOL
*ColdFusion
*CSS
*D
*Delphi
*Diff File Format
*DIV
*DOS
*DOT language
*Eiffel
*Fortran
*FourJ's Genero
*FreeBasic
*GetText
*glSlang
*GML
*gnuplot
*Groovy
*Haskell
*HQ9+
*HTML
*INI (Config Files)
*Inno
*INTERCAL
*IO
*Java
*Java 5
*Javascript
*KiXtart
*KLone C & C++
*LaTeX
*Lisp
*LOLcode
*LotusScript
*LScript
*Lua
*Make
*mIRC
*MXML
*MySQL
*NSIS
*Objective C
*OCaml
*OpenOffice BASIC
*Oracle 8 & 11 SQL
*Pascal
*Perl
*PHP
*Pixel Bender
*PL/SQL
*POV-Ray
*PowerShell
*Progress (OpenEdge ABL)
*Prolog
*ProvideX
*Python
*Q(uick)BASIC
*robots.txt
*Ruby
*Ruby on Rails
*SAS
*Scala
*Scheme
*Scilab
*SDLBasic
*Smalltalk
*Smarty
*SQL
*T-SQL
*TCL
*thinBasic
*TypoScript
*Uno IDL
*VB.NET
*Verilog
*VHDL
*VIM Script
*Visual BASIC
*Visual Fox Pro
*Visual Prolog
*Whitespace
*Winbatch
*Windows Registry Files
*X++
*XML
*Xorg.conf

GeSHi 1.0.8.11 is the current stable release, with eighteen new languages and bug fixes over the last release.

GeSHi 1.1.2alpha5 is the current latest version from the development branch, with full C support (see the GeSHi development website).
Subscribe
RSS 2
Mailing Lists
HomeNewsExamplesDemoDownloadsFAQDocumentationMailing ListsLicense 
5:23 am GMT

Examples

Examples » ActionScript
#include "xmlnitro2.as"
 
function myLoad () {
// this function gets executed when Flash has loaded the complete XML file
// it displays node properties for the first 4 levels of nodes found
// in the code, this = the XML object that called this function
// (eg this.firstChild = the first child node of thisXML)
 
  trace("xml declaration: " + this.xmlDecl);
  trace("xml doctype: " + this.docTypeDecl);
  trace("number of articles: " + this.firstChild.childNodes.length);
  trace(" ");
  level1Child = this.firstChild;
  level2Child = level1Child.firstChild;
  level3Child = level2Child.firstChild;
  level4Child = level3Child.firstChild;
 
// note that that last statement could also have been written
// level4Child = this.firstChild.firstChild.firstChild.firstChild; or
// level4Child = this.childNodes[0].childNodes[0].childNodes[0].childNodes[0];
 
  trace("level1: name=" + level1Child.nodeName);
  trace("        value=" + level1Child.nodeValue);
  trace("        type=" + level1Child.nodeType);
  trace(" ");
 
  trace("level2: name=" + level2Child.nodeName);
  trace("        value=" + level2Child.nodeValue);
  trace("        type=" + level2Child.nodeType);
 
  // the attributes property is itself an object
  for (attr in level2Child.attributes) {
    trace("        attributes=" + attr + " value=" + level2Child.attributes[attr]);
  }
  trace(" ");
 
  trace("level3: name=" + level3Child.nodeName);
  trace("        value=" + level3Child.nodeValue);
  trace("        type=" + level3Child.nodeType);
 
  // the following will not produce any output because level3Child has no attributes
  for (attr in level3Child.attributes) {
    trace("        attributes=" + attr + " value=" + level3Child.attributes[attr]);
  }
  trace(" ");
 
  trace("level4: name=" + level4Child.nodeName);
  trace("        value=" + level4Child.nodeValue);
  trace("        type=" + level4Child.nodeType);
  trace(" ");
 
  trace(level3Child.nextSibling.nodeName);
  trace(level3Child.nextSibling.firstChild.nodeValue);
  trace(" ");
 
  n3 = level2Child.childNodes.length;
  trace("number of level3 nodes = " + n3);
  trace("  1st level3 node = " + level2Child.childNodes[0].nodeName);
  trace("  2nd level3 node = " + level2Child.childNodes[1].nodeName);
  trace("  3rd level3 node = " + level2Child.childNodes[2].nodeName);
  trace("  last level3 node = " + level2Child.childNodes[n3-1].nodeName);
}
 
thisXML = new XML();
thisXML.ignoreWhite = true;
thisXML.onLoad = myLoad;
thisXML.load("environment_page.xml");

This category contains 2 examples, and has been viewed 58413 times.

  • XML Properties - An example that works with an XML file (17195 views)
  • Abstract Class - An example of an abstract class in Actionscript (13818 views)