Example #1
0
        protected Dom.XmlAttribute handleXmlAttribute(System.Xml.XmlAttribute attrib)
        {
            var xmlAttrib = new Dom.XmlAttribute();

            xmlAttrib.attributeName = attrib.Name;
            xmlAttrib.ns            = attrib.NamespaceURI;

            var strValue = new Dom.String();

            strValue.DefaultValue = new Variant(attrib.Value);

            xmlAttrib.Add(strValue);

            return(xmlAttrib);
        }
Example #2
0
        protected void handleXmlNode(Dom.XmlElement elem, XmlNode node, StringType type)
        {
            if (node is XmlComment || node is XmlDeclaration)
            {
                return;
            }

            elem.elementName = node.Name;
            elem.ns          = node.NamespaceURI;

            foreach (System.Xml.XmlAttribute attr in node.Attributes)
            {
                var strElem  = makeString("value", attr.Value, type);
                var attrName = elem.UniqueName(attr.Name.Replace(':', '_'));
                var attrElem = new Dom.XmlAttribute(attrName)
                {
                    attributeName = attr.Name,
                    ns            = attr.NamespaceURI,
                };

                attrElem.Add(strElem);
                elem.Add(attrElem);
            }

            foreach (System.Xml.XmlNode child in node.ChildNodes)
            {
                if (child.Name == "#text")
                {
                    var str = makeString(child.Name, child.Value, type);
                    elem.Add(str);
                }
                else if (!child.Name.StartsWith("#"))
                {
                    var childName = elem.UniqueName(child.Name.Replace(':', '_'));
                    var childElem = new Dom.XmlElement(childName);

                    elem.Add(childElem);

                    handleXmlNode(childElem, child, type);
                }
            }
        }