Add attributes to a simpletype or restriction to a complextype in Xml Schema

前端 未结 2 615
执念已碎
执念已碎 2021-01-30 10:30

The problem is as follows:

I have the following XML snippet:


The problem is that I ca

2条回答
  •  青春惊慌失措
    2021-01-30 10:46

    I'd like to propose my example with more detailed explanation what actually require for mixing up inherited type with restrictions while adding attribute.

    this is the place you define your inherited type (in my case it's xs:string based one with field lenght 1024 restriction applied). you can't have this as a standard type for your field as you are going to add an "attribute" to your field too.

      
        
          
        
      
    

    this is the place where your element is defined based on your private type (in my case it's "string1024Type") and necessary attribute appended:

    
      
        
          
            
          
        
      
    
    

    both blocks could be in completely separate places of your schema. the important point is only following once again - you can't mix inheritance and attributing in the same element definition.

提交回复
热议问题