ASP.NET Treeview control failing to handle angle brackets in data

I have some data which contains angle brackets in some of the fields.

Even if properly escaped as &lt: or > (or even the hex codes), in Visual Studio 2005 ASP.Net, the field data is being truncated at the first angle bracket. If I replace the data with curly braces, it displayes fine.

Example Data (unescaped):

<ITReview><row TopNode="REQ 123456 TT Description <Date sent to app dev> <Priority> <SubTask Status>"/><row TopNode="REQ 456789 TT Description <Date sent to app dev> <Priority> <SubTask Status>"/></ITReview><ITReview><row TopNode="REQ 123456 TT Description <Date sent to app dev> <Priority> <SubTask Status>"/><row TopNode="REQ 456789 TT Description <Date sent to app dev> <Priority> <SubTask Status>"/></ITReview>

Example Data (escaped):

<ITReview>
<row TopNode="REQ 123456&#x09;TT Description&#x09;&lt;Date sent to app dev&gt;&#x09;&lt;Priority&gt;&#x09;&lt;SubTask Status&gt;"/>
<row TopNode="REQ 456789&#x09;TT Description&#x09;&lt;Date sent to app dev&gt;&#x09;&lt;Priority&gt;&#x09;&lt;SubTask Status&gt;"/>
</ITReview>

Not doing anything tricky, binding the TreeView to an XMLDataSource with the file name set, and specifying the binding as DataMember=row and TextField=TopNode.

I didn't find anything online, but of course searching for "angle bracket" just increases the number of results, not decreases them.

Anyone see anything like this? Know of a workaround or solution? ASP.Net v2.0.50727.

Update: example of the CDATA I used, as suggested. Didn't work.

<ITReview> <TopNode> <MainData> <![CDATA[REQ 123456 TT Description <Date sent to app dev> <Priority> <SubTask Status>]]> </MainData> </TopNode> <TopNode> <MainData> <![CDATA[REQ 456789 TT Description <Date sent to app dev> <Priority> <SubTask Status>]]> </MainData> </TopNode> </ITReview>

Answers


If I double encode the angle brackets, it appears to work, at least how I think you're looking for. So &amp;lt; instead of <

I poked around looking for the cause of this thinking there might be a setting you could change. It looks like it's coming from the Value property of the XmlAttribute class, but I don't see a way to turn it off.


Try writing it out within the context of an HTMLEncode()


Can you modify the source XML, such that instead of having your data in the TopNode="" attribute, you have <row><TopNode><![CDATA[long string]]></TopNode></row>?


Need Your Help

Reflections library not working when used in an Eclipse plug-in

java eclipse reflection eclipse-plugin classloader

I have developed an application using the Reflections library for querying all the classes having a particular annotation. Everything was working like a charm until I decided to create an Eclipse p...

trouble with nested layouts

android layout

I'm just beginning Android and have gotten myself stuck. I've made a simple app/view. The idea is draw a line-maze in the top, with motion buttons on the bottom. My app only draws an x with a co...

Twitter Bootstrap: navbar button not showing or toggling collapse

twitter-bootstrap collapse navbar twitter-bootstrap-rails

I'm adapting Twitter's Bootstrap to my Ruby on Rails tutorial project (By Michael Hartl) and the upper navigation isn't collapsing.