?
Solved

Date Issue with XSD

Posted on 2004-09-30
3
Medium Priority
?
364 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Accepted Solution

by:
J_Mak earned 2000 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 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