File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Can I check whether a particular pattern of character is there in the attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Can I check whether a particular pattern of character is there in the attribute " Watch "Can I check whether a particular pattern of character is there in the attribute " New topic
Author

Can I check whether a particular pattern of character is there in the attribute

prathibha, ar
Greenhorn

Joined: Jun 22, 2001
Posts: 13
Hi,
I have got an xml file and an XSD. I am validating xml file writing all the rules in xsd.
Suppose I want to check whether the character '@' is there in the email attribute of xml file.
with regards
prathibha
Aamir Memon
Greenhorn

Joined: Jul 05, 2001
Posts: 7
hi,
you can add something like the following restriction in your schema to make sure if it is a valid email address.
<xsd:restriction base="xsd:string">
<xsd:maxLength value="128"/>
<xsd:minLength value="5"/>
<xsd pattern value="^[\w-_\.]*[\w-_\.]\@[\w-]+\.[\w-_\.]+$"/>
</xsd:restriction>
Aamir
[This message has been edited by Aamir Memon (edited July 10, 2001).]
[This message has been edited by Aamir Memon (edited July 10, 2001).]
[This message has been edited by Aamir Memon (edited July 10, 2001).]
prathibha, ar
Greenhorn

Joined: Jun 22, 2001
Posts: 13
Ho,
thanyou very much. Can u please give me the details of this pattern
<xsd attern value="^[\w-_\.]*[\w-_\.]\@[\w-]+\.[\w-_\.]+$"/>
Like what is the correct value according to this pattern.
If I want to replace this email format with a different number
which contains numbers and an hyphen anywhere in the value,
how should i write this
thanks and regards
prathibha
 
IntelliJ Java IDE
 
subject: Can I check whether a particular pattern of character is there in the attribute
 
Threads others viewed
Can I check whether a particular element has some pattern only if it is not null
Date validation with XSD
validate xml using xsd
XML Schema Help
How validate the Shcema
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture