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

RE: -1072898028 Element content invalid... blues

From: Dare Obasanjo <dareo@microsoft.com>
Date: Fri, 21 Feb 2003 08:48:01 -0800
Message-ID: <B885BEDCB3664E4AB1C72F1D85CB29F804B7C930@RED-MSG-10.redmond.corp.microsoft.com>
To: "Darrell Gamble" <dgambl00@yahoo.com>, <xmlschema-dev@w3.org>

Add the attribute  
 
elementFormDefault="qualified" 
 
to your xsd:schema element. Read the article at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml08192002.asp to understand why doing this fixes your problem. 
 
It probably would have helped if the error message read 
 
-1072898028 Element content is invalid according to the DTD/Schema.  Expecting {null}employee.  
 
instead. Where {null} indicates the null namespace. 

________________________________

From: Darrell Gamble [mailto:dgambl00@yahoo.com]
Sent: Wed 2/19/2003 5:58 PM
To: xmlschema-dev@w3.org
Subject: -1072898028 Element content invalid... blues



The following is my xml:

<?xml version="1.0"?>
<employees 
 xmlns="http://www.harrisbank.com <http://www.harrisbank.com/> "
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance> "
 xsi:schemaLocation="http://www.harrisbank.com <http://www.harrisbank.com/>  russianDollEmployees.xsd">
<employee>
<name>
<fname>Michael</fname>
<middle/>
<lname>Jackson</lname>
</name>
<address>
<address1>2300 Jackson Street</address1>
<address2></address2>
<city>Los Angelas</city>
<state>CA</state>
<zip>90210</zip>
</address>
</employee>
</employees>

 

And this is the schema:

<xsd:schema 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema> " 
 xmlns:hb="http://www.harrisbank.com <http://www.harrisbank.com/> " 
      xmlns="http://www.harrisbank.com <http://www.harrisbank.com/> "
      targetNamespace="http://www.harrisbank.com <http://www.harrisbank.com/> ">< /! P> 

 <xsd:element name="employees">
  <xsd:complexType>
   <xsd:sequence>
           <xsd:element 
            name="employee" 
            type="hb:personType" 
            minOccurs="1" 
            maxOccurs="unbounded" />
         </xsd:sequence>
  </xsd:complexType>
 </xsd:element>

 <xsd:complexType name="nameType">
  <xsd:sequence>
   <xsd:element name="fname" 
    type="xsd:string" 
    minOccurs="1" 
    maxOccurs="1" />
   <xsd:element name="middle" type="xsd:string" minOccurs="1" maxOccurs="1" />
   <xsd:element name="lname" type="xsd:string" minOccurs="1" maxOccurs="1" />
  </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="addressType">
  <xsd:sequence>
   <xsd:element name="address1" type="xsd:string" minOccurs="1" maxOccurs="1" />
   <xsd:element name="address2" type="xsd:string" minOccurs="0" maxOccurs="1" />
   <xsd:element name="city" type="xsd:string" minOccurs="1" maxOccurs="1" />
   <xsd:element name="state" type="hb:usStateType" minOccurs="1" maxOccurs="1"/>
   <xsd:element name="zip" type="hb:zipType" minOccurs="1" maxOccurs="1" />
  </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="personType">
  <xsd:sequence>
   <xsd:element name="name" type="hb:nameType" />
   <xsd:element name="address" type="hb:addressType" />
  </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="zipType">
  <xsd:choice>
   <xsd:element name="zip5" type="hb:ZipType5" />
   <xsd:element name="zip9" type="hb:ZipType9" />
  </xsd:choice>
 </xsd:complexType>

 <xsd:simpleType name="ZipType5">
  <xsd:restriction base="xsd:string">
   <xsd:pattern value="\d{5}" />
  </xsd:restriction>
 </xsd:simpleType>

 <xsd:simpleType name="ZipType9">
  <xsd:restriction base="xsd:string">
   <xsd:pattern value="\d{5}-\d{4}" />
  </xsd:restriction>
 </xsd:simpleType>

 <xsd:simpleType name="usStateType">
  <xsd:restriction base="xsd:string">
   <xsd:pattern value="[A-Z]{2}" /> 
   <xsd:enumeration value="IL" />
   <xsd:enumeration value="NY" />
   <xsd:enumeration value="CA" />
   <xsd:enumeration value="GA" />
   <xsd:enumeration value="TX" />    
  </xsd:restriction>
 </xsd:simpleType>

 <xsd:simpleType name="cityType">
  <xsd:restriction base="xsd:string">
   <xsd:enumeration value="Chicago" />
   <xsd:enumeration value="Little Rock" />
   <xsd:enumeration value="New York" />
   <xsd:enumeration value="Los Angelas" />
   <xsd:enumeration value="Manhatten" />
   <xsd:enumeration value="Atlanta" />
   <xsd:enumeration value="Houston" />
   <xsd:enumeration value="Dallas" />
  </xsd:restriction>
 </xsd:simpleType>
</xsd:schema>

This is the error: 

-1072898028 Element content is invalid according to the DTD/Schema.  Expecting employee.  

Appreciate the help!

-Darrell(dgambl00@yahoo.com)

 



________________________________

Do you Yahoo!?
Yahoo! Shopping <http://rd.yahoo.com/O=1/I=brandr/vday03/text/flow/*http://shopping.yahoo.com /shop?d=browse&id=20146735>  - Send Flowers for Valentine's Day
Received on Friday, 21 February 2003 11:48:36 GMT

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