2011-09-21 15 views
7

मान्य मैंसमय त्रुटि XML स्कीमा

<product orderid="4"/> 

मैं इस तरह मेरी XSD बनाई गई एक खाली elment के लिए एक सरल स्कीमा बनाना चाहते XSD:

Error resolving component 'prodtype'. It was detected that 'prodtype' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/D:/Teacher%20assistant%202011/First%20term/web%20services/test%20programs/BpelModule1/src/product.xsd'. If 'prodtype' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'prodtype' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/D:/Teacher%20assistant%202011/First%20term/web%20services/test%20programs/BpelModule1/src/product.xsd'. 
+0

btw, 'XSD: schema' अपने उपरोक्त कोड में बंद नहीं है, कि संबंधित हो सकता है? – Piskvor

+0

नहीं, यह सिर्फ formating में त्रुटि है, इस कोड को मेरे साथ लेकिन xmlns से "टीएनएस" हटाने के बाद काम करता है: टीएनएस = "http://xml.netbeans.org/schema/first", मैं कारण अब तक समझ में नहीं आया ! – palAlaa

उत्तर

7

आप अपने XSD बदल सकते हैं और में xsd:schemaxmlns="http://xml.netbeans.org/schema/first" डाल दिया lement यह काम करना चाहिए (यह मेरे लिए किया था)

+0

बहुत बढ़िया जवाब, @jeremyhare की है कि मानार्थ। – Gangnus

13

यह काम करेंगे, जोड़ने 'टीएनएस:' प्रकार के।

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    targetNamespace="http://xml.netbeans.org/schema/first" 
    xmlns:tns="http://xml.netbeans.org/schema/first" 
    elementFormDefault="qualified">  
    <xsd:element name="product" type="tns:prodtype"/> 
    <xsd:complexType name="prodtype"> 
     <xsd:attribute name="prodid" type="xsd:integer"/> 
    </xsd:complexType>  
</xsd:schema> 

prodtype इस मामले 'http://xml.netbeans.org/schema/first' में स्कीमा की targetNamespace में परिभाषित किया गया है। ताकि इसे संदर्भ के लिए में आप डिफ़ॉल्ट नाम स्थान जो परिभाषित नहीं है में एक prodtype संदर्भित करने के लिए कोशिश कर रहे हैं करने के लिए नाम स्थान है कि में परिभाषित किया गया है शामिल करने के लिए की जरूरत है। अपने उदाहरण में।

संबंधित मुद्दे