Closed gsw945 closed 3 years ago
Hi @gsw945 thank you for writing in with this. Unfortunately, this is a known issue with classic serialization, and can further be described in these issues for your review: #501, #461
I've tried my best to figure out a good way to solve this problem, but could not find a way to do it that involves rewriting the deserializer.
The best recommendation I can provide is to use XSLT to send the classic XML document through the transformation that produces the document that ExtendedXmlSerializer can process and then send that to ExtendedXmlSerializer. I know that is not ideal but given the circumstances and constraints (please see #383), that is the best I can offer.
Please do let me know if you have any questions/issues implementing the above and I will do my best to assist you.
I'm so sorry to give up ExtendedXmlSerializer temporary.
I could only to use Newtonsoft.Json
and quicktype:
// load xml content from file
var xml = File.ReadAllText("@./test.xml", System.Text.Encoding.UTF8);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml);
// remove `<?xml version="1.0" encoding="UTF-8"?>`
if (xmlDoc.FirstChild?.NodeType == XmlNodeType.XmlDeclaration)
{
xmlDoc.RemoveChild(xmlDoc.FirstChild);
}
// convert xml to json string
var jsonString = JsonConvert.SerializeXmlNode(xmlDoc, Newtonsoft.Json.Formatting.Indented, true);
// deserialization from json to SvnLog (SvnLog is generated via quicktype, input content is the jsonString)
var objLog = SvnLog.FromJson(jsonString);
quicktype usage screenshot as below:
xml (file
test.xml
) content:core C# code:
the output is:
I want read all
logentry
intoobj.Entries
.@Mike-E-angelo need your help