// converts the source value into the xpath value
        // uses the converter else returns the source value as a string
        // if successful, returns either a string or an XPathNavigator
        // source: the property source value
        // preview: whether we are previewing or not
        public object ConvertSourceToXPath(object source, bool preview)
        {
            // use the converter if any
            if (_converter != null)
            {
                return(_converter.ConvertSourceToXPath(this, source, preview));
            }

            // else just return the source value as a string or an XPathNavigator
            if (source == null)
            {
                return(null);
            }
            var xElement = source as XElement;

            if (xElement != null)
            {
                return(xElement.CreateNavigator());
            }
            return(source.ToString().Trim());
        }
Exemplo n.º 2
0
 public override object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview)
 {
     return(_baseValueConverter.ConvertSourceToXPath(propertyType, source, preview));
 }