Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Getting error "obj ref" writing XMLNode
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Getting error "obj ref" writing XMLNode

 Post Reply Post Reply
Author
vshriniwasan View Drop Down
Groupie
Groupie
Avatar

Joined: 17 December 2001
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote vshriniwasan Quote  Post ReplyReply Direct Link To This Post Topic: Getting error "obj ref" writing XMLNode
    Posted: 13 November 2004 at 11:09pm

Here is the thing... I am generating the following XML.

<Sites count="13" pCount="1">
    <Site>
        <Title>demoPortal</Title>
        <Url>http://localhost:8000</Url>
        <ID>7f673e14-e991-49e8-a639-bd801debaad0</ID>
    </Site>
    <Site>
        <Title>Ct131</Title>
        <Url>http://localhost:8000/personal/ct131</Url>
        <ID>d071b723-3222-49ae-a765-0744b397b5b5</ID>
    </Site>
</Sites>

I have no problems looping through the nodes and writing it. Code below that works...

objNodeList is Sites...

For Each objNode In objNodeList
   For Each objNodeChild In objNode
      Response.Write(objNodeChild.InnerText)
   Next
Next

When I try to write a specific node, lets say title it gives me "Object reference not set to an instance of an object". Below is the code I am using to replace the above item.

Response.Write(objNodeChild("Title").InnerText)

Is there anyting wrong? Please advise...

Thanks,
Shrini



Edited by vshriniwasan
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 14 November 2004 at 4:41am
This should work:


 For Each n As XmlNode In doc.ChildNodes
Dim x As String = n("Sites").ChildNodes(0)("Title").InnerText
 Next



Edited by Mart
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.