# CodeMirror 2: XML mode

<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <!-- This is the pure XML mode, and we're inside a comment! --> <catalog> <books> <book id="bk01"> <title>Lord of Light</title> <author>Roger Zelazny</author> <year>1967</year> <description><![CDATA[This is a great book, really!!]]></description> </book> </books> </catalog>

This is my XML parser, based on the original:

- No html mode - this is pure xml
- Illegal attributes and element names are errors
- Attributes must have a value
- XML declaration supported (e.g.: <?xml version="1.0" encoding="utf-8" standalone="no" ?>)
- CDATA and comment blocks are not indented (except for their start-tag)
- Better handling of errors per line with the state object - provides good infrastructure for extending it

What's missing:

- Make sure only a single root element exists at the document level
- Multi-line attributes should NOT indent
- Start tags are not painted red when they have no matching end tags (is this really wrong?)

MIME types defined: `application/xml`, `text/xml`.

@author: Dror BG (deebug.dev[at]gmail.com)

@date: August, 2011

@github: https://github.com/deebugger/CodeMirror2

MIME types defined: `application/xml`, `text/xml`.