What is the correct way of using the Guid type in a XSD file?

后端 未结 3 1991
难免孤独
难免孤独 2020-12-05 13:47

I have a .xsd file which I use to generate code with the xsd.exe tool from Visual Studio. Some class members are Guids and the xsd.exe tool gives 2 warnings:

Namespa

3条回答
  •  难免孤独
    2020-12-05 14:16

    Thank you all, I found how to remove the warnings.

    As sysrqb said, the wsdl namespace has either been deleted or never existed. It seems that the xsd.exe tool knows the Guid definition internally, but it cannot validate the xsd schema.

    As boj pointed out, the only way to validate the schema with Guids in it, is to (re)define that type in a schema. The trick here is to add the Guid type to the same "http://microsoft.com/wsdl/types" namespace. This way, the xsd.exe will do the proper association between http://microsoft.com/wsdl/types:Guid and System.Guid

    I made a new xsd file for the guid type:

    
    
        
            
                
                    The representation of a GUID, generally the id of an element.
                
            
            
                
            
        
    
    

    Then, I run xsd.exe with both my original xsd file and this new xsd file:

    xsd.exe myschema.xsd guid.xsd /c
    

提交回复
热议问题