This document is archived and information here might be outdated.  Recommended version.


IXmlPropertySet2.DeletePropertyByNameAndAttribute Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IX > IXmlPropertySet2 Interface > IXmlPropertySet2.DeletePropertyByNameAndAttribute Method
ArcGIS Developer Help

IXmlPropertySet2.DeletePropertyByNameAndAttribute Method

Deletes the specified elements which have the specified attribute value.

[Visual Basic .NET]
Public Sub DeletePropertyByNameAndAttribute ( _
    ByVal Name As String, _
    ByVal Attribute As String, _
    ByVal Value As String, _
    ByVal deleteParent As Boolean _
)
[C#]
public void DeletePropertyByNameAndAttribute (
    string Name,
    string Attribute,
    string Value,
    bool deleteParent
);
[C++]
HRESULT DeletePropertyByNameAndAttribute(
  BSTR Name,
  BSTR Attribute,
  BSTR Value,
  VARIANT_BOOL deleteParent
);
[C++]
Parameters
Name [in]

Name is a parameter of type BSTR Attribute [in]
Attribute is a parameter of type BSTR Value [in]
Value is a parameter of type BSTR deleteParent [in]
deleteParent is a parameter of type bool

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

The DeletePropertyByNameAndAttribute method provides additional parameters to delete XML elements and their corresponding values from metadata documents. Similar actions can be accomplished through other methods (DeleteProperty, DeletePropertyByAttribute) and XPath strings. For instance the following lines of pseudocode accomplish the same action;

xmlPropertySet.DeletePropertyByNameAndAttribute("idinfo/keywords/theme/themekey", "new", "yes", False)
xmlPropertySet.DeleteProperty("idinfo/keywords/theme/themekey[@new='yes']")

The Name parameter uses XPath to describe the location and condition of XML nodes in metadata. More information on XPath can be found at the IXmlPropertySet documentation.

If children elements of the specified Name parameter exist, the DeletePropertyByNameAndAttribute method will also remove them from the XML Document.

The Attribute parameter must contain a valid string character. Otherwise the DeleteProperty method should be used for deleting elements without having to specify attributes. 

By setting the attribute Value parameter to "", all elements that match the Name and Attribute parameter will be deleted. The DeletePropertyByAttribute method should be used to delete elements without specifying attribute values.  

The deleteParent parameter is a Boolean expression that indicates if the parent element of the Name parameter should be deleted. Special attention should be made to this parameter when deleting a Thumbnail or Binary Enclosure.  The parent of the Thumbnail element is the Enclosure element, which also happens to be a parent element of the Data element that holds the Binary information. If deleteParent is set to true when specifying the Data or Thumbnail tag, all Enclosures information will be removed. 

See Also

IXmlPropertySet2 Interface