Solved

Date Issue with XSD

Posted on 2004-09-30
3
360 Views
Last Modified: 2010-08-05
Hi
I have the following xml document and XSD.
When i load xml and xsd into dataset it is woking fine and able to sort with dataview.

Problem :
If i have date format is like mm/dd/yyyy.Then what i need to change in my xsd to accept mm/dd/yyyy format at the same same i need data type.

If i use simple type and regluar expression we can do it but will lost the datatype.I can format but ican't sort.

So how can i solve this issue.

               <SummaryInformation >
                    <PickupDate>2003-02-02</PickupDate>
                    <IncentiveCredit>-231.08</IncentiveCredit>
                    <BilledCharges>724.67</BilledCharges>
               </SummaryInformation>


>


<?xml version="1.0" standalone="yes" ?>
<xs:schema id="main" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
      <xs:element name="main" msdata:IsDataSet="true">
            <xs:complexType>
                  <xs:choice maxOccurs="unbounded">
                        <xs:element name="SummaryInformation">
                              <xs:complexType>
                                    <xs:sequence>
                                          <xs:element name="PickupDate" type="xs:date" minOccurs="0" />
                                          <xs:element name="IncentiveCredit" type="xs:decimal" minOccurs="0" />
                                          <xs:element name="BilledCharges" type="xs:decimal" minOccurs="0" />
                                    </xs:sequence>
                              </xs:complexType>
                        </xs:element>
                  </xs:choice>
            </xs:complexType>
      </xs:element>
</xs:schema>
0
Comment
Question by:pprasadravi
3 Comments
 
LVL 7

Accepted Solution

by:
J_Mak earned 500 total points
ID: 12196321
Have something like this:

<?xml version="1.0" standalone="yes" ?>
<xs:schema id="main" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
     <xs:element name="main" msdata:IsDataSet="true">
          <xs:complexType>
               <xs:choice maxOccurs="unbounded">
                    <xs:element name="SummaryInformation">
                         <xs:complexType>
                              <xs:sequence>
                                   <xs:element name="PickupDate" type="type_date" minOccurs="0" />
                                   <xs:element name="IncentiveCredit" type="xs:decimal" minOccurs="0" />
                                   <xs:element name="BilledCharges" type="xs:decimal" minOccurs="0" />
                              </xs:sequence>
                         </xs:complexType>
                    </xs:element>
               </xs:choice>
          </xs:complexType>
     </xs:element>

     <xs:simpleType name="type_date">
          <xs:restriction base="xs:string">
               <xs:pattern value="[0-1][0-2]/[0-3][0-9]/[0-2][0-9][0-9][0-9]"/>
          </xs:restriction>
     </xs:simpleType>

</xs:schema>

I haven't tried this, but have a look if it is useful to you. Cheers!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What XAML would produce this? 3 80
installing and using WTP plugin eclipse MARS 3 112
RSS Feed Enclosure URL 1 121
XSL - change date format 3 45
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question