Kernow 1.6.1 (beta) is now availble both as a download and via web start.
Notable things in this release:
- Line numbers on the editor panes in the sandboxes (thanks to a new version of Bounce). You might not think so, but getting line numbers down the side of the editor pane is really involved. It's like block indenting (pressing tab or shift-tab when a block of text is selected) in that it's very low level and requires a lot of coding. Why it's not an intergral part of the editor pane I don't know...
- Improved the syntax-checking-as-you-type and highlighting, and added the ability to disable it.
- The output area is now also a JEditorPane using Bounce so it supports tag highlighting. This might slow things down because now it's an HTML document where every addition is inserted at the end of the document, instead of just appending to a JTextArea... if this proves to be A Bad Thing I'll revert it back to a plain old text area with plain text.
- You can now select which tabs are visible (in options -> tabs) so if you never use certain tabs (like Batch or Schematron) you can remove them.
- If you have Saxon SA you can use XML Schema 1.1 (options -> validation)
- Improved the parameters dialog to make it less fiddly to enter params
- Slight graphical tweaks and likely other things that I've forgotten...
Friday, July 18, 2008
Thursday, July 17, 2008
The Nimbus Look and Feel
This is "Nimbus" - the new look and feel that comes with Java 6 Update 10. This is a cross platform l&f which means it should look the same on all platforms. Kernow currently uses the "platform default" look and feel so it should look like a native app on the platform it's run on, but it's hard to make sure it looks right - often what looks ok on Windows will have obscured buttons on Linux... something I should've fixed but never did.
Anyway, what do you think?
Anyway, what do you think?
Friday, July 11, 2008
Validating co-constrains in XML Schema 1.1 using xs:alternative
Rather than mess around with loads of assertions to check your co-constraints, XML Schema 1.1 introduces the
To do this you first have to define a default type, then define types for each variation by restricting that type. To choose between them, use
Here's the schema:
I really like this... schema 1.1 will be a joy to use.
xs:alternative
instruction which allows you to change the type used to validate the element based on some condition. Instead of defining one type and then adding assertions to check the variations, just define one type per variation, then assign that type based on the condition. To do this you first have to define a default type, then define types for each variation by restricting that type. To choose between them, use
xs:alternative
as a child of xs:element
. Here's an example of a co-constraint - this
and that
are allowed based on the value of the type
attribute of node
- and how to validate it:<root>
<node type="A">
<this/>
</node>
<node type="B">
<that/>
</node>
</root>
Here's the schema:
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="root" type="root"/>
<xs:element name="node" type="node">
<xs:alternative type="node-type-A" test="@type = 'A'"/>
<xs:alternative type="node-type-B" test="@type = 'B'"/>
</xs:element>
<xs:element name="this"/>
<xs:element name="that"/>
<xs:complexType name="root">
<xs:sequence>
<xs:element ref="node" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<-- Base type -->
<xs:complexType name="node">
<xs:sequence>
<xs:any/>
</xs:sequence>
<xs:attribute name="type" type="allowed-node-types"/>
</xs:complexType>
<xs:simpleType name="allowed-node-types">
<xs:restriction base="xs:string">
<xs:enumeration value="A"/>
<xs:enumeration value="B"/>
</xs:restriction>
</xs:simpleType>
<-- Type A -->
<xs:complexType name="node-type-A">
<xs:complexContent>
<xs:restriction base="node">
<xs:sequence>
<xs:element ref="this"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<-- Type B -->
<xs:complexType name="node-type-B">
<xs:complexContent>
<xs:restriction base="node">
<xs:sequence>
<xs:element ref="that"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
I really like this... schema 1.1 will be a joy to use.
Subscribe to:
Posts (Atom)