iTextSharp.xmp.XmpPathFactory.ComposeFieldSelector C# (CSharp) Метод

ComposeFieldSelector() публичный статический Метод

Compose the path expression to select an alternate item by a field's value. The path syntax allows two forms of "content addressing" that may be used to select an item in an array of alternatives. The form used in ComposeFieldSelector lets you select an item in an array of structs based on the value of one of the fields in the structs. The other form of content addressing is shown in ComposeLangSelector. For example, consider a simple struct that has two fields, the name of a city and the URI of an FTP site in that city. Use this to create an array of download alternatives. You can show the user a popup built from the values of the city fields. You can then get the corresponding URI as follows:

 String path = composeFieldSelector ( schemaNs, "Downloads", fieldNs,  "City", chosenCity );  XMPProperty prop = xmpObj.getStructField ( schemaNs, path, fieldNs, "URI" ); 
Thrown if the path to create is not valid.
public static ComposeFieldSelector ( string arrayName, string fieldNs, string fieldName, string fieldValue ) : string
arrayName string The name of the array. May be a general path expression, must not be /// null or the empty string.
fieldNs string The namespace URI for the field used as the selector. Must not be /// null or the empty string.
fieldName string The name of the field used as the selector. Must be a simple XML name, must /// not be null or the empty string. It must be the name of a field that is /// itself simple.
fieldValue string The desired value of the field.
Результат string
        public static string ComposeFieldSelector(string arrayName, string fieldNs, string fieldName, string fieldValue) {
            XmpPath fieldPath = XmpPathParser.ExpandXPath(fieldNs, fieldName);
            if (fieldPath.Size() != 2) {
                throw new XmpException("The fieldName name must be simple", XmpError.BADXPATH);
            }

            return arrayName + '[' + fieldPath.GetSegment((int) XmpPath.STEP_ROOT_PROP).Name + "=\"" + fieldValue +
                   "\"]";
        }