Wicket
  1. Wicket
  2. WICKET-3686

Provide an xml schema for the wicket tags and attributes

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5-RC4
    • Fix Version/s: 1.5-RC5
    • Component/s: wicket
    • Labels:
      None

      Description

      The schema would be useful for validation markup files and for xml editors to provide content assist.

      1. error.xml
        1 kB
        Attila Király
      2. pass.xml
        1 kB
        Attila Király
      3. WICKET-3686.patch
        9 kB
        Attila Király

        Activity

        Hide
        Attila Király added a comment -

        Attaching a patch that adds a wicket-1.5.xsd to wicket-core. It could also be hosted on the website (next to the dtd-s) too.

        It contains the wicket attributes and tags with some custom types and a few restrictions to help users provide valid values.

        Documentation is mostly copied from the wiki.

        Show
        Attila Király added a comment - Attaching a patch that adds a wicket-1.5.xsd to wicket-core. It could also be hosted on the website (next to the dtd-s) too. It contains the wicket attributes and tags with some custom types and a few restrictions to help users provide valid values. Documentation is mostly copied from the wiki.
        Hide
        Attila Király added a comment -

        Attaching updated patch. This contains a definition for wicket:container (which was missing from previous patch) and a few typo fixes.

        Show
        Attila Király added a comment - Attaching updated patch. This contains a definition for wicket:container (which was missing from previous patch) and a few typo fixes.
        Hide
        Attila Király added a comment -

        Updating patch again. Sorry for the spam.

        Now the schema allows and requires to add wicket:id attribute to wicket:container and wicket:fragment elements.

        Show
        Attila Király added a comment - Updating patch again. Sorry for the spam. Now the schema allows and requires to add wicket:id attribute to wicket:container and wicket:fragment elements.
        Hide
        Attila Király added a comment -

        Updating patch. wicket:component has an optional "name" attribute. Thanks Martin for finding these bugs in the xsd!

        Show
        Attila Király added a comment - Updating patch. wicket:component has an optional "name" attribute. Thanks Martin for finding these bugs in the xsd!
        Hide
        Attila Király added a comment -

        Updating patch with limited wicket:id uniqueness support.

        The xml validation will now fail if the wicket:id attribute value is not unique for the immediate child elements of (wicket border, component, container, enclosure, extend, fragment, head, link, message, panel elements.

        Show
        Attila Király added a comment - Updating patch with limited wicket:id uniqueness support. The xml validation will now fail if the wicket:id attribute value is not unique for the immediate child elements of (wicket border, component, container, enclosure, extend, fragment, head, link, message, panel elements.
        Hide
        Attila Király added a comment -

        Updating patch. Removing wicket:component element following WICKET-3687.

        Show
        Attila Király added a comment - Updating patch. Removing wicket:component element following WICKET-3687 .
        Hide
        Attila Király added a comment -

        Updating patch. Making validation for child elements from wicket namespace strict while keeping it forgiving for foreign elements. This way not defined wicket child elements are not allowed any more.

        Show
        Attila Király added a comment - Updating patch. Making validation for child elements from wicket namespace strict while keeping it forgiving for foreign elements. This way not defined wicket child elements are not allowed any more.
        Hide
        Attila Király added a comment -

        I was asked to provide some info on how to test the schema with Eclipse, so here it goes. With Eclipse 3.6.2 (Helios) this works:
        1. Import the xsd in Window -> Preferences -> XML -> XML Catalog -> Add: browse the schema, make sure key type is "Namespace name" and key is "http://wicket.apache.org" (they should be automatically read from the xsd by Eclipse).
        2. Open the example xml-s I am attaching with this comment. Play around with them. One should pass validation (pass.xml) and the other should report couple of errors (error.xml - no kidding).

        Note however that Eclipse custom xsd based support is a bit weak. There are probably better xml editors that could take better advantage of the schema. For example Eclipse will ignore the schema if any of the followings is true:

        • the file extension is not xml
        • the root element in the xml is not a wicket namespace element (for example a html element)
        Show
        Attila Király added a comment - I was asked to provide some info on how to test the schema with Eclipse, so here it goes. With Eclipse 3.6.2 (Helios) this works: 1. Import the xsd in Window -> Preferences -> XML -> XML Catalog -> Add: browse the schema, make sure key type is "Namespace name" and key is "http://wicket.apache.org" (they should be automatically read from the xsd by Eclipse). 2. Open the example xml-s I am attaching with this comment. Play around with them. One should pass validation (pass.xml) and the other should report couple of errors (error.xml - no kidding). Note however that Eclipse custom xsd based support is a bit weak. There are probably better xml editors that could take better advantage of the schema. For example Eclipse will ignore the schema if any of the followings is true: the file extension is not xml the root element in the xml is not a wicket namespace element (for example a html element)
        Hide
        Attila Király added a comment -

        Updating patch. Fixing regular expression for wicket:message attribute.

        Show
        Attila Király added a comment - Updating patch. Fixing regular expression for wicket:message attribute.
        Hide
        Martin Grigorov added a comment -

        The schema is added as wicket-core.jar#META-INF/wicket-1.5.xsd with r1125052.

        Show
        Martin Grigorov added a comment - The schema is added as wicket-core.jar#META-INF/wicket-1.5.xsd with r1125052.

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Attila Király
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development