RealSimpleBlog custom control (V0.1): Day 5

.NET, ASP.NET 2.0, Technical stuff, Website
See comments
I reached my goal for today, which was to implement the Image element. So now my blog control can display: Date, Title, Text, Frame, List, Image. The last one I still need to write is a small element displaying a thumbnail banner. Since thumbnails are made actually images, I can reuse my method, so it should be fast.
I reworked the XSD schema, because the Image element was really too simple in the last version. I extended it with a Link, a Target for the link, and a ALT attribute, which is also used for the TITLE of the image. I made a type with this Image element, in order to re-use it for thumbnails. Also, I used enumerations for the Target element, in order to enumerate the _self, _top, _blank and _parent targets. Additionally, the target can be any name starting with a literal character, so I defined a union between this enumeration and a regular expression (pattern). That was fun.
<xs:complexType name="Image"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="link" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="link-target" minOccurs="0" maxOccurs="1"> <xs:simpleType> <xs:union> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="_blank" /> <xs:enumeration value="_top" /> <xs:enumeration value="_self" /> <xs:enumeration value="_parent" /> </xs:restriction> </xs:simpleType> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="[a-zA-Z].+" /> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> </xs:element> <xs:element name="alt-title" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="legend" type="xs:string" minOccurs="0" maxOccurs="1" /> </xs:choice> <xs:attribute name="path" type="xs:string" use="required" /> </xs:complexType>
Extract of the XSD file: The Image type
Blog entry: XSD Schema
Blog entry: XSD Schema
If everything goes well tomorrow evening, I'll be able to post a demo page before this weekend, and then to work on integrating the control in my main webpage and in my PhotoAlbum.
Previous entry | Next blog entry

Responses to “RealSimpleBlog custom control (V0.1): Day 5”

  1. Hal Says:

    Wow - nice work!

  2. Laurent Says:

    Thanks Hal. I will probably post examples and demo of the RealSimpleBlog control these next days. The goal is to distribute the control open source, as soon as V1 is finished. Stay tuned ;-)

Comments for RealSimpleBlog custom control (V0.1): Day 5