Dear All,
I am working on a project which would like to serialize the existing XML (including some xml namespace) into JSON to save into RavenDB. However, I found the prefix of the sub-elements (with the same name) will be removed while serializing into a JSON Array. For example,
{
"books": {
"@xmlns": "http://www.example.com/bookCollection",
"book": [
{
"@publisher": "QUE",
"@xmlns:bk": "http://www.example.com/book",
"bk:title": "XML By Example",
"bk:author": "Benoit Marchal",
"bk:publication-date": "1999-12-31"
},
{
"@publisher": "Addison Wesley",
"@xmlns:bk": "http://www.example.com/book",
"bk:title": "Essential C++",
"bk:author": "Stanley Lippman",
"bk:publication-date": "2000-10-31"
},
{
"@publisher": "Addison Wesley",
"@xmlns:bk": "http://www.example.com/book",
"bk:title": "Mythical Man Month",
"bk:author": "Frederick Brooks",
"bk:publication-date": "1995-06-30"
}
}
It should be bk:book instead of book. When I deserialize this JSON back to XmlDocument, the namespace of book element is not correct. Please help. Thanks a lot.
Regards,
Mac
I am working on a project which would like to serialize the existing XML (including some xml namespace) into JSON to save into RavenDB. However, I found the prefix of the sub-elements (with the same name) will be removed while serializing into a JSON Array. For example,
{
"books": {
"@xmlns": "http://www.example.com/bookCollection",
"book": [
{
"@publisher": "QUE",
"@xmlns:bk": "http://www.example.com/book",
"bk:title": "XML By Example",
"bk:author": "Benoit Marchal",
"bk:publication-date": "1999-12-31"
},
{
"@publisher": "Addison Wesley",
"@xmlns:bk": "http://www.example.com/book",
"bk:title": "Essential C++",
"bk:author": "Stanley Lippman",
"bk:publication-date": "2000-10-31"
},
{
"@publisher": "Addison Wesley",
"@xmlns:bk": "http://www.example.com/book",
"bk:title": "Mythical Man Month",
"bk:author": "Frederick Brooks",
"bk:publication-date": "1995-06-30"
}
}
It should be bk:book instead of book. When I deserialize this JSON back to XmlDocument, the namespace of book element is not correct. Please help. Thanks a lot.
Regards,
Mac