Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Retrieving XML Attributes (VB6) [Thread Next] Re: Retrieving XML Attributes (VB6)To: NULL Date: 5/24/2007 5:41:00 PM Thanks Joe,
I seem to have solved my problem.
Andrew
"Joe Fawcett" <joefawcett@n...> wrote in message
news:ONk2DfRmHHA.3888@T......
> "Andrew" <me@m...> wrote in message
> news:464cf4d2_1@n......
>> Hi All,
>>
>> (Please note this is a Visual Basic 6 project)
>>
>> I have an XML project that I need some help with, what I need to achieve
>> is
>> to get a group of elements from an XML file, then iterate through each
>> element to select only certain attributes. See below for example:
>>
>> -- Example XML File --
>>
>> <ROWDATA>
>> <ROW ATTRIBUTE1="AAA" ATTRIBUTE2="BBB" ATTRIBUTE3="CCC"
>> ATTRIBUTE4="DDD"/>
>> <ROW ATTRIBUTE1="111" ATTRIBUTE2="222" ATTRIBUTE3="333"
>> ATTRIBUTE4="444"/>
>> </ROWDATA>
>>
>> -- End XML File --
>>
>> 1. I need to build a nodelist of all elements called ROW (of which there
>> are
>> two)
>> 2. Start a loop for each element
>> 3. Then I need to select ONLY attribute1 and attribute4 from the element
>> 4. Store each attribute (of which there are two) into variables and
>> process
>> them
>> 5. Continue loop to next element
>>
>> The only way I have been able to achieve this so far it to get a nodelist
>> of
>> all the ROW elements, then iterate through each attribute and if the
>> attribute matches the one i am after, store it to a variable. The problem
>> with this approach is that is is VERY time consuming to loop through in
>> this
>> manner when you have many attributes per element.
>>
>> Any help would be great,
>>
>> Please reply via Newsgroup!
>>
>>
>> Thanks,
>> Andrew
>>
>>
> Andrew
>
> Well you don't need to loop through the attributes, they can be accessed
> directly from the element via element.getAttribute("ATTRIBUTE1").
> Depending on what you need to do with them afterwards there maybe better
> ways. For example an XSLT to create a simpler document and maybe partially
> process the attributes.
>
> --
>
> Joe Fawcett (MVP - XML)
> http://joe.fawcett.name
>
>
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
