Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Parsing a xsd schema with xmlread

247 views
Skip to first unread message

Marco

unread,
Aug 6, 2008, 10:45:04 AM8/6/08
to
Hi,
after a short learning period I'm able to correctly parse an
xml file (at least for my purposes).
What I'm not able to do is to get from a schema (.xsd) the
enumeration for a given attribute.
Hereafter is the part of the schema I need to parse.
The information I'd like to get are GAUSS and KAISER (and
obviously any other additional enumeration value)

Thanks in advance for any idea

marco

<xs:element name="VFCBank">
<xs:complexType>
<xs:sequence>
<xs:element ref="HighPass" minOccurs="0"/>
<xs:element ref="BandPass" minOccurs="0"/>
<xs:element ref="Notch" minOccurs="0"/>
<xs:element ref="Arbitrary" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="bFilterShape">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="GAUSS"/>
<xs:enumeration value="KAISER"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>

Donn Shull

unread,
Aug 6, 2008, 12:55:03 PM8/6/08
to
"Marco " <amore...@tiscali.it> wrote in message
<g7cddg$fln$1...@fred.mathworks.com>...

root = xmlread('xsdFileName.xsd');
document = root.getDocumentElement;
attributeList = document.getElementsByTagName
('xs:attribute');
for index1 = 0:attributeList.getLength-1
enumerationList = attributeList.item
(index1).getElementsByTagName('xs:enumeration');
for index2 = 0:enumerationList.getLength-1
disp(enumerationList.item(index2).getAttribute
('value'))
end
end

Marco

unread,
Aug 7, 2008, 3:49:02 AM8/7/08
to
Thank you Donn for your support!
Is there a way to select the enumeration for a single
element (in this case bFilterShape)?

In any case your suggestion solved 90% of my problem

marco

"Donn Shull" <donn.shul...@aetoolbox.com> wrote in
message <g7cl17$mf3$1...@fred.mathworks.com>...

Marco

unread,
Aug 7, 2008, 4:31:02 AM8/7/08
to
Solved ...
using a cellstring matrix to order the variable resulting
from your loops

Thank you

marco


"Marco " <amore...@tiscali.it> wrote in message

<g7e9de$l01$1...@fred.mathworks.com>...

0 new messages