This project has moved and is read-only. For the latest updates, please go here.

Xml to JSON

Mar 20, 2013 at 10:03 AM
Edited Mar 20, 2013 at 10: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.