Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Retrieving XML Attributes (VB6)

From: "Andrew" <me@--.--->
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
>
>
> 




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