wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes Can I specify in XSD for not accepting a particular pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Can I specify in XSD for not accepting a particular pattern" Watch "Can I specify in XSD for not accepting a particular pattern" New topic
Author

Can I specify in XSD for not accepting a particular pattern

prathibha, ar
Greenhorn

Joined: Jun 22, 2001
Posts: 13
Hi,
I am validating my XML file by means of an XSD. Can I specify in
the XSD for not accepting a particular pattern.
I don't want to accept the string containing pattern "'".
Becuase if it tries to get inserted into database error will occur.
Thanks in advance
prathibha
Ambrose Tati
Ranch Hand

Joined: Oct 03, 2000
Posts: 55
Hello there,
I think, if you derive your type from xsd:string and then you specify what it should contain in the xsd attern you'll get what what you're looking for.
For example if I wanted my string to contain things like
<string of lower letters>@<string of lower letters>.com
(as in ambrosetati@home.com), I could do something like this:
<xsd:element name="myUrl">
<xsd:simpleType>
<xsd:restriction base = "xsd:string">
<xsd attern value = "([a-z])+@([a-z])+.(com)"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>

if you change <xsd attern value = "([a-z])+@([a-z])+.(com)"/> to
<xsd attern value = "([a-z])+"/> you'll ensure that it will not be empty and will only contain any combination of letters.
Hope this helps
Ambrose Tati

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I specify in XSD for not accepting a particular pattern
 
Similar Threads
create tables using java code by fetching from .sql file
XML validation tools
MVC and java
XML Error Handling
Calling IIS web page from java (that is deployed in Weblogic) using Windows security