W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2002

Re: Help : Blank XML tags inside another Blank XML Tag : Getting error msg

From: Jeni Tennison <jeni@jenitennison.com>
Date: Sat, 9 Feb 2002 11:15:06 +0000
Message-ID: <1231037672333.20020209111506@jenitennison.com>
To: "Neill Smith" <smith_neill@hotmail.com>
CC: xmlschema-dev@w3.org
Hi Neill,

> The problem is that I get the error message Unexpected child element
> 'AAADataLines'.

This error arises when your instance document (XML file) contains an
element calls 'AAADataLines', but the content model of the type of its
parent element does not contain a reference to or declaration of an
element called 'AAADataLines'.

In your case, the AAADataLines element occurs within an AAADataSheet
element, within a AAADataSheets element. The element declaration for
the AAADataSheet element in your schema looks like:

<xsd:element name="AAADataSheet" minOccurs="0" maxOccurs="unbounded">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="Sheet_Number" type="AAAClaims:SheetNumberType"/>
      <xsd:element name="Country" type="AAAClaims:CountryType"/>
      <xsd:element name="LFA_NLFA_IND">...</xsd:element>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>

In other words, the schema states that the AAADataSheet element
contains a Sheet_Number element, followed by a Country element,
followed by a LFA_NLFA_IND element. It does not say that it contains
an AAADataLines element. In the instance, the AAADataSheet element
contains an AAADataLines element. Therefore the instance is not valid
according to the schema.

Assuming that you want to retain the AAADataLines element in the
instance document, you must change the schema so that the content
model of the complex type definition for the AAADataSheet element
contains a particle that refers to the global declaration for the
AAADataLines element, as follows:

<xsd:element name="AAADataSheet" minOccurs="0" maxOccurs="unbounded">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="Sheet_Number" type="AAAClaims:SheetNumberType"/>
      <xsd:element name="Country" type="AAAClaims:CountryType"/>
      <xsd:element name="LFA_NLFA_IND">...</xsd:element>
      <xsd:element ref="AAADataLines" />
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Saturday, 9 February 2002 06:15:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:26 GMT