예제 #1
0
        /// <summary>
        /// Parses an XMP metadata object from a stream, including de-aliasing and normalisation.
        /// </summary>
        /// <exception cref="XmpException">Thrown if parsing or normalisation fails.</exception>
        public static IXmpMeta Parse(ByteBuffer byteBuffer, ParseOptions options = null)
        {
            ParameterAsserts.AssertNotNull(byteBuffer);
            options = options ?? new ParseOptions();
            var doc = ParseXmlFromByteBuffer(byteBuffer.GetByteStream(), options);

            return(ParseXmlDoc(doc, options));
        }
예제 #2
0
        /// <summary>
        /// Parses an XMP metadata object from a stream, including de-aliasing and normalisation.
        /// </summary>
        /// <exception cref="XmpException">Thrown if parsing or normalisation fails.</exception>
        public static IXmpMeta Parse(byte[] bytes, ParseOptions options = null)
        {
            ParameterAsserts.AssertNotNull(bytes);
            options = options ?? new ParseOptions();
            var doc = ParseXmlFromByteBuffer(new MemoryStream(bytes), options);

            return(ParseXmlDoc(doc, options));
        }
예제 #3
0
        /// <summary>
        /// Parses an XMP metadata object from a stream, including de-aliasing and normalisation.
        /// </summary>
        /// <exception cref="XmpException">Thrown if parsing or normalisation fails.</exception>
        public static IXmpMeta Parse(Stream stream, ParseOptions options = null)
        {
            ParameterAsserts.AssertNotNull(stream);
            options = options ?? new ParseOptions();
            var doc = ParseXmlFromInputStream(stream, options);

            return(ParseXmlDoc(doc, options));
        }
예제 #4
0
        /// <summary>
        /// Parses an XMP metadata object from a stream, including de-aliasing and normalisation.
        /// </summary>
        /// <exception cref="XmpException">Thrown if parsing or normalisation fails.</exception>
        public static IXmpMeta Parse(string xmlStr, ParseOptions options = null)
        {
            ParameterAsserts.AssertNotNull(xmlStr);
            options = options ?? new ParseOptions();
            var doc = ParseXmlString(xmlStr, options);

            return(ParseXmlDoc(doc, options));
        }
예제 #5
0
 /// <summary>
 /// Parses an XMP metadata object from a XDocument, including de-aliasing and normalisation.
 /// </summary>
 /// <exception cref="XmpException">Thrown if parsing or normalisation fails.</exception>
 public static IXmpMeta Parse(XDocument doc, ParseOptions options = null)
 {
     ParameterAsserts.AssertNotNull(doc);
     options = options ?? new ParseOptions();
     return(ParseXmlDoc(doc, options));
 }
예제 #6
0
 /// <summary>
 /// Parses XML from a byte buffer,
 /// fixing the encoding (Latin-1 to UTF-8) and illegal control character optionally.
 /// </summary>
 /// <param name="bytes">a byte buffer containing the XMP packet</param>
 /// <param name="options">the parsing options</param>
 /// <returns>Returns an XML DOM-Document.</returns>
 /// <exception cref="XmpException">Thrown when the parsing fails.</exception>
 public static XDocument Extract(byte[] bytes, ParseOptions options = null)
 {
     ParameterAsserts.AssertNotNull(bytes);
     options = options ?? new ParseOptions();
     return(ParseXmlFromByteBuffer(new MemoryStream(bytes), options));
 }