Пример #1
0
        internal void AddQualifiedNameAttribute(ElementData element, string elementPrefix, string elementName, string elementNs, string valueName, string valueNs)
        {
            string prefix = ExtensionDataReader.GetPrefix(valueNs);

            element.AddAttribute(elementPrefix, elementNs, elementName, String.Format(CultureInfo.InvariantCulture, "{0}:{1}", prefix, valueName));

            bool prefixDeclaredOnElement = false;

            if (element.attributes != null)
            {
                for (int i = 0; i < element.attributes.Length; i++)
                {
                    AttributeData attribute = element.attributes[i];
                    if (attribute != null && attribute.prefix == Globals.XmlnsPrefix && attribute.localName == prefix)
                    {
                        prefixDeclaredOnElement = true;
                        break;
                    }
                }
            }
            if (!prefixDeclaredOnElement)
            {
                element.AddAttribute(Globals.XmlnsPrefix, Globals.XmlnsNamespace, prefix, valueNs);
            }
        }
Пример #2
0
        private object DeserializeFromExtensionData(IDataNode dataNode, Type type, string name, string ns)
        {
            ExtensionDataReader underlyingExtensionDataReader;

            if (this.extensionDataReader == null)
            {
                underlyingExtensionDataReader = new ExtensionDataReader(this);
                this.extensionDataReader      = this.CreateReaderDelegatorForReader(underlyingExtensionDataReader);
            }
            else
            {
                underlyingExtensionDataReader = this.extensionDataReader.UnderlyingExtensionDataReader;
            }
            underlyingExtensionDataReader.SetDataNode(dataNode, name, ns);
            object obj2 = this.InternalDeserialize(this.extensionDataReader, type, name, ns);

            dataNode.Clear();
            underlyingExtensionDataReader.Reset();
            return(obj2);
        }
        internal void AddQualifiedNameAttribute(ElementData element, string elementPrefix, string elementName, string elementNs, string valueName, string valueNs)
        {
            string prefix = ExtensionDataReader.GetPrefix(valueNs);

            element.AddAttribute(elementPrefix, elementNs, elementName, string.Format(CultureInfo.InvariantCulture, "{0}:{1}", new object[] { prefix, valueName }));
            bool flag = false;

            if (element.attributes != null)
            {
                for (int i = 0; i < element.attributes.Length; i++)
                {
                    AttributeData data = element.attributes[i];
                    if (((data != null) && (data.prefix == "xmlns")) && (data.localName == prefix))
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (!flag)
            {
                element.AddAttribute("xmlns", "http://www.w3.org/2000/xmlns/", prefix, valueNs);
            }
        }