public virtual string PublishBinariesInRichTextField(string xhtml, BuildProperties buildProperties) { // rich text field is well-formed XML (XHTML), except that it does not always have a root element // to be sure it can be parsed, we will add a root and remove it afterwards TridionXml xml = new TridionXml(); xml.LoadXml("<tmproot>" + xhtml + "</tmproot>"); foreach (XmlElement xlinkElement in xml.SelectNodes("//*[@xlink:href[starts-with(string(.),'tcm:')]]", xml.NamespaceManager)) { log.Debug("Found XLink in Rich Text: " + xlinkElement.OuterXml); ProcessRichTextXlink(xlinkElement, buildProperties); } return(xml.DocumentElement.InnerXml); }
public virtual string PublishBinariesInRichTextField(string xhtml, BuildProperties buildProperties) { // rich text field is well-formed, except that it does not always have a root element // to be sure it can be parsed, we will add a root and remove it afterwards TridionXml xml = new TridionXml(); xml.LoadXml("<tmproot>" + xhtml + "</tmproot>"); foreach (XmlElement img in xml.SelectNodes("//xhtml:img[@xlink:href[starts-with(string(.),'tcm:')]]", xml.NamespaceManager)) { log.Debug("found img node " + img.OuterXml); XmlAttribute link = (XmlAttribute)img.SelectSingleNode("@xlink:href", xml.NamespaceManager); log.Debug("about to publish binary with uri " + link.Value); string path = PublishMultimediaComponent(link.Value, buildProperties); log.Debug("binary will be published to path " + path); img.SetAttribute("src", path); } return(xml.DocumentElement.InnerXml); }