DTD与XSD的一个范例

一个xml的格式如下,
Java代码  收藏代码

     
     
     
     
         
             
                 
                    javax.swing.JLabel  
                     
                        text  
                        Face:  
                   
 
               
 
           
 
             
                 
                    javax.swing.JComboBox  
               
 
           
 
             
                 
                    javax.swing.JTextArea  
                     
                        text  
                        The quick brown fox jumps over the lazy dog  
                   
 
                     
                        editable  
                        false  
                   
 
                     
                        lineWrap  
                        true  
                   
 
                     
                        border  
                         
                             
                                javax.swing.border.EtchedBorder  
                           
 
                       
 
                   
 
               
 
           
 
       
 
         
             
                 
                    javax.swing.JCheckBox  
                     
                        text  
                        Bold  
                   
 
               
 
           
 
       
 
         
             
                 
                    javax.swing.JCheckBox  
                     
                        text  
                        Italic  
                   
 
               
 
           
 
       
 
   
 


,对就在的dtd文件格式:
Java代码  收藏代码

       
       
     
       
       
     
     
     
     
     
     
     
     
      
     
     
      
     
     
     
     
     
     
     


XSD文件格式如下
Java代码  收藏代码

     
         
          
         
          
         
             
                 
           
 
       
 
          
         
             
                 
           
 
       
 
          
         
             
                 
           
 
             
             
             
             
             
             
             
                 
                     
                         
                         
                         
                         
                   
 
               
 
           
 
             
                 
                     
                         
                         
                         
                   
 
               
 
           
 
             
             
       
 
          
         
             
                 
                 
           
 
             
       
 
          
         
             
                 
                 
           
 
       
 
          
         
             
                 
                 
                 
                 
           
 
       
 
   
 



DTD比XSD简单,功能上也相对较弱

你可能感兴趣的:(java,xml)