views:

296

answers:

0

I currently have an XML file that is encrypted that I decrypt and put into a crypto stream. I then pass that to a method that uses the DataTable.readxml. The readxml() method takes 5-6 seconds but I'm hoping to get it down to 3-4 seconds. (or less) There are ~90k entries. I then use the DataTable for parsing data which eventually makes it to a gridview. What could I do to improve the performance? Is there any tweaking of the XML, or does iterating with an XML Data Reader yield better performance? if you know of a different approach please provide some code examples if you could.

Here is the VB.Net code:

        Dim dt As New DataTable("Users")
        dt.ReadXmlSchema(m_TheSchemaPath)
        dt.ReadXml(m_datasetstream)

The XML schema:

 <?xml version="1.0" standalone="yes" ?> 
- <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Users">
- <xs:complexType>
- <xs:sequence>
  <xs:element name="displayname" type="xs:string" minOccurs="0" /> 
  <xs:element name="samaccountname" type="xs:string" minOccurs="0" /> 
  <xs:element name="department" type="xs:string" minOccurs="0" /> 
  <xs:element name="telephonenumber" type="xs:string" minOccurs="0" /> 
  <xs:element name="mail" type="xs:string" minOccurs="0" /> 
  <xs:element name="l" type="xs:string" minOccurs="0" /> 
  <xs:element name="physicalDeliveryOfficeName" type="xs:string" minOccurs="0" /> 
  <xs:element name="objectGUID" type="xs:string" minOccurs="0" /> 
  <xs:element name="givenname" type="xs:string" minOccurs="0" /> 
  <xs:element name="initials" type="xs:string" minOccurs="0" /> 
  <xs:element name="sn" type="xs:string" minOccurs="0" /> 
  <xs:element name="facsimiletelephonenumber" type="xs:string" minOccurs="0" /> 
  <xs:element name="mobile" type="xs:string" minOccurs="0" /> 
  <xs:element name="pager" type="xs:string" minOccurs="0" /> 
  <xs:element name="streetAddress" type="xs:string" minOccurs="0" /> 
  <xs:element name="st" type="xs:string" minOccurs="0" /> 
  <xs:element name="postalcode" type="xs:string" minOccurs="0" /> 
  <xs:element name="company" type="xs:string" minOccurs="0" /> 
  <xs:element name="msexchassistantname" type="xs:string" minOccurs="0" /> 
  <xs:element name="title" type="xs:string" minOccurs="0" /> 
  <xs:element name="telephoneassistant" type="xs:string" minOccurs="0" /> 
  <xs:element name="extensionattribute10" type="xs:string" minOccurs="0" /> 
  <xs:element name="othertelephone" type="xs:string" minOccurs="0" /> 
  <xs:element name="homephone" type="xs:string" minOccurs="0" /> 
  <xs:element name="ipphone" type="xs:string" minOccurs="0" /> 
  <xs:element name="otherhomephone" type="xs:string" minOccurs="0" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:choice>
  </xs:complexType>
  </xs:element>
  </xs:schema>

Here is a sample element from the XML file I blanked the data out with "test":

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
  <Users>
    <displayname>test</displayname>
    <samaccountname>test</samaccountname>
    <department>test</department>
    <telephonenumber>test</telephonenumber>
    <mail>test</mail>
    <l>test</l>
    <physicalDeliveryOfficeName>test</physicalDeliveryOfficeName>
    <objectGUID>test</objectGUID>
    <givenname>test</givenname>
    <initials>test</initials>
    <sn>test</sn>
    <facsimiletelephonenumber>test</facsimiletelephonenumber>
    <streetAddress>test</streetAddress>
    <st>test</st>
    <company>test</company>
    <title>test</title>
    <employeeType>test</employeeType>
    <destinationIndicator>test</destinationIndicator>
  </Users>
  <Users>
    <displayname>test</displayname>
    <samaccountname>test</samaccountname>
    <department>test</department>
    <telephonenumber>test</telephonenumber>
    <mail>test</mail>
    <l>test</l>
    <physicalDeliveryOfficeName>test</physicalDeliveryOfficeName>
    <objectGUID>test</objectGUID>
    <givenname>test</givenname>
    <initials>test</initials>
    <sn>test</sn>
    <facsimiletelephonenumber>test</facsimiletelephonenumber>
    <streetAddress>test</streetAddress>
    <st>test</st>
    <postalcode>test</postalcode>
    <company>test</company>
    <msexchassistantname>test</msexchassistantname>
    <title>test</title>
    <extensionattribute10>test</extensionattribute10>
    <othertelephone>test</othertelephone>
    <homephone>test</homephone>
    <employeeType>test</employeeType>
    <destinationIndicator>test</destinationIndicator>
  </Users>