XSD: Cannot resolve the name 'type' to a(n) 'type definition' component

前端 未结 2 2100
甜味超标
甜味超标 2021-02-13 19:01

I am defining the schema but on validating it in eclipse it gives following error.

src-resolve: Cannot resolve the name \'common:Name\' to a(n) \'type def

相关标签:
2条回答
  • 2021-02-13 19:15

    From what you show it looks like you have an element Name in the common namespace, but not the type and you're trying to use the type here:

        <xsd:element name="Name" type="common:Name" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
                <xsd:documentation>Name</xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    

    So either create a type common:Name or use <xsd:element ref="common:Name" .../> instead.

    0 讨论(0)
  • 2021-02-13 19:32
    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" 
    targetNamespace="http://www.bharatsecurity.com/Patients"
     xmlns:tns="http://www.bharatsecurity.com/Patients" 
     elementFormDefault="qualified">
    <element name="patient" type="tns:Patients"></element>
    
    you need to write complex type for this tns otherwise it will result in cannot resolve type (n) error  like :- 
    
    
    <complexType name="Patients">
    <sequence>
    <element name="id" type="int" />
    <element name="name" type="string"></element>
    <element name="gender" type="string"></element>
    <element name="age" type="int"></element>
    </sequence>
    </complexType>
    </schema>
    
    0 讨论(0)
提交回复
热议问题