Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Easy(?) XML question - retreiving attributes >Thread Next - Re: Easy(?) XML question - retreiving attributes Re: Easy(?) XML question - retreiving attributesTo: NULL Date: 6/1/2004 5:16:00 PM Dim ItemNode As XPathNodeIterator ItemNode = PixNode.SelectChildren("item", "") the rest is obvious "Bill Grunnah" <nospam@2...> wrote in message news:eq4TILDSEHA.3056@T...... > Let's say I have XML document like this: > > <records> > <adjustments> > <pix num="1159974" seq="10" type="300" code="01" > trans_date="2004-05-29 22:27:16-05"> > <item item_num="001-109" color="WHT" size="1120">1</item> > <reason code="SP">misc</reason> > <comment ref3="8640105" /> > </pix> > <pix num="1148465" seq="10" type="300" code="01" > trans_date="2004-05-29 19:25:23-05"> > <item item_num="001-1296" color="BLK" size="1121">2</item> > <reason code="SP">misc</reason> > <comment ref3="9160134" /> > </pix> > </adjustments> > </records> > > I can quickly read through it and get the values for the num field (in > VB.net) via: > > Dim PixNode As XPathNodeIterator > PixNode = xNav.Select("//records/adjustments/pix") > do while PixNode.MoveNext() > num = PixNode.Current.GetAttribute("num", "") > loop > > While doing so, is there an way efficient way to also retrieve the values > for the item and reason elements, as well as the values of all the > attributes such as color & size? I know once I have num I can access them > via code like: > > reason_code = GetNodeString("//records/adjustments/pix[@num = '" & num > & > "']/reason/@code") > reason_text = GetNodeString("//records/adjustments/pix[@num = '" & num > & > "']/reason") > > But this is slow and inefficient; on a large file (20k records) we're > talking processing only 1 record/second. Anyone have any suggestions? > > Thanks, > Bill Grunnah > TekSolutions > www.grunnah.com > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
