Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello - I am pretty comfortable with vba in excel. However, I don't know
anything about xml. I am trying to query an xml file. Here is a piece of the xml: <?xml version="1.0" encoding="UTF-8" ? - <GetCategoriesResponse xmlns="urn:ebay:apis:eBLBaseComponents" <Timestamp2006-04-28T14:27:28.172Z</Timestamp <AckSuccess</Ack <Version457</Version <Builde457_core_Bundled_2818483_R1</Build - <CategoryArray - <Category <BestOfferEnabledtrue</BestOfferEnabled <AutoPayEnabledtrue</AutoPayEnabled <CategoryID20081</CategoryID <CategoryLevel1</CategoryLevel <CategoryNameAntiques</CategoryName <CategoryParentID20081</CategoryParentID <Expiredfalse</Expired <IntlAutosFixedCatfalse</IntlAutosFixedCat <LeafCategoryfalse</LeafCategory <Virtualfalse</Virtual <ORPAfalse</ORPA <LSDfalse</LSD </Category - <Category <BestOfferEnabledtrue</BestOfferEnabled <AutoPayEnabledtrue</AutoPayEnabled <CategoryID37903</CategoryID <CategoryLevel2</CategoryLevel <CategoryNameAntiquities (Classical, Amer.)</CategoryName <CategoryParentID20081</CategoryParentID <Expiredfalse</Expired <IntlAutosFixedCatfalse</IntlAutosFixedCat <LeafCategoryfalse</LeafCategory <Virtualfalse</Virtual <ORPAfalse</ORPA <LSDfalse</LSD </Category - <Category <BestOfferEnabledtrue</BestOfferEnabled <AutoPayEnabledtrue</AutoPayEnabled <CategoryID37905</CategoryID <CategoryLevel3</CategoryLevel <CategoryNameEgyptian</CategoryName <CategoryParentID37903</CategoryParentID <Expiredfalse</Expired <IntlAutosFixedCatfalse</IntlAutosFixedCat <LeafCategorytrue</LeafCategory <Virtualfalse</Virtual <ORPAfalse</ORPA <LSDfalse</LSD </Category I need to be able to filter by CategoryParentID and return an array of CategoryNames. I know that I need to utilize XPath, but there is really no documentation in the excel help files. This is what I have tried so far: Dim xmlDoc As New Msxml2.DOMDocument40 Dim objNodeList As IXMLDOMNodeList xmlDoc.async = False xmlDoc.Load ("G:\CatTree.xml") xmlDoc.setProperty "SelectionLanguage", "XPath" Set objNodeList = xmlDoc.selectNodes("//Category") ' I get nothing returned for objNodeList MsgBox objNodeList.Length ' this is 0 For Each x In objNodeList ' skips this loop (because it is empty) MsgBox x.XML Next End Sub I think that I need to utilize selectionNameSpaces (but i'm not sure how - I'm not even completely sure I understand what a namespace is). If someone could point me towards some good examples of querying xml from vba in excel, that would be great. Specifically, the above example is the ebay category tree. So examples of using ebay's CatTree.xml would be even better. I can't find anything out there in vba (and I have really tested the limits of google's computing abilities). -- Thanks, Mike |