Thread View: borland.public.delphi.xml
1 messages
1 total messages
Started by Thomas Grubb
Sun, 22 Jun 2008 17:29
XMLSchema.pas and extension of complex types
Author: Thomas Grubb
Date: Sun, 22 Jun 2008 17:29
Date: Sun, 22 Jun 2008 17:29
40 lines
2370 bytes
2370 bytes
Hi,
I am using CodeGear's XMLSchema.pas classes to parse an xml schema file.
However, I am having trouble with extensions of complex types. For example,
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="File">
<xs:complexType>
<xs:complexContent>
<xs:extension base="FilePropertiesType">
<xs:attribute name="Name" type="xs:string" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="FilePropertiesType">
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
When I parse the File element, I can find out it is using a complex type but
I cannot find a reference to the FilePropertiesType anywhere under the File
element! If I use the code:
for i := 0 to (XMLDataType as
IXMLComplexTypeDef).AttributeDefList.Count - 1 do
Items.Add.LoadSchemaFromXML((XMLDataType as
IXMLComplexTypeDef).AttributeDefList[i]);
// Get child elements
for i := 0 to (XMLDataType as
IXMLComplexTypeDef).ElementDefList.Count - 1 do
Items.Add.LoadSchemaFromXML((XMLDataType as
IXMLComplexTypeDef).ElementDefList[i]);
I can find the Name attribute, but not the Author attribute. Please help!
Thanks,
Tom
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads