JavaScript tutorial:
Working with XML files


Developing Internet applications using AJAX (asynchronous JavaScript and XML) is great:

It is fast and efficient. Only small amount of data passes through, making it a highly suitable platform for Internet application development, and

It is transparent to the user. The data is being interpreted to change only the portion of the web page that needs to be changed, not the entire page.

Use JavaScript Editor to effortlessly view, create, format, edit, syntax-check and validate XML files.

Formatting of XML files

When you open an XML file, JavaScript Editor automatically indents it and formats it to make it easier to understand and edit.

Select XML / Auto-format on File Open from the menu to toggle the automatic formatting on and off.

You can always select XML / Format from the menu to apply formatting to your XML files. If you wish to change the rules used to format your XML files:

Select Cleanup / Cleanup-fix-reformat XML... from the menu

Set Input to XML and Output to XML

Specify wrapping, tab size, etc

Save the settings as XML.ini: each time you select XML / Format from the menu, the program will apply the formatting using the settings from XML.ini.

For more information on code formatting, click here.

Checking and validating XML files

To verify the syntax of your XML file, select XML / Syntax Check (Well-formed Check) from the menu

The file can pass the syntax check, but fail the validation check. To validate an XML file, select XML / Validate from the menu.

Note: if elements or attributes have not been defined, the validation may return a long list of errors. If you wish to see if there are any fatal errors, select XML / List Fatal Errors Only from the menu.

Using the XML template

Typing xml and pressing Ctrl + Space inserts the xml template into your document:

<?xml version="1.0" encoding="windows-1252"?>

To edit the xml template and to quickly develop other templates, please see Fast code reuse with code templates