Please note a GUI can become very complicated... I ended up using a separate
xml file to store GUI info, because if you start using xsl an xsd looks more
daunting. I use the xsd for things set by vb and an xml ref file for things
set by xsl.
You can load the xsd as a DOMDocument.
After writing the code below I realised you can actually select the
attributes directly using selectSingleNod e, which is what I now do for most
things. Selecting attributes directly means that instead of @name and @ref
you can just use @*="mynodename" .
_______________ _______________ _______________ _______________ _____________
Set m_XSDs = New MSXML2.XMLSchem aCache40
Set m_XSDDoc = New MSXML2.DOMDocum ent40
'sXSD is an XSD filename
m_XSDs.Add vbNullString, sXSD
Set m_XSD = m_XSDs.getSchem a(vbNullString)
With m_XSDDoc
.validateOnPars e = False
.async = False
.setProperty "SelectionLangu age", "XPath"
.setProperty "NewParser" , True
.Load sXSD
.setProperty "SelectionNames paces",
"xmlns:xs=""htt p://www.w3.org/2001/XMLSchema""
xmlns:sql=""urn :schemas-microsoft-com:mapping-schema"""
End With
_______________ _______________ _______________ _______________ _____________
sxsdID = "xs:annotat ion/xs:appinfo/xs:mds"
Set oXMLAnnotation = oXMLAnnotationP arent.selectSin gleNode(sxsdID)
If oXMLAnnotation Is Nothing Then
For Each oXMLAttribute In oXMLAnnotationP arent.Attribute s
If oXMLAttribute.N ame = "ref" Then
sxsdID = "/xs:schema/xs:element[@name=""" & oXMLAttribute.V alue
& """]"
Set oXMLAnnotationP arent =
m_XSDDoc.docume ntElement.selec tSingleNode(sxs dID)
Exit For
End If
Next
sxsdID = "xs:annotat ion/xs:appinfo/xs:mds"
Set oXMLAnnotation = oXMLAnnotationP arent.selectSin gleNode(sxsdID)
End If
If Not oXMLAnnotation Is Nothing Then
For Each oXMLAttribute In oXMLAnnotation. Attributes
Select Case oXMLAttribute.N ame
Case "type"
Select Case oXMLAttribute.T ext
Case "hidden"
nAttribs = nAttribs Or vbHidden
Case "readonly"
nAttribs = nAttribs Or vbReadOnly
End Select
End Select
Next
End If
regards,
Will
http://fileant.com
"wooks" <wo****@hotmail .com> wrote in message
news:88******** *************** ***@posting.goo gle.com...
I have some information embedded in included schemas which I want to
access at run-time for the purposes of contructing a GUI (they will
support field labels and tool tips).
The options seem to be to store them as documentation/appinfo elements
within the included schema or as unhandled attributes.
Because the schemas are included it seems the items would have to be
accessed via the SOM (as opposed to retrieving the details via XPATH)
but I can't see anyway how to do this. I think unhandled attributes
means having to use SAX but I can't see how.
Can anyone help.