Article View: borland.public.delphi.xml
Article #209XMLSchema.pas and extension of complex types
From: 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
Technical Details
Message-ID:
<485e8bfb$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: f5d9b,cef81e99e2c28f75,start X-Google-Attributes: gidf5d9b,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Thomas Grubb" <tgrubb@riversoftavg.com> Newsgroups: borland.public.delphi.xml Subject: XMLSchema.pas and extension of complex types Date: Sun, 22 Jun 2008 13:29:33 -0400 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 71.179.173.195 Message-ID: <485e8bfb$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1214155771 71.179.173.195 (22 Jun 2008 10:29:31 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail