I current have the following XML fragment that I'm parsing to read its values and display them on a web page:
<root>
<PostcardTitle>The Needles</PostcardTitle>
<PostcardDescr>Granite Dells, Prescott</PostcardDescr>
<PostcardImage>
<img alt="GraniteDells" src="GraniteDells.jpg" />
</PostcardImage>
<PostcardDate />
<PostcardCredit>Photo Courtesy of Joe Schmoe</PostcardCredit>
</root>
I'm doing this through the following code (reading fragment from the database):
Dim ContentDoc As XDocument
Dim DocPoints As IEnumerable(Of XElement)
ContentDoc = XDocument.Parse(ContentData.Item(0).content)
DocPoints = ContentDoc.<root>.Elements()
For Each Item As XElement In DocPoints
Dim TempLabel As New Label
TempLabel.Text = Item.Name.LocalName & ": " & Item.Value
Dim TempLiteral As New Literal
TempLiteral.Text = "<br/><br/>"
pnlEditItems.Controls.Add(TempLabel)
pnlEditItems.Controls.Add(TempLiteral)
Next
When the script runs, all nodes are successfully parsed and displayed, including the empty PostcardDate node, except for the PostcardImage node. When debugging, evaluating Item.Value returns an empty string. However, evaluating Item.ToString() returns the PostcardItem tags and the value within it.
Is there something that needs to be done to have the XElement object read multi-line values, or am I missing something else?