Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > accessing documentation elements/unhandled attributes via the som

Reply
Thread Tools

accessing documentation elements/unhandled attributes via the som

 
 
wooks
Guest
Posts: n/a
 
      01-17-2004
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.
 
Reply With Quote
 
 
 
 
will
Guest
Posts: n/a
 
      01-18-2004
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 selectSingleNode, 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.XMLSchemaCache40
Set m_XSDDoc = New MSXML2.DOMDocument40
'sXSD is an XSD filename
m_XSDs.Add vbNullString, sXSD
Set m_XSD = m_XSDs.getSchema(vbNullString)
With m_XSDDoc
.validateOnParse = False
.async = False
.setProperty "SelectionLanguage", "XPath"
.setProperty "NewParser", True
.Load sXSD
.setProperty "SelectionNamespaces",
"xmlnss=""http://www.w3.org/2001/XMLSchema""
xmlns:sql=""urn:schemas-microsoft-com:mapping-schema"""
End With
__________________________________________________ _______________________
sxsdID = "xs:annotation/xs:appinfo/xs:mds"
Set oXMLAnnotation = oXMLAnnotationParent.selectSingleNode(sxsdID)
If oXMLAnnotation Is Nothing Then

For Each oXMLAttribute In oXMLAnnotationParent.Attributes

If oXMLAttribute.Name = "ref" Then
sxsdID = "/xs:schema/xs:element[@name=""" & oXMLAttribute.Value
& """]"
Set oXMLAnnotationParent =
m_XSDDoc.documentElement.selectSingleNode(sxsdID)
Exit For
End If

Next

sxsdID = "xs:annotation/xs:appinfo/xs:mds"
Set oXMLAnnotation = oXMLAnnotationParent.selectSingleNode(sxsdID)
End If


If Not oXMLAnnotation Is Nothing Then

For Each oXMLAttribute In oXMLAnnotation.Attributes

Select Case oXMLAttribute.Name
Case "type"

Select Case oXMLAttribute.Text
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" <> wrote in message
news: om...
> 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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer GPO settings SOM?? =?Utf-8?B?QWx2YXJvIFNvdG8=?= MCSE 6 08-03-2006 05:38 PM
Er der noen der ute som kan .......? Odd Einar HTML 1 10-22-2004 11:26 PM
Schema Object Model (SOM) for Java instead of CSharp/VisualBasic?? Ken Philips XML 2 07-20-2004 12:33 PM
Schema Object Model (SOM) for Java instead of CSharp/VisualBasic?? Ken Philips Java 1 07-20-2004 12:33 PM
why SOM of msxml4 can't load this schema? tgtt XML 2 01-28-2004 11:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57