本文整理汇总了C#中System.Xml.XmlElement.RemoveChild方法的典型用法代码示例。如果您正苦于以下问题:C# XmlElement.RemoveChild方法的具体用法?C# XmlElement.RemoveChild怎么用?C# XmlElement.RemoveChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlElement
的用法示例。
在下文中一共展示了XmlElement.RemoveChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XmlTabPage
/// <summary>
/// Initializes a new instance of the XmlTabPage class.
/// </summary>
/// <param name="definition">XML definition.</param>
internal XmlTabPage( XmlElement definition)
{
string name = definition.Attributes[ "name" ].Value;
string tooltip = definition.Attributes[ "tooltip" ].Value;
_tab = new TabPage();
_tab.Text = name;
_tab.ToolTipText = tooltip;
_tab.Tag = this;
_tab.DockPadding.All = Property.TabPadding;
XmlAttribute _modesAttr = null;
_invisibleElem = (XmlElement) definition.SelectSingleNode( "invisible", FormsNamespace.NamespaceManager );
if(_invisibleElem != null)
{
_modesAttr = _invisibleElem.Attributes[ "modes" ];
if(_modesAttr != null)
_invisibleModes = _modesAttr.Value.Split( ',' );
//Isto tem de estar aqui para não estourar mais à frente por "No registered property handler"
definition.RemoveChild(definition.SelectSingleNode( "invisible", FormsNamespace.NamespaceManager ));
}
_disabledElem = (XmlElement)definition.SelectSingleNode("disabled", FormsNamespace.NamespaceManager);
if (_disabledElem != null)
{
_modesAttr = _disabledElem.Attributes["modes"];
if (_modesAttr != null)
_disabledModes = _modesAttr.Value.Split(',');
//Isto tem de estar aqui para não estourar mais à frente por "No registered property handler"
definition.RemoveChild(definition.SelectSingleNode("disabled", FormsNamespace.NamespaceManager));
}
}
示例2: RemoveXmlDeclaration
private static void RemoveXmlDeclaration(XmlElement element)
{
XmlNode declaration = element.FirstChild;
while (declaration != null && declaration.NodeType != XmlNodeType.XmlDeclaration)
declaration = declaration.NextSibling;
if (declaration != null)
element.RemoveChild(declaration);
}
示例3: DeleteAlbumsWithPrice
private static void DeleteAlbumsWithPrice(XmlElement root, double price)
{
foreach (XmlNode album in root.SelectNodes("album"))
{
double albumPrice = double.Parse(album["price"].InnerText);
if (albumPrice > price)
{
root.RemoveChild(album);
}
}
}
示例4: ExpensiveMusicDeletor
private static void ExpensiveMusicDeletor(double TriggerPrice, XmlElement rootNode)
{
var albums = rootNode.SelectNodes("album");
foreach (XmlElement album in albums)
{
if (double.Parse(album["price"].InnerText) > TriggerPrice)
{
rootNode.RemoveChild(album);
}
}
}
示例5: DeleteAlbum
private static void DeleteAlbum(XmlElement element, double maxPrice)
{
foreach (XmlElement album in element.ChildNodes)
{
var xmlPrice = album["price"].InnerText;
var price = double.Parse(xmlPrice);
if (price > maxPrice)
{
element.RemoveChild(album);
}
}
}
示例6: DeleteAlbumsWithGivenPrice
private static void DeleteAlbumsWithGivenPrice(XmlElement root, double maxPrice)
{
foreach (XmlElement album in root.ChildNodes)
{
var xmlPrice = album["price"].InnerText;
var parsedXmlPrice = double.Parse(xmlPrice);
if (parsedXmlPrice > maxPrice)
{
root.RemoveChild(album);
}
}
}
示例7: DeliteAlbumByMaxPrice
private static void DeliteAlbumByMaxPrice(XmlElement root, double maxPrice)
{
foreach (XmlElement album in root.ChildNodes)
{
string xmlPrice = album["price"].InnerText;
double price = double.Parse(xmlPrice, CultureInfo.InvariantCulture);
if (price > maxPrice)
{
root.RemoveChild(album);
}
}
}
示例8: DeleteAlbumsWithPrice
private static void DeleteAlbumsWithPrice(XmlElement root)
{
foreach (XmlElement album in root.SelectNodes("album"))
{
string xmlPrice = album["price"].InnerText;
double price = double.Parse(xmlPrice);
if (price > 20)
{
root.RemoveChild(album);
}
}
}
示例9: SortAttributes
private void SortAttributes (XmlElement el)
{
SortAttributesAttributes (el);
ArrayList al = new ArrayList ();
foreach (XmlNode n in el.ChildNodes) {
if (n.NodeType == XmlNodeType.Element)
SortAttributes (n as XmlElement);
if (n.NodeType == XmlNodeType.Comment)
al.Add (n);
}
foreach (XmlNode n in al)
el.RemoveChild (n);
}
示例10: DeleteAlbumsWithBiggerPrice
private static void DeleteAlbumsWithBiggerPrice(XmlElement catalogue, decimal price)
{
var albums = catalogue.SelectNodes("album");
foreach (XmlElement album in albums)
{
var currentPriceAsString = album["price"].InnerText;
var currentPriceAsDecimal = decimal.Parse(currentPriceAsString);
if(currentPriceAsDecimal > price)
{
catalogue.RemoveChild(album);
}
}
}
示例11: DeleteElementAboveSpecificValue
private static void DeleteElementAboveSpecificValue(XmlElement root, double maxValue, string value)
{
var elements = root.SelectNodes("album");
foreach (XmlElement item in elements)
{
var itemValue = item[value].InnerText;
var parcedItemValue = double.Parse(itemValue);
if (parcedItemValue > maxValue)
{
root.RemoveChild(item);
}
}
}
示例12: RemoveExistingGeneratedItems
private void RemoveExistingGeneratedItems(XmlElement folderNode)
{
List<XmlElement> elemstoRemove = new List<XmlElement>();
foreach (XmlElement elm in folderNode.ChildNodes)
{
if (elm.Name == "Compile")
{
if (elm.Attributes["Include"].Value.StartsWith(GenerationContext.ProjectFolder))
elemstoRemove.Add(elm);
}
}
foreach (XmlElement elm in elemstoRemove)
{
folderNode.RemoveChild(elm);
}
}
示例13: DeleteAlbumsWithPriceBiggerThan
private static void DeleteAlbumsWithPriceBiggerThan(XmlElement root, double maxPrice)
{
XmlNodeList childNodes = root.ChildNodes;
for (int i = 0; i < childNodes.Count; i++)
{
XmlNode album = childNodes[i];
string xmlPrice = album["price"].InnerText;
double price = double.Parse(xmlPrice);
if (maxPrice < price)
{
root.RemoveChild(album);
}
}
}
示例14: DeleteAlbumsWithPrice
private static void DeleteAlbumsWithPrice(XmlElement root, double maxPrice)
{
var childNodes = root.ChildNodes;
for (int a = childNodes.Count - 1; a >= 0; a--)
{
var album = childNodes[a];
var xmlPrice = album["price"].InnerText;
var price = double.Parse(xmlPrice);
if (price > maxPrice)
{
root.RemoveChild(album);
}
}
}
示例15: DeleteAlbumsWithPriceGreaterThan
private static void DeleteAlbumsWithPriceGreaterThan(XmlElement catalogue, int price)
{
var albums = catalogue.ChildNodes;
var albumsToRemove = new List<XmlNode>();
foreach (XmlNode album in albums)
{
var currenAlbumPrice = double.Parse(album.SelectSingleNode("price").InnerText);
if (currenAlbumPrice > price)
{
albumsToRemove.Add(album);
//catalogue.RemoveChild(album);
}
}
foreach (XmlNode album in albumsToRemove)
{
catalogue.RemoveChild(album);
}
}