Details
-
New Feature
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
Description
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?
<!-- 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>
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.
Attachments
Issue Links
- relates to (in)
-
LOGBACK-934 Fix inconsistencies in XML syntax for logback.xml
- Open