protected override IDataNode ReadPrimitiveExtensionDataValue(XmlReaderDelegator xmlReader, string dataContractName, string dataContractNamespace)
        {
            IDataNode dataNode;

            switch (_extensionDataValueType)
            {
            case null:
            case JsonGlobals.stringString:
                dataNode = new DataNode <string>(xmlReader.ReadContentAsString());
                break;

            case JsonGlobals.booleanString:
                dataNode = new DataNode <bool>(xmlReader.ReadContentAsBoolean());
                break;

            case JsonGlobals.numberString:
                dataNode = ReadNumericalPrimitiveExtensionDataValue(xmlReader);
                break;

            default:
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                          XmlObjectSerializer.CreateSerializationException(SR.Format(SR.JsonUnexpectedAttributeValue, _extensionDataValueType)));
            }

            xmlReader.ReadEndElement();
            return(dataNode);
        }
        protected override IDataNode ReadPrimitiveExtensionDataValue(XmlReaderDelegator xmlReader, string dataContractName, string dataContractNamespace)
        {
            IDataNode node;
            string    str;

            if (((str = this.extensionDataValueType) != null) && !(str == "string"))
            {
                if (str != "boolean")
                {
                    if (str != "number")
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(System.Runtime.Serialization.SR.GetString("JsonUnexpectedAttributeValue", new object[] { this.extensionDataValueType })));
                    }
                    node = this.ReadNumericalPrimitiveExtensionDataValue(xmlReader);
                }
                else
                {
                    node = new DataNode <bool>(xmlReader.ReadContentAsBoolean());
                }
            }
            else
            {
                node = new DataNode <string>(xmlReader.ReadContentAsString());
            }
            xmlReader.ReadEndElement();
            return(node);
        }
        protected override IDataNode ReadPrimitiveExtensionDataValue(XmlReaderDelegator xmlReader, string dataContractName, string dataContractNamespace)
        {
            IDataNode dataNode;

            switch (extensionDataValueType)
            {
                case null:
                case JsonGlobals.stringString:
                    dataNode = new DataNode<string>(xmlReader.ReadContentAsString());
                    break;
                case JsonGlobals.booleanString:
                    dataNode = new DataNode<bool>(xmlReader.ReadContentAsBoolean());
                    break;
                case JsonGlobals.numberString:
                    dataNode = ReadNumericalPrimitiveExtensionDataValue(xmlReader);
                    break;
                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                        XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.JsonUnexpectedAttributeValue, extensionDataValueType)));
            }

            xmlReader.ReadEndElement();
            return dataNode;
        }