Pattern - XML Configuration File
XML is now a common format for configuration files. It can provide a standard syntax for containing configuration data.
Features
- Unicode-aware.
- Standard common format <!
- ->
- Multiple languages for describing valid XML files.
- Standard syntax for escaping characters, and for including XML fragments.
- Hierarchical representation of data.
Advantages
- One basic syntax to learn.
- XSL engines can be used to generate XML, HTML and text content from XML source files.
- Schema languages can be used to validate XML at build time, or before deployment.
- XML-aware editors can make editing the files easier, especially if driven by the schema language.
- Trees are easy for code to navigate.
- XML namespaces allow XML from different schemas to be mixed.
Disadvantages
- Whitespace handling can be inconsistent from application to application.
- XML Parsers are invariably utterly unforgiving over errors.
- XML Schema has proven inordinately brittle to change. It is often the case that an XML configuration file, such as a web.xml file that validated against one version of a schema, fails to be considered valid by a later version.
- No way to represent characters with an ASCII value <32 other than tab, newline and carriage return.
- Base-64 encoding of binary data is very inefficient in UTF-16 encoded documents.
- Every custom XML configuration syntax is a whole new XML language to learn.
- Error messages, especially with XML Schema, are hard for beginners to understand.
- Double minus signs - are not allowed in comments. This is source of recurrent bug reports in Ant.
- Nobody really understands XML namespaces. Those that think they do still do not know whether or not the namespace ##local is implicitly part of the ##other namespace.
- The tree structure is unable to represent more complex graphs without some form of cross referencing mechanism, mechanisms which are inherently non-standard.
- If XPath is used to do cross referencing, then it can only refer to content within the hierarchy, even if the hierarchy is turned into a graph during deployment.
- The strictly hierarchical format makes it hard to concatenate documents together.
SmartFrog support
Clearly, SmartFrog is not itself an XML format. The sf-xml package can be used to work with XML content.