Ejemplo n.º 1
0
        /**
         * Test doesPropertyExist, deleteProperty, and related methods.
         * @param meta a predefined <code>XmpMeta</code> object.
         */
        private static void CoverExistingProperties(IXmpMeta meta)
        {
            writeMajorLabel("Test doesPropertyExist, deleteProperty, and related methods");

            printXmpMeta(meta, "XMP object");

            log.WriteLine("doesPropertyExist ns1:Prop =    " + meta.DoesPropertyExist(TestData.NS1, "Prop"));
            log.WriteLine("doesPropertyExist ns1:Struct =    " + meta.DoesPropertyExist(TestData.NS1, "ns1:Struct"));
            log.WriteLine("doesArrayItemExist ns1:Bag[2] =    " + meta.DoesArrayItemExist(TestData.NS1, "Bag", 2));
            log.WriteLine("doesArrayItemExist ns1:Seq[last()] =    "
                          + meta.DoesArrayItemExist(TestData.NS1, "ns1:Seq", XmpConstants.ArrayLastItem));
            log.WriteLine("doesStructFieldExist ns1:Struct/ns2:Field1 =    "
                          + meta.DoesStructFieldExist(TestData.NS1, "Struct", TestData.NS2, "Field1"));
            log.WriteLine("doesQualifierExist ns1:QualProp1/?ns2:Qual1 =    "
                          + meta.DoesQualifierExist(TestData.NS1, "QualProp1", TestData.NS2, "Qual1"));
            log.WriteLine("doesQualifierExist ns1:QualProp2/?xml:lang =    "
                          + meta.DoesQualifierExist(TestData.NS1, "QualProp2", XmpConstants.NsXml, "lang"));
            log.WriteLine();
            log.WriteLine("doesPropertyExist (namespace is null) =    "
                          + meta.DoesPropertyExist(null, "ns1:Bag"));
            log.WriteLine("doesArrayItemExist (namespace is null) =    "
                          + meta.DoesArrayItemExist(null, "ns1:Bag", XmpConstants.ArrayLastItem));
            log.WriteLine("doesQualifierExist ns:Bogus (namespace not existing) =    "
                          + meta.DoesPropertyExist("ns:bogus/", "Bogus"));
            log.WriteLine("doesPropertyExist ns1:Bogus =    " + meta.DoesPropertyExist(TestData.NS1, "Bogus"));
            log.WriteLine("doesArrayItemExist ns1:Bag[99] =    " + meta.DoesArrayItemExist(TestData.NS1, "Bag", 99));
            log.WriteLine("doesStructFieldExist ns1:Struct/ns2:Bogus =    "
                          + meta.DoesStructFieldExist(TestData.NS1, "Struct", TestData.NS2, "Bogus"));
            log.WriteLine("doesQualifierExist ns1:Prop/?ns2:Bogus =    "
                          + meta.DoesQualifierExist(TestData.NS1, "Prop", TestData.NS2, "Bogus"));
        }
Ejemplo n.º 2
0
        /**
         * Test doesPropertyExist, deleteProperty, and related methods.
         * @param meta a predefined <code>XmpMeta</code> object.
         */
        private static void CoverExistingProperties(IXmpMeta meta)
        {
            writeMajorLabel ("Test doesPropertyExist, deleteProperty, and related methods");

            printXmpMeta (meta, "XMP object");

            log.WriteLine("doesPropertyExist ns1:Prop =    " + meta.DoesPropertyExist(TestData.NS1, "Prop"));
            log.WriteLine("doesPropertyExist ns1:Struct =    " + meta.DoesPropertyExist(TestData.NS1, "ns1:Struct"));
            log.WriteLine("doesArrayItemExist ns1:Bag[2] =    " + meta.DoesArrayItemExist(TestData.NS1, "Bag", 2));
            log.WriteLine("doesArrayItemExist ns1:Seq[last()] =    "
                    + meta.DoesArrayItemExist(TestData.NS1, "ns1:Seq", XmpConstants.ArrayLastItem));
            log.WriteLine("doesStructFieldExist ns1:Struct/ns2:Field1 =    "
                    + meta.DoesStructFieldExist(TestData.NS1, "Struct", TestData.NS2, "Field1"));
            log.WriteLine("doesQualifierExist ns1:QualProp1/?ns2:Qual1 =    "
                    + meta.DoesQualifierExist(TestData.NS1, "QualProp1", TestData.NS2, "Qual1"));
            log.WriteLine("doesQualifierExist ns1:QualProp2/?xml:lang =    "
                    + meta.DoesQualifierExist(TestData.NS1, "QualProp2", XmpConstants.NsXml, "lang"));
            log.WriteLine();
            log.WriteLine("doesPropertyExist (namespace is null) =    "
                    + meta.DoesPropertyExist(null, "ns1:Bag"));
            log.WriteLine("doesArrayItemExist (namespace is null) =    "
                    + meta.DoesArrayItemExist(null, "ns1:Bag", XmpConstants.ArrayLastItem));
            log.WriteLine("doesQualifierExist ns:Bogus (namespace not existing) =    "
                    + meta.DoesPropertyExist("ns:bogus/", "Bogus"));
            log.WriteLine("doesPropertyExist ns1:Bogus =    " + meta.DoesPropertyExist(TestData.NS1, "Bogus"));
            log.WriteLine("doesArrayItemExist ns1:Bag[99] =    " + meta.DoesArrayItemExist(TestData.NS1, "Bag", 99));
            log.WriteLine("doesStructFieldExist ns1:Struct/ns2:Bogus =    "
                    + meta.DoesStructFieldExist(TestData.NS1, "Struct", TestData.NS2, "Bogus"));
            log.WriteLine("doesQualifierExist ns1:Prop/?ns2:Bogus =    "
                    + meta.DoesQualifierExist(TestData.NS1, "Prop", TestData.NS2, "Bogus"));
        }