Beispiel #1
0
        // EMPTY
        /// <summary>
        /// Parses the input source into an XMP metadata object, including
        /// de-aliasing and normalisation.
        /// </summary>
        /// <param name="input">
        /// the input can be an <code>InputStream</code>, a <code>String</code> or
        /// a byte buffer containing the XMP packet.
        /// </param>
        /// <param name="options">the parse options</param>
        /// <returns>Returns the resulting XMP metadata object</returns>
        /// <exception cref="iText.Kernel.XMP.XMPException">Thrown if parsing or normalisation fails.
        ///     </exception>
        public static XMPMeta Parse(Object input, ParseOptions options)
        {
            ParameterAsserts.AssertNotNull(input);
            options = options ?? new ParseOptions();

            XmlDocument document = ParseXml(input, options);

            bool xmpmetaRequired = options.GetRequireXMPMeta();

            object[] result = new object[3];
            result = FindRootNode(document, xmpmetaRequired, result);

            if (result != null && result[1] == XMP_RDF)
            {
                XMPMetaImpl xmp = ParseRdf.Parse((XmlNode)result[0]);
                xmp.SetPacketHeader((string)result[2]);

                // Check if the XMP object shall be normalized
                if (!options.GetOmitNormalization())
                {
                    return(XMPNormalizer.Process(xmp, options));
                }
                return(xmp);
            }
            // no appropriate root node found, return empty metadata object
            return(new XMPMetaImpl());
        }
		public virtual void Normalize(ParseOptions options)
		{
			if (options == null)
			{
				options = new ParseOptions();
			}
			XMPNormalizer.Process(this, options);
		}