Reputation: 1369
How to embed special character in XML and have XDocument parse it?
<?xml version="1.0" encoding="utf-8"?>
<Customers>
<Customer>
<CustomerID>BLAUS</CustomerID>
<CompanyName>Blauer See Delikatessen</CompanyName>
<ContactName>Hanna Moos</ContactName>
<Region>testing</Region>
</Customer>
<Customer>
<CustomerID>SPLIR</CustomerID>
<CompanyName>Split Rail Beer ► Ale</CompanyName>
<ContactName>Art raunschweiger</ContactName>
<Region>WY</Region>
</Customer>
</Customers>
Upvotes: 0
Views: 254
Reputation: 499152
The file you posted is not valid XML which is why it will fail to parse.
The problem is in this line:
<CompanyName>Split Rail Beer ► Ale</CompanyName>
Which should be:
<CompanyName>Split Rail Beer ► Ale</CompanyName>
A properly encoded numeric entity is ►
(note the trailing ;
) - this translates to the character ►.
Upvotes: 2