Saturday, March 29, 2008

XML minInclusive and maxInclusive

Problem: I originally built a xsd Schema for a xml file. The element I was designing was a "cpostcode" that has a restriction of 2000-7999. This was my code and then the error.

Original Code

<xsd:element name = "cpostcode">
<xsd:simpletype>
<xsd:mininclusive value = "2000">
<xsd:maxinclusive value = "7999">
</xsd:simpleType>
</xsd:element>
Error was complaining about minInclusive tag.


Solution: A restriction tag is needed for minInclusive and needs a attribute type.

Solution code is as follows
<xsd:element name = "cpostcode">
<xsd:simpletype>
<xsd:restriction base="xsd:integer">
<xsd:mininclusive value = "2000">
<xsd:maxinclusive value = "7999">
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
I added a restriction type with a base of xsd:integer around the minInclusive and maxInclusive tags.

Tuesday, January 22, 2008

ASP Retrieving Login Name

Issue: I wanted to retrieve the user name that is currently logged in using Visual Basics in the ASP.NET Environment. I had used the built in logging in system

Solution: Using the following code retrieves the text need.

HttpContext.current.user.identity.name

Note: Thought was important to Blog due to always referring to it.