Validating XML with XSDs … but still allow extensibility

前端 未结 5 996
梦谈多话
梦谈多话 2020-12-13 06:38

Maybe it\'s me, but it appears that if you have an XSD




        
5条回答
  •  时光取名叫无心
    2020-12-13 07:31

    You should be able to extend your schema with the element for extensibility - see W3Schools for details.

    
    
        
            
                
                    
                    
                    
                
                
            
        
    
    

    When you add the processContents="lax" then the .NET XML validation should succeed on it.

    See MSDN docs on xs:any for more details.

    Update: if you require more flexibility and less stringent validation, you might want to look at other methods of defining schemas for your XML - something like RelaxNG. XML Schema is - on purpose - rather strict about its rules, so maybe that's just the wrong tool for this job at hand.

提交回复
热议问题