Check out the sample XML below.
Sample XML:
<xs:element name="Image">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="Type" type="xs:string" use="required"/>
<xs:attribute name="Name" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
If I was at the "Image" element in a XmlSchema object. How would I get
access to the attributes "Type" and "Name"?
If this type wasn't a "simpleContent" extension I would do the
following:
Dim eDerivedType As XmlSchemaComplexType =
DirectCast(sType.BaseXmlSchemaType,
System.Xml.Schema.XmlSchemaComplexType)
For Each att As XmlSchemaAttribute In eDerivedType.Attributes
Next 'att
I've looked through the object via the intellisense but can't seem to
find the attributes. Is the really a valid schema?
Zafar Abbas - 04 Nov 2005 22:26 GMT
Given the XmlSchemaComplexType as ct.
ct.ContentModel must be of type XmlSchemaSimpleContentExtension. Just look
in its Attributes property.
> Check out the sample XML below.
>
[quoted text clipped - 25 lines]
> I've looked through the object via the intellisense but can't seem to
> find the attributes. Is the really a valid schema?
SideByEach - 07 Nov 2005 13:07 GMT
Can you clarify your post. I can't make heads or tails out of it. The
XmlSchemaComplexType object I have has no attributes for the above
portion of the schema.
Zafar Abbas - 07 Nov 2005 19:28 GMT
The XmlSchemaComplexType object contains a ContentModel object, which is of
the type XmlSchemaSimpleContentExtension, _this_ object has an attributes
property.
> Can you clarify your post. I can't make heads or tails out of it. The
> XmlSchemaComplexType object I have has no attributes for the above
> portion of the schema.