Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

xmlReader.ReadInnerXml throws xmlexception for invalid hexadecimal characters

$
0
0

Hi All,

   I have a xml file that holds metadata properties info of an listitem in a library. The metadata properties holds some invalid hexadecimal characters. I use the below code to read the xml file, it throws invalid hexadecimal characters xml exception.

CharacterSettings - checkcharacter doesnt seem to work. can anyone help me on how to handle this exception to remove those invalid xml values:

                                      SpFile ItemAuditFile = ListItem.File ;\\xml file with info on properties

                                    Stream AuditFile = ItemAuditFile.OpenBinaryStream();

                                        var charSettings = new XmlReaderSettings()
                                        {
                                            CheckCharacters = false
                                        };
                                        XmlReader xmlReader = XmlReader.Create(AuditFile , charSettings);
                                        xmlReader.MoveToContent();
                                        try
                                        {
                                           AuditXmlOriginal = xmlReader.ReadInnerXml();
                                        }
                                        catch
                                        {
                                        }
                                        xmlReader.Close()

Thanks,

AV1810

                                        

Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>