This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
prathibha, ar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic