Xml schema, how to make sure one element exists with a specific attribute value

前端 未结 1 1677
遥遥无期
遥遥无期 2021-01-16 05:02

How do I enforce the existing of an element with a specific attribute value in the XML?

For example:


  

        
1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-16 05:51

    If you're using XML Schema 1.0, you cannot express the constraint directly. You could do it outside of XML Schema 1.0 via Schematron or XSLT directly.

    If you're using XML Schema 1.1, you can specify co-occurrence constraints via xs:assert:

    
    
      
        
          
            
              
                
                
              
            
          
          
        
      
    
    

    0 讨论(0)
提交回复
热议问题