GetXmlDocument() public method

public GetXmlDocument ( ) : XmlDocument
return System.Xml.XmlDocument
        public override IHierarchicalEnumerable Select()
        {
            XmlNode root = _owner.GetXmlDocument();

            XmlNodeList nodes = null;

            if (!String.IsNullOrEmpty(_viewPath))
            {
                XmlNode node = root.SelectSingleNode(_viewPath);
                if (node != null)
                {
                    nodes = node.ChildNodes;
                }
            }
            else
            {
                if (_owner.XPath.Length > 0)
                {
                    nodes = root.SelectNodes(_owner.XPath);
                }
                else
                {
                    nodes = root.ChildNodes;
                }
            }

            return(new XmlHierarchicalEnumerable(nodes));
        }
Example #2
0
        private AdRec[] GetXmlDataSourceData(XmlDataSource xmlDataSource)
        {
            XmlDocument xmlDocument = xmlDataSource.GetXmlDocument();

            if (xmlDocument == null)
            {
                return(null);
            }
            return(this.LoadXmlDocument(xmlDocument));
        }
        private AdRec [] GetXmlDataSourceData(XmlDataSource xmlDataSource)
        {
            Debug.Assert(xmlDataSource != null);

            XmlDocument doc = xmlDataSource.GetXmlDocument();

            if (doc == null)
            {
                return(null);
            }
            return(LoadXmlDocument(doc));
        }
Example #4
0
        void DoXPathSelect()
        {
            XmlNodeList selected_nodes = owner.GetXmlDocument().SelectNodes(owner.XPath != "" ? owner.XPath : "/*/*");

            nodes = new ArrayList(selected_nodes.Count);

            foreach (XmlNode node in selected_nodes)
            {
                if (node.NodeType == XmlNodeType.Element)
                {
                    nodes.Add(node);
                }
            }
        }
Example #5
0
		public static void datafile (Page p)
		{
			string originalxml = @"<?xml version=""1.0"" encoding=""utf-8""?><bookstore xmlns:bk=""urn:samples""><book genre=""novel"" publicationdate=""1999"" bk:ISBN=""0192100262""><title>Pride and Prejudice</title><author><first-name>Jane</first-name><last-name>Austen</last-name></author><price>24.95</price>""
			</book><book genre=""novel"" publicationdate=""1985"" bk:ISBN=""0771008139""><title>The Handmaid's Tale</title><author><first-name>Margaret</first-name><last-name>Atwood</last-name></author><price>29.95</price></book></bookstore>";

			XmlDataSource ds = new XmlDataSource ();
			p.Form.Controls.Add (ds);
			ds.DataFile = "~/XMLDataSourceTest.xml";
			ds.DataBind ();
			string derivedxml = ((XmlDocument) ds.GetXmlDocument ()).InnerXml;
			HtmlDiff.AssertAreEqual (originalxml, derivedxml, "Loading xml");
		}
 private AdRec[] GetXmlDataSourceData(XmlDataSource xmlDataSource)
 {
     XmlDocument xmlDocument = xmlDataSource.GetXmlDocument();
     if (xmlDocument == null)
     {
         return null;
     }
     return this.LoadXmlDocument(xmlDocument);
 }
Example #7
0
        /// <summary>
        /// Returns captions or text for various languages.
        /// </summary>
        /// <param name="nodeName">Node name.</param>
        /// <param name="items">Items to add formatted to positions in string.</param>
        /// <returns>Text from XML file.</returns>
        public static string GetCaption(string nodeName, params string[] items)
        {
            string retval = "";
            XmlDataSource xmlnd = new XmlDataSource();
            xmlnd.ID = "LanguageFileXML";
            xmlnd.EnableCaching = true;
            xmlnd.CacheDuration = 900;
            xmlnd.CacheExpirationPolicy = System.Web.UI.DataSourceCacheExpiry.Sliding;
            xmlnd.DataFile = HttpContext.Current.Server.MapPath(Configuration.DefaultTextXML);

            try
            {
                retval = xmlnd.GetXmlDocument().ChildNodes.Item(1).SelectSingleNode(nodeName).InnerText;
            }
            catch (Exception exc)
            {
                throw new Exception("Node " + nodeName + " not found in " + Configuration.DefaultTextXML + ".", exc);
            }
            finally
            {
                xmlnd = null;
            }

            if (items != null)
            {
                retval = string.Format(retval, items);
            }

            return retval;
        }
Example #8
0
        private AdRec [] GetXmlDataSourceData(XmlDataSource xmlDataSource) {
            Debug.Assert(xmlDataSource != null);

            XmlDocument doc = xmlDataSource.GetXmlDocument();
            if (doc == null) {
                return null;
            }
            return LoadXmlDocument(doc);
        }