5

I have to handwriting an sample xml for my xsd, but I always get invalid message: cvc-elt.1.a: Cannot find the declaration of element 'RS_WMS_GET_PO_DATA_v2.0'.

My XSD:

<?xml version="1.0" encoding="utf-16"?>
<schema xmlns:ns0="http://www.rossinc.com/" xmlns:msbtsdml="http://schemas.rossinc.com/BizTalk" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.rossinc.com/" xmlns="http://www.w3.org/2001/XMLSchema">
  <annotation>
    <appinfo>
      <msbtsdml:StoredProcedureName xmlns:msbtsdml="http://schemas.rossinc.com/BizTalk/DMLAdapter">RS_WMS_GET_PO_DATA</msbtsdml:StoredProcedureName>
      <msbtsdml:ResponseRootName xmlns:msbtsdml="http://schemas.rossinc.com/BizTalk/DMLAdapter">poData</msbtsdml:ResponseRootName>
    </appinfo>
  </annotation>
  <element name="RS_WMS_GET_PO_DATA_v2.0">
    <complexType>
      <sequence>
        <element minOccurs="1" maxOccurs="1" name="Parameters">
          <complexType>
            <sequence>
              <element default="0" name="ERROR_OCCURRED" type="string">
                <annotation>
                  <appinfo>
                    <msbtsdml:ParamDir xmlns:msbtsdml="http://schemas.microsoft.com/BizTalk/2003">In</msbtsdml:ParamDir>
                  </appinfo>
                </annotation>
              </element>
              <element default="1" name="XML_TAGS" type="int">
                <annotation>
                  <appinfo>
                    <msbtsdml:ParamDir xmlns:msbtsdml="http://schemas.microsoft.com/BizTalk/2003">In</msbtsdml:ParamDir>
                  </appinfo>
                </annotation>
              </element>
              <element default="0" name="NUM_ROWS" type="int">
                <annotation>
                  <appinfo>
                    <msbtsdml:ParamDir xmlns:msbtsdml="http://schemas.microsoft.com/BizTalk/2003">In</msbtsdml:ParamDir>
                  </appinfo>
                </annotation>
              </element>
            </sequence>
          </complexType>
        </element>
        <element name="RS_WMS_GET_PO_DATA">
          <complexType>
            <all minOccurs="1" maxOccurs="1">
              <element name="COMPANY_CODE" type="string" />
              <element name="DIVISION" type="string" />
              <element name="PO_NUMBER" type="string" />
              <element name="PO_WH_SEQUENCE" type="string" />
              <element name="ERP_ACTION_CODE" type="string" />
            </all>
          </complexType>
        </element>
        <element name="DMLAdapterConfig">
          <complexType>
            <sequence>
              <element name="EnvironmentId" type="string" />
            </sequence>
          </complexType>
        </element>
      </sequence>
    </complexType>
  </element>
</schema>

My XML:

<?xml version="1.0" encoding="UTF-8"?>
<RS_WMS_GET_PO_DATA_v2.0>
    <Parameters>
        <ERROR_OCCURRED>0</ERROR_OCCURRED>
        <XML_TAGS>1</XML_TAGS>
        <NUM_ROWS>0</NUM_ROWS>
    </Parameters>
    <RS_WMS_GET_PO_DATA>
        <COMPANY_CODE></COMPANY_CODE>
        <DIVISION></DIVISION>
        <PO_NUMBER></PO_NUMBER>
        <PO_WH_SEQUENCE></PO_WH_SEQUENCE>
        <ERP_ACTION_CODE></ERP_ACTION_CODE>
    </RS_WMS_GET_PO_DATA>
    <DMLAdapterConfig>
        <EnvironmentId></EnvironmentId>
    </DMLAdapterConfig>
</RS_WMS_GET_PO_DATA_v2.0>

Any ideas?

Here's the website I'm using: http://www.corefiling.com/opensource/schemaValidate.html

vash_ace
  • 499
  • 2
  • 6
  • 11
  • possible duplicate of [cvc-elt.1: Cannot find the declaration of element 'MyElement'](http://stackoverflow.com/questions/13310637/cvc-elt-1-cannot-find-the-declaration-of-element-myelement) – crownjewel82 Jun 19 '14 at 17:08

2 Answers2

4
<?xml version="1.0" encoding="UTF-8"?>
<ns0:RS_WMS_GET_PO_DATA_v2.0 xmlns:ns0="http://www.rossinc.com/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.rossinc.com/ One.xsd ">
<ns0:Parameters>
<ns0:ERROR_OCCURRED>0</ns0:ERROR_OCCURRED>
<ns0:XML_TAGS>1</ns0:XML_TAGS>
<ns0:NUM_ROWS>0</ns0:NUM_ROWS>
</ns0:Parameters>
<ns0:RS_WMS_GET_PO_DATA>
<ns0:COMPANY_CODE>ns0:COMPANY_CODE</ns0:COMPANY_CODE>
<ns0:DIVISION>ns0:DIVISION</ns0:DIVISION>
<ns0:PO_NUMBER>ns0:PO_NUMBER</ns0:PO_NUMBER>
<ns0:PO_WH_SEQUENCE>ns0:PO_WH_SEQUENCE</ns0:PO_WH_SEQUENCE>
<ns0:ERP_ACTION_CODE>ns0:ERP_ACTION_CODE</ns0:ERP_ACTION_CODE>
</ns0:RS_WMS_GET_PO_DATA>
<ns0:DMLAdapterConfig>
<ns0:EnvironmentId>ns0:EnvironmentId</ns0:EnvironmentId>
</ns0:DMLAdapterConfig>
</ns0:RS_WMS_GET_PO_DATA_v2.0>

As because you did not mentioned which schema file to use for this XML file. I think tis will solve your problem.

Madhusudan Joshi
  • 4,438
  • 3
  • 26
  • 42
  • tried again,but failed. Error:Content is not allowed in prolog. – vash_ace May 08 '13 at 11:58
  • how you are validating it. I created the XSD given by you in the question and created an XML based on that using Eclipse. – Madhusudan Joshi May 08 '13 at 12:11
  • use [this](http://www.xmlvalidation.com/?L=0) link to validate xml over xsd online. Check the `Validate against external XML schema` check box and then copy the xml file in the text box. Once you click on the Validate button it will ask you to copy XSD as it is referred in the xml file. – Madhusudan Joshi May 08 '13 at 12:14
  • Yeah,it passed, but, how weird? The approach of my schema validation site is different than yours? @Joshi – vash_ace May 08 '13 at 12:34
4

I had an error

cvc-elt.1.a: Cannot find the declaration of element problem!

I solved it this way:

  1. Look for your XSD file, if it has a xmlns attribute, for instance:

    xmlns="http://yourcompany/blablabla/rootElementName"
    
  2. Look into your XML file, it must have an xmlns attribute if the XSD has defined one.

    <rootElement xmlns="http://company/xxxxxx/rootElementName">
    
  3. XML is case sensitive. Review your XML tags and compare them with the XSD tags.

Regards!

zx485
  • 28,498
  • 28
  • 50
  • 59
antmarmo
  • 41
  • 1