.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

xml set innertext on nothing

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
 

        objNodeListb2.FirstChild.InnerText = DateTime.Now.ToShortDateString()


That gives me a

Object reference not set to an instance of an object.


I know what the problem is, the tags is blank 


 <payment>
      <paymentdate>
      </paymentdate>
      <paymentamount>0.00</paymentamount>
    </payment>

 <payment>

      <paymentdate>

      </paymentdate>

&


View Complete Post


More Related Resource Links

HtmlContainerControl.InnerText and

  
HtmlContainerControl.InnerText is supposed to decode HTML to text. For example, it will be "<b> Hello </b>" if the HTML code is "&lt; b &gt; Hello &lt; /b &gt;." as described in MSDN.  However I have noticed it does not change </br> to a NewLine string.  In other words, one would get "<b> Hello</br>Foo</b>" from "&lt; b &gt; Hello</br>Foo&lt; /b &gt;.", not"<b> HelloFoo</b>" Is this what supposed to be?I am asking this is because when I select and copy the text inside a <div> in a browser and paste it to a text editor such as Notepad, it would look exactly as it is shown in a browser -</br> becomes newline.  I thought I would get this with HtmlContainerControl.InnerText.

Select nodes based on element innertext

  
This should be easy...hoping someone could have a look & see what wrong with my code. I'm simply trying to loop through an xml document & grab multiple nodes if a specific element contains specific text. So if my xml looks like this: <Settings><Document>        <FriendlyName>The Big One</FriendlyName>        <ID>8ae3428b-f1f2-4b94-a65c-2c8e24f660c8</ID>        <Post>True</Post>        <Department>Collections</Department>        <Category>Forms</Category>        <Audience></Audience>        <Link Type="Page" Target=""><![CDATA[]]></Link>        <Keywords></Keywords>    </Document></Settings> So my requirement is: For each element, If FriendlyName contains "Big", get the inntertext of FriendlyName, Department, Category, Link and pipe them together like this: "The Big One | Collections | Forms | Link"   It looks like I'm having problems with the If statement, if I remove it I'll get every

Need help with getting InnerText from a specific node

  

Hi,

I work with a third party API that sends the following XML response.

<?xml version="1.0" encoding="UTF-8"?>
<hash>
<job>
<test type="boolean">true</test>
<state>finished</state>
 <id type="integer">1234567</id>
</job>
<output>
<url>http://www.MyJobURL.com/MyJobID</url>
 <state>finished</state>
 <label>LabelAssignedToFinalOutput</label>
 <id type="integer">987654</id>
</output>
</hash>


I'm interested in getting the state and id for the job. I tried GetElementById but so far I'm making a mistake somewhere, I keep getting object reference not set... error.

I could use some help with this. Thanks.


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend