Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

คำตอบ XML Validator finding schema

  • 1 กันยายน 2548 23:27
     
     
    I'd like to use the Visual Studio "Validate XML Data" function on the "XML" menu to check my data before I hit run.

    I deserialize the xml validating against the schema just fine by adding the schema to the XmlValidatingReader.Schemas collection in C# and this works just fine.

    I just don't see the point of the Validate XML Data option if it can't find the schema.

    Here's my schema and xml:

    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:element name="GEMM_ConfigData">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="AppSettings" minOccurs="0">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="BaudRate" type="xsd:integer" minOccurs="0" />
                                <xsd:element name="ComPort" minOccurs="0">
                                    <xsd:simpleType>
                                        <xsd:restriction base="xsd:string">
                                            <xsd:enumeration value="COM1" />
                                            <xsd:enumeration value="COM2" />
                                        </xsd:restriction>
                                    </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="LogPath" type="xsd:string" minOccurs="0" />
                            </xsd:sequence>
                        </xsd:complexType>
                    </xsd:element>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
    </xsd:schema>


    <?xml version="1.0" encoding="UTF-8"?>
    <GEMM_ConfigData
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="file:///C:/Program Files/Goodrich/GEMM/ConfigData.xsd">
      <AppSettings>
        <BaudRate>9600</BaudRate>
        <ComPort>COM3</ComPort>
        <LogPath>C:\GEMM\Logs</LogPath>
      </AppSettings>
    </GEMM_ConfigData>


    What am I missing?

ตอบทั้งหมด