Code example for xml data verification using regular expressions

Source: Internet
Author: User
XmlSchema is a data definition file that defines XML and uses. xsd as the file extension. It is also used to define a class of XML files. Xml Schema is a data definition file that defines XML and uses. xsd as the file extension. It is also used to define a class of XML files.

Generally, data with special meanings cannot be clearly described through the predefined data structure (type.
Declared in the XML Schema Specification: you can use facet to restrict (restriction) simple types and generate some new Atomic types (Atomic types ).
Facet has pattern, enumeration, and so on;
Here we will talk about one of the most useful ones:
Pattern + regular exPRession language (regular exPRession language)
Combined with the powerful functions of regular expressions, you can describe some complex data structures.

Examples can be verified through xmlspy, xmlwrite, or js/vbs. Below is an example of js verification (which must be supported by msxml4.0)


For information on defining XML Schema, refer to the first part of W3C XML Schema specification. For information about the built-in data types and their available limitations, check the second part of the XML Schema specification. For a brief summary of these two XML Schema specifications, see W3C Primer on XML Schema.

For a regular expression, go to http://www.regexlib.com /.

Examples:

/*** Examples. xml ***/
 
     
    
   
    
Test
     
   
    
Moonpiazza@hotmail.com
     
   
    
127.0.0.1
     
   
    
#000000
       
      
    
   
    
Guest
     
   
    
Guest@371.net
     
   
    
202.102.224.25
     
   
    
# FFFFFF
       
      
 /*** Examples. xsd ***/
 
 
  
   
     
     
   
  
   
     
      
      
      
     
   
  
   
     
     
   
  
   
     
     
   
  
   
     
     
   
  
 /*** Examples.htm ***/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.