Manual

2 — Editing

The Debug XML Tool editor is built for a single trade: writing XML, XSLT stylesheets, XSD schemas and DTDs. It therefore knows your vocabulary — and, if you give it a schema, the grammar of your documents.

This chapter covers creating files, assisted typing, formatting and validation.


2.1 Create, open, save

Create a file

Click New file (the first icon on the toolbar) or press Ctrl+N. A menu offers five entries:

EntryWhat it creates
XMLan XML document
XSLan XSL stylesheet
XSDan XSD schema
DTDa DTD
Other type…a file of a free type — you type the full name, extension included

The first four open a tab already pre-filled with a valid skeleton for that type: declaration, namespace, root element. You start writing, not hunting for the header.

Other type… first asks you for a name (« File name (with extension) », for example notes.txt, style.css, page.html) and works out the syntax highlighting from it.

The new tab exists in memory only until you have saved it: it carries a provisional name and the « • » modification dot.

To create a file straight at a precise place in the workspace, prefer right-clicking a folder in the explorer → New file…. You name the file on the spot, in the tree.

Save

Ctrl+S saves the active tab.

On a tab that has never been saved, Debug XML Tool opens Save as: choose the location and the name. The tab then becomes an ordinary file on disk, and later saves are direct.

The « • » dot disappears as soon as the contents of the tab match those of the file — whether because you saved, or because you undid all your changes.


2.2 Typing faster

Automatic tag closing

In any XML file, typing <test> immediately produces <test></test>, with the cursor between the two. This behaviour is always on, schema or no schema.

XSLT completion — .xsl and .xslt files

In a stylesheet, completion knows the XSLT vocabulary.

  • Type <xs: the XSLT instructions are offered.
  • Ctrl+Space opens the list at any moment.
  • Accepting a proposal inserts the complete element: choosing xsl:template writes <xsl:template match=""></xsl:template>, cursor inside the attribute.
  • Proposals take account of where you are: inside an xsl:for-each, they are not the same instructions as at the top level of the stylesheet.
  • In an enumerated attribute value — for example <xsl:output method=" — the permitted values are offered.

Schema-driven completion — .xml files

This is the editing comfort you do not go back on. Associate an XSD or a DTD with your XML document (§2.3), and completion becomes that of your grammar:

Where you typeWhat is offered
< inside an open elementonly the elements valid under this parent
< in an empty documentthe elements admitted as root
in the opening tag, after the namethe attributes of this element, the required ones first, those you have already typed excluded
between the quotes of an attributethe enumerated values, the default value first

For example, on a document associated with a library schema: inside <library>, typing < offers only book; inside an open <book>, title and author; on the <book … tag, the required isbn attribute comes first; inside lang="…", the values en, fr, es.

Three guarantees:

  • with no schema associated, nothing changes — you get exactly the automatic tag closing, with no stray suggestion;
  • the association takes effect immediately, without reopening the tab;
  • an unreadable schema produces no noise: no wrong suggestion, no error shown on your document. The diagnosis goes to the console.

2.3 Associating a schema

The Validate an XML against a schema (XSD or DTD) button on the toolbar drops down a menu of three entries:

EntryEffect
XSDValidate against an XSD schemachoose the XML and the XSD, validation runs
DTDValidate against a DTDthe same with a DTD
Associate a schemaLink an XSD/DTD to the active filerecords the association, without validating

To validate is to associate. A validation started from XSD or DTD records the link between the two files. You therefore have nothing to redo: from that moment on, your document is validated live against that schema, and completion is driven by it.

To link without validating, use Associate a schema: the « Schema for … » dialogue lists the schemas in the workspace. The entry « (none - remove association) » undoes the link and clears the corresponding markers.

Associations are kept per workspace: they are there at the next startup.

If the application answers Open an XML file to associate a schema, the active tab is not a .xml. If it answers No schema available, your workspace holds neither XSD nor DTD.


2.4 Formatting

Shift+Alt+F, or the Format document button on the toolbar, re-indents the active file.

Formatting is undoable with a single Ctrl+Z, whatever the size of the file: it counts as one change, not one per line.


2.5 Validating as you type

What is detected continuously

While you type, Debug XML Tool checks:

  • the well-formedness of the document — unclosed tag, missing >, invalid nesting;
  • the compilation of a stylesheet — a non-existent XSLT instruction, <xsl:templae/> for example, is reported with its error code;
  • the conformity to the schema, as soon as a schema is associated with the document (§2.3).

Errors appear as a wavy underline, at the exact line and column. They disappear on their own as soon as you correct them — a Ctrl+Z is enough to make a marker vanish, without a single click.

The buffer, not the disk

Validation applies to what you see on screen, unsaved content included. That is what lets you correct before writing to disk.

Not to be confused with batch validation (Validating & comparing §7.3), which sweeps a whole folder and reflects the state of the disk — unsaved tabs are explicitly flagged there.

Switching off live validation

On very large files, or to avoid noise during a heavy rewrite, clear Live validation in the Settings menu.

The Validate active file button on the toolbar keeps working: validation on demand is independent of the setting. If the file is sound, a confirmation tells you so — « File "…" contains no syntax errors. »

Errors that come from another file

A marker is placed only on the file it really incriminates. If your document is sound but its associated schema is broken, or an xsl:include module of your stylesheet is, you will see no wrong underline on your document: the diagnosis goes to the console, prefixed [Validation] External diagnostic, with the file and line at fault.

A badly configured schema therefore never becomes a silent breakdown — but neither does it accuse the wrong file.


2.6 Finding your way in a file

Three tools, detailed elsewhere, serve day-to-day editing:

NeedGestureChapter
See the outline of the stylesheetright-hand panel, XSL STRUCTUREThe interface §1.5
Go to the declaration of a templateF12 or Ctrl+click on its nameNavigating & refactoring
Find every use of a symbolShift+F12Navigating & refactoring
Rename a template everywhereF2Navigating & refactoring

The stylesheet outline follows your buffer live: a template added and not saved appears in it, and double-clicking navigates to it.


2.7 Limits worth knowing

  • File types supported: XML, XSL/XSLT, XSD, DTD. No JSON, no graphical Author/WYSIWYG editing, no XQuery. You can open and edit a file of another type, but with no dedicated assistance.
  • XSD validation follows the W3C XML Schema 1.0 standard.
  • Schema-driven completion requires a resolved association. With no schema, it stays silent rather than guessing.
  • The XML outline and the XSD outline are built when the file is opened or when the tab changes, unlike the XSL outline which follows your typing. Switch tab and back to refresh them.

What next

Manual contents