aspose 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I check whether a particular pattern of character is there in the attribute
 
Similar Threads
How validate the Shcema
XML Schema Help
validate xml using xsd
Can I check whether a particular element has some pattern only if it is not null
Date validation with XSD