Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Easy(?) XML question - retreiving attributes

From: "Bill Grunnah" <nospam@--------.--->
To: NULL
Date: 6/2/2004 6:14:00 PM
Thanks, Yan, but it doesn't work. PixNode is itself an XPathNodeIterator, so
SelectChildren isn't a valid method. Any other ideas?

Bill Grunnah
TekSolutions
www.grunnah.com


"Yan Leshinsky" <yanl@o...> wrote in message
news:e9J4HbDSEHA.2408@t......
> 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
> >
> >
>
>




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