Joe
Joe

Reputation: 1055

Classic ASP XMLDom read Root Node Name

I receive this xml text

<InsertProductsRequest>
    <ProductsContainer>
        <Product>
            <ProductCode>AB25E</ProductCode>
            <Description>Good Item bla bla...</Description>
            <Price>25.5</Price>
            <Currency>EUR</Currency>
            ......
            <ShippingService>DHL</ShippingService>
            <ShippingService>TNT</ShippingService>
        </Product>
    </ProductsContainer>
</InsertProductsRequest>

using Classic ASP and Microsoft.XMLDOM

how can I get the root node name, thus "InsertProductsRequest"

Thanks Joe

Upvotes: 0

Views: 881

Answers (1)

Kul-Tigin
Kul-Tigin

Reputation: 16950

You need to use tagName property of the documentElement.

'the string containing xml document
xml = "<InsertProductsRequest></InsertProductsRequest>"

Set doc = Server.CreateObject("MSXML2.DomDocument")
doc.loadXML xml

Response.Write doc.documentElement.tagName

Upvotes: 1

Related Questions