コード例 #1
0
        /**
         * XPath composition utilities using the <code>XmpPathFactory</code>.
         * @throws XmpException Forwards exceptions
         */
        private static void CoverPathCreation()
        {
            writeMajorLabel("XPath composition utilities");

            var meta = XmpMetaFactory.Create();

            meta.AppendArrayItem(TestData.NS1, "ArrayProp", new PropertyOptions {
                IsArray = true
            }, "Item 1", null);

            string path = XmpPathFactory.ComposeArrayItemPath("ArrayProp", 2);

            log.WriteLine("composeArrayItemPath ArrayProp[2] =   " + path);
            meta.SetProperty(TestData.NS1, path, "new ns1:ArrayProp[2] value");

            path  = "StructProperty";
            path += XmpPathFactory.ComposeStructFieldPath(TestData.NS2, "Field3");
            log.WriteLine("composeStructFieldPath StructProperty/ns2:Field3 =   " + path);
            meta.SetProperty(TestData.NS1, path, "new ns1:StructProp/ns2:Field3 value");

            path  = "QualProp";
            path += XmpPathFactory.ComposeQualifierPath(TestData.NS2, "Qual");
            log.WriteLine("composeStructFieldPath QualProp/?ns2:Qual =   " + path);
            meta.SetProperty(TestData.NS1, path, "new ns1:QualProp/?ns2:Qual value");

            meta.SetLocalizedText(TestData.NS1, "AltTextProp", null, "en-US", "initival value");
            path  = "AltTextProp";
            path += XmpPathFactory.ComposeQualifierPath(XmpConstants.NsXml, "lang");
            log.WriteLine("composeQualifierPath ns1:AltTextProp/?xml:lang =   " + path);
            meta.SetProperty(TestData.NS1, path, "new ns1:AltTextProp/?xml:lang value");

            printXmpMeta(meta, "Modified simple RDF");
        }
コード例 #2
0
ファイル: XmpMeta.cs プロジェクト: wwwlicious/xmp-core-dotnet
        /// <exception cref="XmpException"/>
        public IXmpProperty GetArrayItem(string schemaNs, string arrayName, int itemIndex)
        {
            ParameterAsserts.AssertSchemaNs(schemaNs);
            ParameterAsserts.AssertArrayName(arrayName);
            var itemPath = XmpPathFactory.ComposeArrayItemPath(arrayName, itemIndex);

            return(GetProperty(schemaNs, itemPath));
        }
コード例 #3
0
ファイル: XmpMetaImpl.cs プロジェクト: w16014936/itextsharp
        /// <seealso cref= XMPMeta#doesArrayItemExist(String, String, int) </seealso>
        public virtual bool DoesArrayItemExist(string schemaNs, string arrayName, int itemIndex)
        {
            try {
                ParameterAsserts.AssertSchemaNs(schemaNs);
                ParameterAsserts.AssertArrayName(arrayName);

                string path = XmpPathFactory.ComposeArrayItemPath(arrayName, itemIndex);
                return(DoesPropertyExist(schemaNs, path));
            }
            catch (XmpException) {
                return(false);
            }
        }
コード例 #4
0
ファイル: XmpMetaImpl.cs プロジェクト: w16014936/itextsharp
        /// <seealso cref= XMPMeta#deleteArrayItem(String, String, int) </seealso>
        public virtual void DeleteArrayItem(string schemaNs, string arrayName, int itemIndex)
        {
            try {
                ParameterAsserts.AssertSchemaNs(schemaNs);
                ParameterAsserts.AssertArrayName(arrayName);

                string itemPath = XmpPathFactory.ComposeArrayItemPath(arrayName, itemIndex);
                DeleteProperty(schemaNs, itemPath);
            }
            catch (XmpException) {
                // EMPTY, exceptions are ignored within delete
            }
        }
コード例 #5
0
ファイル: XmpMeta.cs プロジェクト: wwwlicious/xmp-core-dotnet
 public void DeleteArrayItem(string schemaNs, string arrayName, int itemIndex)
 {
     try
     {
         ParameterAsserts.AssertSchemaNs(schemaNs);
         ParameterAsserts.AssertArrayName(arrayName);
         var itemPath = XmpPathFactory.ComposeArrayItemPath(arrayName, itemIndex);
         DeleteProperty(schemaNs, itemPath);
     }
     catch (XmpException)
     {
     }
 }