Archive

Posts Tagged ‘Support’

Adieu “Windows XP”

May 21, 2014 1 comment

I still remember the first glance of “Windows XP” which gave a completely new dimensions towards how easy it was to use a Windows Operating System. Dusting old memories, it was sometime in 2012 when my father agreed to buy me a personal computer, it was P4 system with 2 GB RAM and a DVD drive with an addition of a TV Tuner card. This was a pre-configured system from a branded manufacturer “HCL” and this model was called as “Busy Bee” and came with the bundled operating system “Windows XP Home Edition”.

Back those days Windows 98 SE was still widely used and considered to be the best. But Windows XP ran like a champ and gave such a positive vibe and impressions to all of my friends and family. It’s been almost 11 years and still runs the same old Windows XP. What more can I say about such a thing which never gave a thought of an OS upgrade.

Yup! Bitter truth is Microsoft wants its users (like me) to upgrade its OS and get moving with the newest ones. Windows XP was a benchmark as to how an OS should be. The ones that impressed me next is Windows 7. Windows 8, yeah I still have to get adjusted with the usage but definitely didn’t impress me yet!

As of April 8, 2014, support and updates for Windows XP are no longer available. Check out this link: http://windows.microsoft.com/en-IN/windows/end-support-help

I would definitely miss you!

Advertisements
Categories: Personal Tags: , ,

DataSet.ReadXmlSchema Method Limitations

February 23, 2011 2 comments

We basically use the DataSet.ReadXmlSchema Method to create the schema which includes table, relation, and constraint definitions for the Dataset. Having said this here is something that’s worth sharing to all of my fellow developers who happen to stumble upon this post in search of a situation to find that their dataset is loading incorrect tables when your xml schema is being read!

Case 1: Sample1.xsd

<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:simpleType name="PropertyNames">
    <xs:restriction base="xs:string">
      <xs:enumeration value="prop1"></xs:enumeration>
      <xs:enumeration value="prop2"></xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="Items">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Item" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="name" type="xs:string"/>
              <xs:element name="properties" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

When you use the dataset’s “ReadXmlSchema” method you will find that the dataset will contain 2 tables!

// Create the DataSet to read the schema into.
DataSet ds = new DataSet();
// Invoke the ReadXmlSchema method with the file name.
ds.ReadXmlSchema(@"C:\\test\\Sample1.xsd");

A XML instance representation for this schema will be:

<Items>
  <Item> [1..*]
    <name> xs:string </name> [1]
    <properties> xs:string </properties> [0..*]
  </Item>
</Items>

Case 2: Sample2.xsd

<?xml version="1.0" encoding="iso-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:simpleType name="PropertyNames">
    <xs:restriction base="xs:string">
      <xs:enumeration value="prop1"></xs:enumeration>
      <xs:enumeration value="prop2"></xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="Items">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Item" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="name" type="xs:string"/>
              <xs:element name="properties" type="PropertyNames" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

This time when you execute the following code you will find that the dataset will contain 1 table!

// Create the DataSet to read the schema into.
DataSet ds = new DataSet();
// Invoke the ReadXmlSchema method with the file name.
ds.ReadXmlSchema(@"C:\\test\\Sample1.xsd");

Whereas the XML instance representation for this schema will be:

<Items>
  <Item> [1..*]
    <name> xs:string </name> [1]
    <properties> PropertyNames </properties> [0..*]
  </Item>
</Items>

Actually, you should have noted that thou the XML instance representation for this schema (Case 2) is similar to the one in (Case 1), the dataset had only one table instead of two; After several hours of investigation and read through, I happen to discover (atleast lucky) thats there is a “Microsoft Support Article” which explains the “Limitations for DataSet Schema Files (XSD)”.

Please find the references to the file at the following location: http://support.microsoft.com/kb/319372

Question: How does this article applies to my scenario?
Answer: Use of Restriction Element Is Mostly Ignored
You can derive a new simple type by restricting an existing simple type with the restriction element. When you use the restriction element in simple types, the restriction element is ignored. Therefore, all the sub-elements of that restriction element are ignored also.

All restriction elements are ignored except the XSD simple type “string”, and its facets as follows:
> length
> minlength
> maxlength

%d bloggers like this: