Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

XML Again XSD: "The element cannot contain text. Content model is empty"

$
0
0

I'm been working on this for the past couple hours and I believe I know the answer to my question, but I'm not sure why. 

 

Problem I have is that I am trying to validate an XML document passed into my web service with an XSD file.  The XSD file was built with the XML designer that comes with VS 2005.  Each time I run the XmlReader class to validate the xml aginst the XSD at the confirmationNumber elemets does the validation raises an error of  "The element cannot contain text. Content model is empty"

 

This one of my unique elements that contain both an attribute and has a inner text value.  My observation is that the validator does not like the mixed attribute/element.  Why I think this way I'm not sure, I've looked around the for any documentation that could be of some value but either there is none, which I believe is highly unlikely or I just did not search enough.

 

What I would hope is someone could give a once over to my XML / Schema if in fact I am doing something wrong or suggestion on how to maintain this mixed attribute/element.

 

 

Tools

Visual Studio 2005

2.0 Frameword

 

XML:

 

      <?xml version=""1.0"" encoding=""utf-8"" ?>
        <message command=""ApplicationRequest"">
            <confirmationNumber Program=""A"">692993</confirmationNumber>
        </message>

 

Schema:

 

<?xml version="1.0" encoding="utf-8"?>
<xsTongue Tiedchema id="DetailReport" xmlns:xs="
http://www.w3.org/2001/XMLSchema">
  <xs:element name="message">
    <xs:complexType>
      <xsTongue Tiedequence>
        <xs:element ref="confirmationNumber" maxOccurs="1" minOccurs="1" />
      </xsTongue Tiedequence>
      <xs:attribute name="command">
        <xsTongue TiedimpleType>
          <xs:restriction base="xsTongue Tiedtring">
            <xs:enumeration value="ApplicationRequest" />
          </xs:restriction>
        </xsTongue TiedimpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:element name="confirmationNumber">
    <xs:complexType>
      <xsTongue Tiedequence />
      <xs:attribute name="program">
        <xsTongue TiedimpleType>
          <xs:restriction base="xsTongue Tiedtring">
            <xs:enumeration value="A" />
            <xs:enumeration value="B" />
          </xs:restriction>
        </xsTongue TiedimpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

</xsTongue Tiedchema>

 

 


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>