Keith Patrick wrote:
The namespace declaration is not the same as an attribute, even though they
are declared in the same way (although I think I stated it incorrectly in a
different message). The namespace itself would be applied to the "RSS"
class as part of the XmlRootAttribute decl.
BTW: Hint for figuring this stuff out -xsd.exe. You can generate a schema
for the XML (VS.Net's XML menu does that) and then generate a class for the
schema (xsd MySchema.xsd /classes), which will show you how the runtime
expects the attributes to be applied.
Thanks Keith.
I'm trying that. Here's where I'm at.
I generated the xsd:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:ng="http://newsgator.com/schema/extensions"
xmlns:dc="http://purl.org/dc/elements/1.1/"
attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://newsgator.com/schema/extensions" />
<xs:import namespace="http://purl.org/dc/elements/1.1/" />
<xs:import namespace="http://purl.org/rss/1.0/modules/slash/" />
<xs:import namespace="http://wellformedweb.org/CommentAPI/" />
<xs:element name="rss">
<xs:complexType>
<xs:sequence>
<xs:element name="channel">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="link" type="xs:string" />
<xs:element name="description" type="xs:string" />
<xs:element ref="ng:mceImage" />
<xs:element maxOccurs="unbounded" name="item">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="pubDate" type="xs:string" />
<xs:element name="link" type="xs:string" />
<xs:element ref="dc:creator" />
<xs:element minOccurs="0" maxOccurs="unbounded"
name="category" type="xs:string" />
<xs:element name="guid">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="isPermaLink"
type="xs:boolean" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="description" type="xs:string" />
<xs:element ref="slash:comments" />
<xs:element name="comments" type="xs:string" />
<xs:element ref="wfw:comment" />
<xs:element ref="wfw:commentRss" />
<xs:element minOccurs="0" name="enclosure">
<xs:complexType>
<xs:attribute name="url" type="xs:string"
use="required" />
<xs:attribute name="length"
type="xs:unsignedInt" use="required" />
<xs:attribute name="type" type="xs:string"
use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="version" type="xs:decimal" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>
When I run XSD.exe I get this:
Schema validation warning: The
'http://newsgator.com/schema/extensions:mceImage' element is not
declared. Line 16, position 16.
Schema validation warning: The
'http://purl.org/dc/elements/1.1/:creator' element is not declared.
Line 23, position 22.
Schema validation warning: The
'http://purl.org/rss/1.0/modules/slash/:comments' element is not
declared. Line 35, position 22.
Schema validation warning: The
'http://wellformedweb.org/CommentAPI/:comment' element is not declared.
Line 37, position 22.
Schema validation warning: The
'http://wellformedweb.org/CommentAPI/:commentRss' element is not
declared. Line 38, position 22.
Warning: Schema could not be validated. Class generation may fail or
may produce incorrect results.
Error: Error generating classes for schema ''.
- The element 'http://newsgator.com/schema/extensions:mceImage' is
missing.
If you would like more help, please type "xsd /?".
Any ideas?