--- E:\src\extern\nant\src\NAnt.Core\Tasks\a\XmlPeekTask.cs	Fri Dec 26 15:21:14 2003
+++ E:\src\extern\nant\src\NAnt.Core\Tasks\XmlPeekTask.cs	Tue Jan 06 15:03:30 2004
@@ -69,7 +69,8 @@
     public class XmlPeekTask : Task  {
         #region Private Instance Fields
 
-        private FileInfo _xmlFile;
+        private FileInfo _xmlFile = null;
+        private string _xmlRef = "";
         private int _nodeIndex = 0;
         private string _property;
         private string _xPath;
@@ -82,12 +83,18 @@
         /// The name of the file that contains the XML document
         /// that is going to be peeked at.
         /// </summary>
-        [TaskAttribute("file", Required=true)]
+        [TaskAttribute("file", Required=false)]
         public FileInfo XmlFile {
             get { return _xmlFile; }
             set { _xmlFile = value; }
         }
 
+        [TaskAttribute("refid", Required=false)]
+        public string XmlRef {
+            get { return _xmlRef; }
+            set { _xmlRef = value; }
+        }
+		
         /// <summary>
         /// The index of the node that gets its text returned when the query 
         /// returns multiple nodes.
@@ -128,17 +135,29 @@
         /// Executes the XML peek task.
         /// </summary>
         protected override void ExecuteTask() {
-            Log(Level.Info, LogPrefix + "Peeking at '{0}' with XPath expression '{1}'.", 
-                XmlFile.FullName,  XPath);
-
-            // ensure the specified xml file exists
-            if (!XmlFile.Exists) {
-                throw new BuildException(string.Format(CultureInfo.InvariantCulture, 
-                    "XML file '{0}' does not exist.", XmlFile.FullName), Location);
-            }
-
+			if(_xmlFile!=null)
+			{
+	            Log(Level.Info, LogPrefix + "Peeking at '{0}' with XPath expression '{1}'.", 
+    	            XmlFile.FullName,  XPath);
+
+        	    // ensure the specified xml file exists
+            	if (!XmlFile.Exists) {
+	                throw new BuildException(string.Format(CultureInfo.InvariantCulture, 
+    	                "XML file '{0}' does not exist.", XmlFile.FullName), Location);
+        	    }
+			}
+			
             try {
-                XmlDocument document = LoadDocument(XmlFile.FullName);
+				XmlDocument document;
+                if(_xmlFile!=null)
+					document = LoadDocument(XmlFile.FullName);
+				else
+				{
+					DataTypeBase dataType = Project.DataTypeReferences[_xmlRef];
+					NAnt.Core.Types.Xml xmldoc= (NAnt.Core.Types.Xml)dataType;
+					document =  xmldoc.XmlDocument;
+				}
+					
                 Properties[Property] = GetNodeContents(XPath, document, NodeIndex);
             } catch (BuildException ex) {
                 throw ex; // Just re-throw the build exceptions.
@@ -217,4 +236,4 @@
 
         #endregion private Instance Methods
     }
-}
\ No newline at end of file
+}
