[logback-dev] [JIRA] Created: (LBCORE-239) Minimal XSD schema for the Logback XML configuration file

Geoffrey De Smet (JIRA) noreply-jira at qos.ch
Fri Dec 2 09:40:13 CET 2011


Minimal XSD schema for the Logback XML configuration file
---------------------------------------------------------

                 Key: LBCORE-239
                 URL: http://jira.qos.ch/browse/LBCORE-239
             Project: logback-core
          Issue Type: New Feature
          Components: Other
    Affects Versions: 1.0.0
            Reporter: Geoffrey De Smet
            Assignee: Logback dev list


Although it's probably impossible to have an XSD schema that has every possible configuration element,
it's possible to provide a valid XSD that allows any element at certain places, but does have a list of the common (= minimal set) of configuration elements, such as <configuration>, <appender> and <root>.

How to have a specific element that can have any child element?
{code}
<!-- The element  "appender" can have any child element, for example "foo" or "bar" or "myOwnElement" -->
      <xs:element name="appender" minOccurs="0">
        <xs:annotation>
          <xs:documentation source="version">1.0.0</xs:documentation>
          <xs:documentation source="description">TODO The appender ...</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
{code} 

Benefits:
- Can be used to validate the xml in IntelliJ/Eclipse, without having to run it.
- Code completion for XML in IntelliJ/Eclipse
- The XSD description can explain what those "minimal" elements do. With IntelliJ (and Eclipse?) that "javadoc" pops up when writing it.
- Can also be used by logback itself to validate the xml at runtime.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list