Xml to JSON

Mar 20, 2013 at 9:03 AM
Edited Mar 20, 2013 at 9:04 AM

I think, worth to consider all types by XmlNode, when i test converting my xml document, i've Exception: "Unexpected XmlNodeType when serializing nodes: DocumentType

After changes:

private void SerializeNode(JsonWriter writer, IXmlNode node, XmlNamespaceManager manager, bool writePropertyName)
        switch (node.NodeType)
            case XmlNodeType.Document:
            case XmlNodeType.DocumentType:
            case XmlNodeType.DocumentFragment:
private string GetPropertyName(IXmlNode node, XmlNamespaceManager manager)
        case XmlNodeType.Element:
        case XmlNodeType.DocumentType:
It worked.

And. It would be great to add direct convert XmlToBson.