-
Syntax for reading attributes in an ASP/VBScript XML file
What is the Syntax for reading attributes in an ASP/VBScript page invoking
an XML file?
I know how to read the elements, but am having a problem reading the attributes.
Thanks,
Doug
-
Re: Syntax for reading attributes in an ASP/VBScript XML file
For example, suppose you have an XML document like this and you want to find
the id attributes for all subitems. As long as you know the path to the
element, you can retrieve the attributes easily. Assume the file is loaded
into a DOMDocument variable named "doc." The @ symbol tells the parser to
select an attribute rather than an element.
Dim nodes as IXMLDOMNodeList
set nodes = doc.select("items/item/@id")
<items>
<item id="item1">Item 1</item>
<subitem id="subitem1">SubItem 1</subitem>
<item id="item2">Item 2</item>
<subitem id="subitem2">SubItem 2</subitem>
<item id="item3">Item 3</item>
</items>
"Doug" <Doug@Qualityhomes.com> wrote in message
news:3bf1abd7$1@147.208.176.211...
>
> What is the Syntax for reading attributes in an ASP/VBScript page invoking
> an XML file?
>
> I know how to read the elements, but am having a problem reading the
attributes.
>
> Thanks,
>
> Doug
-
Re: Syntax for reading attributes in an ASP/VBScript XML file
Thanks. Well, that seems simple enough, but when I try it, I get an"Object
doesn't support this property or method: 'select' " error.
Doug
"Russell Jones" <arj1@northstate.net> wrote:
>For example, suppose you have an XML document like this and you want to
find
>the id attributes for all subitems. As long as you know the path to the
>element, you can retrieve the attributes easily. Assume the file is loaded
>into a DOMDocument variable named "doc." The @ symbol tells the parser to
>select an attribute rather than an element.
>
>Dim nodes as IXMLDOMNodeList
>set nodes = doc.select("items/item/@id")
>
><items>
> <item id="item1">Item 1</item>
> <subitem id="subitem1">SubItem 1</subitem>
> <item id="item2">Item 2</item>
> <subitem id="subitem2">SubItem 2</subitem>
> <item id="item3">Item 3</item>
></items>
>
>
>"Doug" <Doug@Qualityhomes.com> wrote in message
>news:3bf1abd7$1@147.208.176.211...
>>
>> What is the Syntax for reading attributes in an ASP/VBScript page invoking
>> an XML file?
>>
>> I know how to read the elements, but am having a problem reading the
>attributes.
>>
>> Thanks,
>>
>> Doug
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|