Hi, I hope I will get usefull help. I've found a lot to this error by 
googling but nothing helps me ...

====================================================================================================================

The Error:

====================================================================================================================

cvc-elt.1: Cannot find the declaration of element 'inquiry_A2'.

====================================================================================================================

My Code:

====================================================================================================================
public boolean saveRequest(String userID, InputStream request) {
                Boolean ok = false;
                SAXBuilder builder = new SAXBuilder();
                builder.setEntityResolver(new NoOpEntityResolver());
                try {
                        Calendar calendar = Calendar.getInstance();
                        java.text.DateFormat df = new 
java.text.SimpleDateFormat("yyyyMMddHHmmss");
                        String timestamp = df.format(calendar.getTime());
                        String filename = this.xmlrequestpath + "/" + 
userID + "_REQUEST_" + timestamp + ".xml";
                        this.doc = builder.build(request);
                        this.writeToFile(doc, filename);
                    SAXBuilder builderValidator = new 
SAXBuilder("org.apache.xerces.parsers.SAXParser", true);
                        builderValidator.setFeature(
                    "http://apache.org/xml/features/validation/schema";, 
true);
                        builderValidator.setProperty(
 "http://apache.org/xml/properties/schema/external-schemaLocation";,
                    "http://www.reifen.net " + this.xmlrequestpath + "\\" 
+ this.doc.getRootElement().getName() + ".xsd");
                        builderValidator.setValidation(true);
                        this.doc = 
builderValidator.build(this.xmlrequestpath + "\\" + userID + "_REQUEST_" + 
timestamp + ".xml");
                        ok = true;
                        /*XsdSchemaSaxValidator xsdValidator = new 
XsdSchemaSaxValidator(this.xmlrequestpath + "/" + 
this.doc.getRootElement().getName() + ".xsd", filename);
                        ok = xsdValidator.validateXml();*/
                        // Fehler werden abgefangen und ausgegeben.
                } catch (IOException e) {
                        System.out.println("I/O Error: " + e.toString());
                } catch (JDOMException e) {
                        System.out.println("Corrupted file, because of: " 
+ e.getMessage());
                }
                return ok;
        }

====================================================================================================================

The XML File (no reference to xsd, couldn't changed)

====================================================================================================================
<?xml version="1.0" encoding="UTF-8"?>
<inquiry_A2>
        <DocumentID>A2</DocumentID>
        <Variant>4</Variant>
        <TransportPriority>REPL</TransportPriority>
        <Campaign>79664</Campaign>
        <SubstitutionIndicator>Y</SubstitutionIndicator>
        <CustomerReference>
                <DocumentID>VA-14-944366</DocumentID>
        </CustomerReference>
        <BuyerParty>
                <PartyID>6791349764597</PartyID>
                <AgencyCode>9</AgencyCode>
        </BuyerParty>
        <Consignee>
                <PartyID>413496463</PartyID>
                <AgencyCode>91</AgencyCode>
        </Consignee>
        <PaymentTerms>
                <PaymentMethod>C</PaymentMethod>
        </PaymentTerms>
        <OrderLine>
                <LineID>000001</LineID>
                <OrderedArticle>
                        <ArticleIdentification>
 <BuyersArticleID>008000620</BuyersArticleID>
 <ManufacturersArticleID>75989</ManufacturersArticleID>
 <EANUCCArticleID>3286347598913</EANUCCArticleID>
                        </ArticleIdentification>
 <RequestedDeliveryDate>2008-02-28</RequestedDeliveryDate>
                        <RequestedQuantity>
                                <QuantityValue>4</QuantityValue>
                        </RequestedQuantity>
                </OrderedArticle>
        </OrderLine>
        <OrderLine>
                <LineID>000002</LineID>
                <OrderedArticle>
                        <ArticleIdentification>
 <BuyersArticleID>008000450</BuyersArticleID>
 <ManufacturersArticleID>76443</ManufacturersArticleID>
 <EANUCCArticleID>3286347644313</EANUCCArticleID>
                        </ArticleIdentification>
 <RequestedDeliveryDate>2008-02-28</RequestedDeliveryDate>
                        <RequestedQuantity>
                                <QuantityValue>8</QuantityValue>
                        </RequestedQuantity>
                </OrderedArticle>
        </OrderLine>
</inquiry_A2>

====================================================================================================================

The XSD File (couldnt changed):

====================================================================================================================
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:ew="http://www.reifen.net";
    xmlns:px="http://www.reifen.net/Core";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    targetNamespace="http://www.reifen.net";>
  <xsd:import namespace="http://www.reifen.net/Core"; 
schemaLocation="inquiry_A2_reifen.net_Core.xsd"/>
  <xsd:element name="inquiry_A2">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="DocumentID">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:maxLength value="17"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Variant" type="px:Variant" minOccurs="0"/>
        <xsd:element name="TransportPriority" 
type="px:TransportPriorityType" minOccurs="0"/>
        <xsd:element name="Campaign" type="px:Campaign" minOccurs="0"/>
        <xsd:element name="SubstitutionIndicator" 
type="px:SubstitutionIndicator" minOccurs="0"/>
        <xsd:element name="CustomerReference" type="px:CustomerReference" 
minOccurs="0"/>
        <xsd:element name="BuyerParty">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="PartyID">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="17"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="AgencyCode">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="9"/>
                    <xsd:enumeration value="91"/>
                    <xsd:enumeration value="92"/>
                    <xsd:maxLength value="3"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="Consignee" minOccurs="0">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="PartyID">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="17"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="AgencyCode">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="91"/>
                    <xsd:enumeration value="92"/>
                    <xsd:maxLength value="3"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="PaymentTerms" minOccurs="0">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="PaymentMethod">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="C"/>
                    <xsd:enumeration value="K"/>
                    <xsd:maxLength value="10"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="OrderLine" maxOccurs="unbounded">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="LineID">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="6"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="OrderedArticle">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="ArticleIdentification">
                      <xsd:complexType>
                        <xsd:sequence>
                          <xsd:element name="BuyersArticleID" 
minOccurs="0">
                            <xsd:simpleType>
                              <xsd:restriction base="xsd:string">
                                <xsd:maxLength value="17"/>
                              </xsd:restriction>
                            </xsd:simpleType>
                          </xsd:element>
                          <xsd:element name="ManufacturersArticleID" 
type="px:ManufacturersArticleIDType" minOccurs="0"/>
                          <xsd:element name="EANUCCArticleID" 
type="px:EANUCCArticleIDType" minOccurs="0"/>
                        </xsd:sequence>
                      </xsd:complexType>
                    </xsd:element>
                    <xsd:element name="RequestedDeliveryDate" 
type="px:RequestedDeliveryDate" minOccurs="0"/>
                    <xsd:element name="RequestedQuantity" 
type="px:RequestedQuantity"/>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>


Thanks for your help ... 

Reply via email to