When adding XML nodes
var temp2 = temp1.Element("staticContent");
if (temp2 != null)
{
string str = "<remove fileExtension=\".svg\" />\r\n <mimeMap fileExtension=\".svg\" mimeType=\"image/svg+xml\" />\r\n <remove fileExtension=\".nupkg\" />\r\n <mimeMap fileExtension=\".nupkg\" mimeType=\"application/zip, application/octet-stream\" />\r\n <remove fileExtension=\".webm\" />\r\n <mimeMap fileExtension=\".webm\" mimeType=\"video/webm\" />\r\n <remove fileExtension=\".mp4\" />\r\n <mimeMap fileExtension=\".mp4\" mimeType=\"video/mp4\" />";
temp2.AddFirst(XElement.Parse(str));
}
Multiple nodes must be separated from, and added one by one
When parsing XML strings
[Test]
public void XmlTest()
{
string xml = "<Record ID=\"135\" Key=\"CustomTableItemID\" /> <Record ID=\"23\" Key=\"CustomTableID\" />";
XElement element = XElement.Parse(xml);
Console.WriteLine(element);
}
You need to add a root node for parsing
Similar Posts:
- C# String was not recognized as a valid DateTime [How to Solve]
- [Solved] Json.Net Error: Error getting value from ‘ScopeId’ on ‘System.Net.IPAddress’
- [Solved] Json.Net – Error getting value from ‘ScopeId’ on ‘System.Net.IPAddress’
- Error parsing XML: junk after document element [How to Solve]
- How to Solve Error: Unexpected token o in JSON at position 1
- Error in xxx.js from uglifyjs after elementui upgrade [How to Solve]
- Unexpected token ‘ in JSON at position 2 at JSON.parse
- [Solved] Grpc.Core.RpcException:“Status(StatusCode=Internal, Detail=”Error starting gRPC call: An error occurred while sending the request.”)”
- An error is reported when traversing the list collection to delete elements
- [923]ElasticSearch 7.4.2 Root mapping definition has unsupported parameters