Solved

Date Issue with XSD

Posted on 2004-09-30
3
363 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 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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

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 …
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 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