Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Does anyone help me to create the appropriate xml query string thrugh VBA for example below

From: "Anthony Jones" <Ant@------------.--->
To: NULL
Date: 10/5/2007 8:43:00 AM

"avi" <avisemah@a...> wrote in message
news:1191564928.917151.270610@k......
> The xml documnet is meant to exemplify the problem.  I have done some
> researching with respect to the problem i experience (on which i will
> elaborate), but i have not managed to solve it, although i got the
> concept of what needs tom be done but not the specifics.
>
> Here is the problem:
>
> i'm trying to use the selectsinglenode method or selectnodes method of
> the msxml.dll version 2 activex object.  i managed to load the
> document, but when i tried to use the supposedly effective and fast
> querying feature embedded in that Activex object, I fail -- that is,
> neither one of those methods (i.e., selectnodes)  returns a non-empty
> list node.   this is the code that tries to retrun the
> 'cmvolcu:instrument ' element. (the code is in Excel VBA)
>
>     Dim TheList As IXMLDOMNode
>     Dim SkewXMLDomDocObject As New DOMDocument
>     SkewXMLDomDocObject.validateOnParse = False
>     SkewXMLDomDocObject.resolveExternals = False
>     SkewXMLDomDocObject.Load "c:\myxmlfilebelow.xll"
>     TheXQlString = "\\cmvolcu:instrument"
>     Set TheList = SkewXMLDomDocObject.selectSingleNode(TheXQlString)
>
>
> there is no doubt that the query string TheXQlString  is wrong.  in
> fact i tried so many, but it did not work.  i realize that the prefix
> cmvolcu represents a namespace, which the parser seeking the desired
> node must know about in one way or another.  How do I 'tell' the
> object xml query engine that 'cmvolcu' really stands for
> "mx.MarketParameters.commodity.volcurve" , the namespace representing
> that prefix in the xml document below.   if you know the answer, i
> will be greatly appreciative becuase to get around that i had to
> create my own querying function (which is only a temporary solotion).
> i read abot siimilar problems that people encountered, and i also read
> the suggested solutions.  many solutions used the namespacemanager
> object but that was in vb.net whereas i use VBA.  Some had another
> argument in the selectsinglenode method, which i did not encounter
> with the object i'm dealing with (i.e., msxml.dll version 2), so their
> solution could not be applied to  mine, though i managed to get the
> concept, i don't have the specifics of the solution to my problem.  if
> anyone out there  can tell me exactly what i need to do, that will be
> really helpful.
>


You've got the wrong path separator character.
Use "//cmvolcu:instrument".

Note the query language used in msxml2.dll doesn't understand namespaces and
simply treats the whole string cmvolcu:instrument as being the node name.

Seems a little odd to stick with such an older version when the XML is
clearly intended for a more sophisticated XML implementation.

-- 
Anthony Jones - MVP ASP/ASP.NET




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent