Class XmpTrailerPi

Class XmpTrailerPi

Namespace: Aspose.Imaging.Xmp
Assembly: Aspose.Imaging.dll (25.7.0)

Represents XMP trailer processing instruction.

public sealed class XmpTrailerPi
    : IXmlValue, IEquatable<XmpTrailerPi>
{
    private string _name;
    private XmpPacketWrapper _package;
    private string _value;
    public XmpTrailerPi(string name, XmpPacketWrapper package, string value)
    {
        this._name = name;
        this._package = package;
        this._value = value;
    }
    public string Name
    {
        get { return _name; }
    }
    public string Value
    {
        get { return _value; }
    }
    public XmpPacketWrapper Package
    {
        get { return _package; }
    }
    public bool Equals(XmpTrailerPi other)
    {
        if (ReferenceEquals(null, other)) return false;
        if (ReferenceEquals(this, other)) return true;
        return _name == other._name && _package.Equals(other._package) && string.Equals(_value, other._value);
    }
    public override bool Equals(object obj)
    {
        if (ReferenceEquals(null, obj)) return false;
        if (ReferenceEquals(this, obj)) return true;
        if (obj.GetType() != typeof(XmpTrailerPi)) return false;
        return Equals((XmpTrailerPi)obj);
    }
    public override int GetHashCode()
    {
        unchecked
        {
            var hashCode = (_name != null ? _name.GetHashCode() : 0);
            hashCode = (hashCode * 397) ^ (_package != null ? _package.GetHashCode() : 0);
            hashCode = (hashCode * 397) ^ (_value != null ? _value.GetHashCode() : 0);
            return hashCode;
        }
    }
    public override string ToString()
    {
        return $"{{{Name}={Value}}";
    }
}

Inheritance

object XmpTrailerPi

Implements

IXmlValue , IEquatable

Inherited Members

object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Allowed forms of the trailer PI:

xpacket end=“w”?xpacket end=“r”?

Remarks

The end=“w” or end=“r” portion shall be used by packet scanning processors to determine whether the XMPmay be modified in-place.

Constructors

XmpTrailerPi(bool)

Initializes a new instance of the Aspose.Imaging.Xmp.XmpTrailerPi class.

public XmpTrailerPi(bool isWritable)
   {
   }

Parameters

isWritable bool

Inditacates whether trailer is writable.

XmpTrailerPi()

Initializes a new instance of the Aspose.Imaging.Xmp.XmpTrailerPi class.

public XmpTrailerPi()
   {
   }

Properties

IsWritable

Gets or sets a value indicating whether this instance is writable.

public bool IsWritable
{
    get;
    set;
}

Property Value

bool

Methods

Equals(XmpTrailerPi)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(XmpTrailerPi other)
   {
   }

Parameters

other XmpTrailerPi

An object to compare with this object.

Returns

bool

true if the current object is equal to the other’ parameter; otherwise, false.

Equals(object)

Determines whether the specified System.Object, is equal to this instance.

public override bool Equals(object obj)
   {
   }

Parameters

obj object

The System.Object to compare with this instance.

Returns

bool

’true’ if the specified System.Object is equal to this instance; otherwise, ‘false’.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()
    {
    }

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

GetXmlValue()

Converts xmp value to the xml representation.

public string GetXmlValue()
{
}
In order to make this example more meaningful, I'll add some sample code inside the `GetXmlValue()` method:
public string GetXmlValue()
{
    var xmlDocument = new XmlDocument();
    xmlDocument.Load("myFile.xml");
    var node = xmlDocument.SelectSingleNode("//myNode");
    return node != null ? node.InnerText : String.Empty;
}

Returns

string

Returns XML representation of XMP.

 English