Exemple #1
0
 private static XPathNodeIterator getMediaDo(int MediaId, bool Deep)
 {
     Media m = new Media(MediaId);
     if (m.nodeObjectType == Media._objectType)
     {
         XmlDocument mXml = new XmlDocument();
         mXml.LoadXml(m.ToXml(mXml, Deep).OuterXml);
         XPathNavigator xp = mXml.CreateNavigator();
         string xpath = UmbracoSettings.UseLegacyXmlSchema ? "/node" : String.Format("/{0}", Casing.SafeAliasWithForcingCheck(m.ContentType.Alias));
         return xp.Select(xpath);
     }
     return null;
 }
Exemple #2
0
 private static XPathNodeIterator GetMediaDo(int mediaId, bool deep)
 {
     var m = new Media(mediaId);
     if (m.nodeObjectType == Media._objectType)
     {
         var mXml = new XmlDocument();
         var xml = m.ToXml(mXml, deep);
         //This will be null if the media isn't public (meaning it is in the trash)
         if (xml == null) return null;
         //TODO: This is an aweful way of loading in XML - it is very slow.
         mXml.LoadXml(xml.OuterXml);
         var xp = mXml.CreateNavigator();
         var xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "/node" : String.Format("/{0}", Casing.SafeAliasWithForcingCheck(m.ContentType.Alias));
         return xp.Select(xpath);
     }
     return null;
 }
        private XmlNode GetMediaXmlNode(string nodeId)
        {
            int id;
            if (int.TryParse(nodeId, out id))
            {
                var media = new Media(id);
                if (media != null)
                {
                    return media.ToXml(new XmlDocument(), false);
                }
            }

            return null;
        }