How to obtain enumerated attribute declarations from a DTD using MSXML & VB?

How to obtain enumerated attribute declarations from a DTD using MSXML & VB?

Post by Alastair Camero » Sat, 05 Jul 2003 23:46:37



I have a VB (VB6, not .NET) application that reads an XML file (using MSXML
v3.2 parser); the XML file contains a reference to an external DTD.

The DTD has numerous enumerated attribute declarations like so:

<!ATTLIST MyElement
 MyAttribute (One | Two | Three) "One"

The VB code needs to generate dynamic pick-list for all the attributes that
appear in the DTD as part of a data-entry application; each dynamically
created pick list should contain all the allowable values for the attribute
as defined by the DTD (and presented in some kind of multiple choice control
like a combo or list box). So in this case the pick list would be:

    One
    Two
    Three

I don't want to hard-code any of this; I figured the MSXML DOM should expose
the enumerated attribute declarations in some way allowing me to create my
pick list. However, I can't find any way to do it.

Can somebody help!

Thanks.

Alastair

 
 
 

How to obtain enumerated attribute declarations from a DTD using MSXML & VB?

Post by Colin Mackenzi » Sun, 06 Jul 2003 00:03:41


Hi,

I dont think you can do this as
a) the DTD has no API
b) the DTD is not XML so you cant open it and find th results yourself

Options
1/ change the DTD to a schema (by hand, using XML spy etc) and use the
schema object model to walk the tree to find the choices for the attribute
type
2/ write your won DTD parser :(

Colin


Quote:> I have a VB (VB6, not .NET) application that reads an XML file (using
MSXML
> v3.2 parser); the XML file contains a reference to an external DTD.

> The DTD has numerous enumerated attribute declarations like so:

> <!ATTLIST MyElement
>  MyAttribute (One | Two | Three) "One"

> The VB code needs to generate dynamic pick-list for all the attributes
that
> appear in the DTD as part of a data-entry application; each dynamically
> created pick list should contain all the allowable values for the
attribute
> as defined by the DTD (and presented in some kind of multiple choice
control
> like a combo or list box). So in this case the pick list would be:

>     One
>     Two
>     Three

> I don't want to hard-code any of this; I figured the MSXML DOM should
expose
> the enumerated attribute declarations in some way allowing me to create my
> pick list. However, I can't find any way to do it.

> Can somebody help!

> Thanks.

> Alastair