diff --git a/src/Umbraco.Core/XmlHelper.cs b/src/Umbraco.Core/XmlHelper.cs
index 66dcae7358..cc792c3f35 100644
--- a/src/Umbraco.Core/XmlHelper.cs
+++ b/src/Umbraco.Core/XmlHelper.cs
@@ -35,7 +35,7 @@ namespace Umbraco.Core
return;
}
if (n.Attributes[name] == null)
- {
+ {
var a = xml.CreateAttribute(name);
a.Value = value;
n.Attributes.Append(a);
@@ -155,7 +155,7 @@ namespace Umbraco.Core
elt = null;
return false;
}
-
+
///
/// Sorts the children of a parentNode.
///
@@ -163,7 +163,7 @@ namespace Umbraco.Core
/// An XPath expression to select children of to sort.
/// A function returning the value to order the nodes by.
internal static void SortNodes(
- XmlNode parentNode,
+ XmlNode parentNode,
string childNodesXPath,
Func orderBy)
{
@@ -227,7 +227,7 @@ namespace Umbraco.Core
/// The child node to sort.
/// A function returning the value to order the nodes by.
/// A value indicating whether sorting was needed.
- /// Assuming all nodes but are sorted, this will move the node to
+ /// Assuming all nodes but are sorted, this will move the node to
/// the right position without moving all the nodes (as SortNodes would do) - should improve perfs.
internal static bool SortNode(
XmlNode parentNode,
@@ -415,6 +415,25 @@ namespace Umbraco.Core
return AddTextNode(xd, name, value);
}
+ ///
+ /// Sets or creates an Xml node from its inner Xml.
+ ///
+ /// The xmldocument.
+ /// The node to set or create the child text node on
+ /// The node name.
+ /// The node inner Xml.
+ /// a XmlNode
+ public static XmlNode SetInnerXmlNode(XmlDocument xd, XmlNode parent, string name, string value)
+ {
+ if (xd == null) throw new ArgumentNullException("xd");
+ if (parent == null) throw new ArgumentNullException("parent");
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", "name");
+
+ var child = parent.SelectSingleNode(name) ?? xd.CreateNode(XmlNodeType.Element, name, "");
+ child.InnerXml = value;
+ return child;
+ }
+
///
/// Creates a cdata XmlNode with the specified name and value
///