2008-08-29, 06:25 PM
Folks,
After spending a couple of hours debugging a CompositeImage not found problem (turns out I had 'borderwidth' instead of 'borderWidth' in one of the child elements), I put together a quick DTD to use for validating my Skin2 XML files, and thought I'd post it in case anyone else is interested.
I couldn't find anything about DTDs in the forums, so my apologies if there is a standard version out there somewhere. Also, I'm not entirely sure that I've got everything right as far as what is optional vs. required or if the element set is complete, so feel free to let me know if you try it and see something wrong.
Anyway, if you'd like to use this with your Skin2 skin XML, just drop the DTD file in your main skin2 directory and add a <!DOCTYPE> tag to the start of your XML. For example, a skin.xml file (based on JavaWiz's most excellent utilities and tutorials) might look like:
[INDENT]
<?xml version="1.0"?>
<!DOCTYPE settings SYSTEM "C:\Program Files\Devnz\GBPVR\Skin\Skin2.dtd">
<settings>
<!-- named colours -->
<NamedColors>
<NamedColor name="NormalTextBoxBorder" color="Gray"/>
</NamedColors>
<!-- text style -->
<TextStyles>
<TextStyle name="DateTimeTextStyle" color="LightGray" size="10" typeFace="Arial" style="Bold"/>
</TextStyles>
<!-- placements -->
<Placements>
<Placement name="SystemDateTime" loc="65.0,02.0" />
</Placements>
<!-- Composite Images -->
<CompositeImages>
<!-- =========================================================== -->
<!-- Label Images -->
<!-- =========================================================== -->
<CompositeImage name="SystemDateTimeImage" size="35.0,15.0">
<DrawText text="@date" loc="0,0" size="100.0,45.0" textStyle="DateTimeTextStyle" align="Right"/>
<DrawText text="@time" loc="0,20" size="100.0,45.0" textStyle="DateTimeTextStyle" align="Right"/>
</CompositeImage>
</CompositeImages>
</settings>
[/INDENT]
If you put the Skin2.dtd file somewhere else, be sure to update the reference at the start of your XML.
There are a lot of validation tools out there, but if you use the Visual C# Express (I use 2008, but I think it works in 2005, too) and add the XML file to your project, you get auto-validation when you edit the file.
After spending a couple of hours debugging a CompositeImage not found problem (turns out I had 'borderwidth' instead of 'borderWidth' in one of the child elements), I put together a quick DTD to use for validating my Skin2 XML files, and thought I'd post it in case anyone else is interested.
I couldn't find anything about DTDs in the forums, so my apologies if there is a standard version out there somewhere. Also, I'm not entirely sure that I've got everything right as far as what is optional vs. required or if the element set is complete, so feel free to let me know if you try it and see something wrong.
Anyway, if you'd like to use this with your Skin2 skin XML, just drop the DTD file in your main skin2 directory and add a <!DOCTYPE> tag to the start of your XML. For example, a skin.xml file (based on JavaWiz's most excellent utilities and tutorials) might look like:
[INDENT]
<?xml version="1.0"?>
<!DOCTYPE settings SYSTEM "C:\Program Files\Devnz\GBPVR\Skin\Skin2.dtd">
<settings>
<!-- named colours -->
<NamedColors>
<NamedColor name="NormalTextBoxBorder" color="Gray"/>
</NamedColors>
<!-- text style -->
<TextStyles>
<TextStyle name="DateTimeTextStyle" color="LightGray" size="10" typeFace="Arial" style="Bold"/>
</TextStyles>
<!-- placements -->
<Placements>
<Placement name="SystemDateTime" loc="65.0,02.0" />
</Placements>
<!-- Composite Images -->
<CompositeImages>
<!-- =========================================================== -->
<!-- Label Images -->
<!-- =========================================================== -->
<CompositeImage name="SystemDateTimeImage" size="35.0,15.0">
<DrawText text="@date" loc="0,0" size="100.0,45.0" textStyle="DateTimeTextStyle" align="Right"/>
<DrawText text="@time" loc="0,20" size="100.0,45.0" textStyle="DateTimeTextStyle" align="Right"/>
</CompositeImage>
</CompositeImages>
</settings>
[/INDENT]
If you put the Skin2.dtd file somewhere else, be sure to update the reference at the start of your XML.
There are a lot of validation tools out there, but if you use the Visual C# Express (I use 2008, but I think it works in 2005, too) and add the XML file to your project, you get auto-validation when you edit the file.