How to verify that one XSD schema is a subset of another XSD schema?

后端 未结 4 1527
轮回少年
轮回少年 2021-02-04 15:43

How can I verify that one XSD schema is a subset of another XSD schema?

We are creating a system-of-systems application using a collection of \"blueprint\" XSD schemas (

4条回答
  •  梦如初夏
    2021-02-04 16:20

    Tools that validate XML against a schema already know how to do this, because in the case of an , the newly defined type is required to be a subset of the type being restricted.

    If you'd like to tap into this functionality, you can have the child schemas define complex types that restrict types in your blueprint schema.

    If the child schemas are created without this in mind, however, this could possibly still be accomplished by modifying the child schemas to match the pattern below, then sending them through a schema processor for verification.

    Example blueprint schema, blueprintschema.xsd:

    
      
      
        
          
          
          
        
      
    
    

    Example child schema that is a subset of blueprint schema:

    
      
      
        
          
        
      
    
    

    Example child schema after transformation into a redefine construct:

    
      
        
          
            
              
                
              
            
          
        
      
      
    
    

    A schema processor will then tell you whether the redefined "rootType" is actually a subset of the original blueprint "rootType"

    Since a schema is just XML, the transformation can be done using normal XML processing tools.

提交回复
热议问题