Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / September 2007

Tip: Looking for answers? Try searching our database.

Need help for xml schema

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
955 < - 05 Sep 2007 04:17 GMT
I had develop an xml schema for checking type of data
as
    <xs:simpleType name="O_FMExchangeRate" xmlns:xs="http://
www.w3.org/2001/XMLSchema">
        <xs:restriction base="xs:float">
            <xs:minExclusive value="0.0000001"/>
            <xs:pattern value="d(0)|\d{1,5}|\d{1,5}\.\d{1,7}|\.\d{1,7}|
\d{1,5}\.|\+\d{1,5}|\+\d{1,5}\.\d{1,7}|\+\.\d{1,7}|\+\d{1,5}\."/>
       </xs:restriction>
    </xs:simpleType>

a problem is that I would like to have this field as an optional
field
but Tag pattern ... d(0)|\ (as above)  didn't help me on that.
do you have any suggestion?
Marc Gravell - 05 Sep 2007 09:18 GMT
did you mean \d{0} instead of d(0) [a literal]?
you might also be able to just use nothing - IIRC, the xsd pattern
essentially becomes "^(pattern)$" in a regex, so comparing in C#, both
the following seem to work OK:
@"^(\d{0}|(\d{2}))$"
@"^(|(\d{2}))$"

Marc
Marc Gravell - 05 Sep 2007 09:22 GMT
Note I was deliberately using a simpler pattern for testing!

And for the pedants, yes, d(0) is the literal d0 with a capture group,
not the literal d(0) as my other post might have suggested.

Marc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.