Sample code for 30+ languages & platforms
SQL Server

Extract XMP MetaData as XML

See more XMP Examples

Demonstrates how to open a JPG or TIF image file and extract the XMP metadata as XML.

Chilkat SQL Server Downloads

SQL Server
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @success int
    SELECT @success = 0

    -- This requires the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @xmp int
    EXEC @hr = sp_OACreate 'Chilkat.Xmp', @xmp OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    -- Load a JPG or TIF image file.
    -- Sample JPG's with XMP metadata may be found at:
    -- https://www.chilkatsoft.com/testData/xmp/sample1.jpg
    -- https://www.chilkatsoft.com/testData/xmp/sample2.jpg
    -- https://www.chilkatsoft.com/testData/xmp/sample3.jpg
    EXEC sp_OAMethod @xmp, 'LoadAppFile', @success OUT, 'qa_data/xmp/sample1.jpg'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @xmp
        RETURN
      END


    EXEC sp_OAGetProperty @xmp, 'NumEmbedded', @iTmp0 OUT
    PRINT 'Num embedded XMP docs: ' + @iTmp0

    -- Assuming there is at least one, get the 1st.
    -- (There is typically never more than one, but theoretically it's possible.)
    DECLARE @xml int
    EXEC sp_OAMethod @xmp, 'GetEmbedded', @xml OUT, 0
    EXEC sp_OAGetProperty @xmp, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 = 0
      BEGIN

        PRINT 'No XMP metadata found.'
        EXEC @hr = sp_OADestroy @xmp
        RETURN
      END

    EXEC sp_OAMethod @xml, 'GetXml', @sTmp0 OUT
    PRINT @sTmp0

    -- Sample output:

    -- <?xml version="1.0" encoding="utf-8"?>
    -- <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP toolkit 3.0-28, framework 1.6">
    --     <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:iX="http://ns.adobe.com/iX/1.0/">
    --         <rdf:Description rdf:about="uuid:0f410648-9396-11d9-bb8e-a67e6693b6e9" xmlns:xmpPLUS="XMP Photographic Licensing Universal System (xmpPLUS, http://ns.adobe.com/xap/1.0/PLUS/)">
    --             <xmpPLUS:CreditLineReq>False</xmpPLUS:CreditLineReq>
    --             <xmpPLUS:ReuseAllowed>False</xmpPLUS:ReuseAllowed>
    --         </rdf:Description>
    --         <rdf:Description rdf:about="uuid:0f410648-9396-11d9-bb8e-a67e6693b6e9" xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/">
    --             <Iptc4xmpCore:IntellectualGenre>Profile</Iptc4xmpCore:IntellectualGenre>
    --             <Iptc4xmpCore:Location>Lake Superior</Iptc4xmpCore:Location>
    --             <Iptc4xmpCore:CountryCode>US</Iptc4xmpCore:CountryCode>
    --             <Iptc4xmpCore:CreatorContactInfo rdf:parseType="Resource">
    --                 <Iptc4xmpCore:CiAdrExtadr>John Doe Photography, 123 Maple Lane</Iptc4xmpCore:CiAdrExtadr>
    --                 <Iptc4xmpCore:CiAdrCity>Champaign</Iptc4xmpCore:CiAdrCity>
    --                 <Iptc4xmpCore:CiAdrRegion>Illinois</Iptc4xmpCore:CiAdrRegion>
    --                 <Iptc4xmpCore:CiAdrPcode>61820</Iptc4xmpCore:CiAdrPcode>
    --                 <Iptc4xmpCore:CiAdrCtry>USA</Iptc4xmpCore:CiAdrCtry>
    --                 <Iptc4xmpCore:CiTelWork>+1 (217) 1234567</Iptc4xmpCore:CiTelWork>
    --                 <Iptc4xmpCore:CiEmailWork>john@doe.com</Iptc4xmpCore:CiEmailWork>
    --                 <Iptc4xmpCore:CiUrlWork>www.doe.com</Iptc4xmpCore:CiUrlWork>
    --             </Iptc4xmpCore:CreatorContactInfo>
    --             <Iptc4xmpCore:SubjectCode>
    --                 <rdf:Bag>
    --                     <rdf:li>14024001</rdf:li>
    --                 </rdf:Bag>
    --             </Iptc4xmpCore:SubjectCode>
    --             <Iptc4xmpCore:Scene>
    --                 <rdf:Bag>
    --                     <rdf:li>012300</rdf:li>
    --                 </rdf:Bag>
    --             </Iptc4xmpCore:Scene>
    --         </rdf:Description>
    --         <rdf:Description rdf:about="uuid:0f410648-9396-11d9-bb8e-a67e6693b6e9" xmlns:exif="http://ns.adobe.com/exif/1.0/">
    --             <exif:ColorSpace>1</exif:ColorSpace>
    --             <exif:PixelXDimension>288</exif:PixelXDimension>
    --             <exif:PixelYDimension>432</exif:PixelYDimension>
    --         </rdf:Description>
    --         <rdf:Description rdf:about="uuid:0f410648-9396-11d9-bb8e-a67e6693b6e9" xmlns:pdf="http://ns.adobe.com/pdf/1.3/"/>
    --         <rdf:Description rdf:about="uuid:0f410648-9396-11d9-bb8e-a67e6693b6e9" xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
    --             <photoshop:AuthorsPosition>Photographer</photoshop:AuthorsPosition>
    --             <photoshop:Headline>Young boy yelling</photoshop:Headline>
    --             <photoshop:CaptionWriter>John Doe</photoshop:CaptionWriter>
    --             <photoshop:DateCreated>2004-08-19</photoshop:DateCreated>
    --             <photoshop:City>Marquette</photoshop:City>
    --             <photoshop:State>Michigan</photoshop:State>
    --             <photoshop:Country>United States</photoshop:Country>
    --             <photoshop:TransmissionReference>PO 34567</photoshop:TransmissionReference>
    --             <photoshop:Instructions>Original RAW capture Nikon D2X, Adobe RGB 1998.</photoshop:Instructions>
    --             <photoshop:Credit>John Doe Photography</photoshop:Credit>
    --             <photoshop:Source>John Doe Photography</photoshop:Source>
    --             <photoshop:History/>
    --         </rdf:Description>
    --         <rdf:Description rdf:about="uuid:0f410648-9396-11d9-bb8e-a67e6693b6e9" xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
    --             <tiff:XResolution>72/1</tiff:XResolution>
    --             <tiff:YResolution>72/1</tiff:YResolution>
    --             <tiff:ResolutionUnit>2</tiff:ResolutionUnit>
    --             <tiff:Orientation>1</tiff:Orientation>
    --         </rdf:Description>
    --         <rdf:Description rdf:about="uuid:0f410648-9396-11d9-bb8e-a67e6693b6e9" xmlns:xap="http://ns.adobe.com/xap/1.0/">
    --             <xap:CreateDate>2005-03-13T02:02:29-06:00</xap:CreateDate>
    --             <xap:ModifyDate>2005-03-13T02:02:29-06:00</xap:ModifyDate>
    --             <xap:MetadataDate>2005-03-13T02:02:29-06:00</xap:MetadataDate>
    --             <xap:CreatorTool>Adobe Photoshop CS Windows</xap:CreatorTool>
    --         </rdf:Description>
    --         <rdf:Description rdf:about="uuid:0f410648-9396-11d9-bb8e-a67e6693b6e9" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/">
    --             <xapMM:DerivedFrom rdf:parseType="Resource">
    --                 <stRef:instanceID>uuid:f5b64171-9394-11d9-bb8e-a67e6693b6e9</stRef:instanceID>
    --                 <stRef:documentID>adobe:docid:photoshop:e4d002a4-9392-11d9-bb8e-a67e6693b6e9</stRef:documentID>
    --             </xapMM:DerivedFrom>
    --             <xapMM:DocumentID>adobe:docid:photoshop:0f410647-9396-11d9-bb8e-a67e6693b6e9</xapMM:DocumentID>
    --         </rdf:Description>
    --         <rdf:Description rdf:about="uuid:0f410648-9396-11d9-bb8e-a67e6693b6e9" xmlns:xapRights="http://ns.adobe.com/xap/1.0/rights/">
    --             <xapRights:Marked>True</xapRights:Marked>
    --             <xapRights:WebStatement>http://www.doe.com</xapRights:WebStatement>
    --             <xapRights:RightsUsageTerms>
    --                 <rdf:Alt>
    --                     <rdf:li xml:lang="x-default">For consideration only, no reproduction without prior permission</rdf:li>
    --                 </rdf:Alt>
    --             </xapRights:RightsUsageTerms>
    --             <xapRights:UsageTerms>
    --                 <rdf:Alt>
    --                     <rdf:li xml:lang="x-default">For consideration only, no reproduction without prior permission</rdf:li>
    --                 </rdf:Alt>
    --             </xapRights:UsageTerms>
    --         </rdf:Description>
    --         <rdf:Description rdf:about="uuid:0f410648-9396-11d9-bb8e-a67e6693b6e9" xmlns:dc="http://purl.org/dc/elements/1.1/">
    --             <dc:format>image/jpeg</dc:format>
    --             <dc:description>
    --                 <rdf:Alt>
    --                     <rdf:li xml:lang="x-default">Three year old African American boy yells with joy on beach during vacation.</rdf:li>
    --                 </rdf:Alt>
    --             </dc:description>
    --             <dc:title>
    --                 <rdf:Alt>
    --                     <rdf:li xml:lang="x-default">20040819_pe_014578d.nef</rdf:li>
    --                 </rdf:Alt>
    --             </dc:title>
    --             <dc:rights>
    --                 <rdf:Alt>
    --                     <rdf:li xml:lang="x-default">�2004 John Doe, all rights reserved</rdf:li>
    --                 </rdf:Alt>
    --             </dc:rights>
    --             <dc:creator>
    --                 <rdf:Seq>
    --                     <rdf:li>John Doe</rdf:li>
    --                 </rdf:Seq>
    --             </dc:creator>
    --             <dc:subject>
    --                 <rdf:Bag>
    --                     <rdf:li>boy</rdf:li>
    --                     <rdf:li>gender</rdf:li>
    --                     <rdf:li>human beings</rdf:li>
    --                     <rdf:li>humans</rdf:li>
    --                     <rdf:li>lad</rdf:li>
    --                     <rdf:li>male</rdf:li>
    --                     <rdf:li>people</rdf:li>
    --                     <rdf:li>3-12 years old</rdf:li>
    --                     <rdf:li>age</rdf:li>
    --                     <rdf:li>child</rdf:li>
    --                     <rdf:li>youth</rdf:li>
    --                     <rdf:li>african american</rdf:li>
    --                     <rdf:li>african-american</rdf:li>
    --                     <rdf:li>black</rdf:li>
    --                     <rdf:li>ethnic</rdf:li>
    --                     <rdf:li>ethnicity</rdf:li>
    --                     <rdf:li>people of color</rdf:li>
    --                     <rdf:li>race</rdf:li>
    --                     <rdf:li>beach</rdf:li>
    --                     <rdf:li>nature</rdf:li>
    --                     <rdf:li>scenery</rdf:li>
    --                     <rdf:li>emotion</rdf:li>
    --                     <rdf:li>emotional</rdf:li>
    --                     <rdf:li>emotions</rdf:li>
    --                     <rdf:li>happiness</rdf:li>
    --                     <rdf:li>happy</rdf:li>
    --                     <rdf:li>joy</rdf:li>
    --                     <rdf:li>joyful</rdf:li>
    --                     <rdf:li>joyous</rdf:li>
    --                 </rdf:Bag>
    --             </dc:subject>
    --         </rdf:Description>
    --     </rdf:RDF>
    -- </x:xmpmeta>

    -- You can generate parsing code using Chilkat's online tool : 
    -- Generate Parsing Code from XML

    DECLARE @rdf_Description_rdf_about nvarchar(4000)

    DECLARE @rdf_Description_xmlns_xmpPLUS nvarchar(4000)

    DECLARE @rdf_Description_xmlns_Iptc4xmpCore nvarchar(4000)

    DECLARE @rdf_Description_xmlns_exif nvarchar(4000)

    DECLARE @rdf_Description_xmlns_pdf nvarchar(4000)

    DECLARE @rdf_Description_xmlns_photoshop nvarchar(4000)

    DECLARE @rdf_Description_xmlns_tiff nvarchar(4000)

    DECLARE @rdf_Description_xmlns_xap nvarchar(4000)

    DECLARE @rdf_Description_xmlns_stRef nvarchar(4000)

    DECLARE @rdf_Description_xmlns_xapMM nvarchar(4000)

    DECLARE @rdf_Description_xmlns_xapRights nvarchar(4000)

    DECLARE @rdf_Description_xmlns_dc nvarchar(4000)

    DECLARE @xmpPLUS_CreditLineReq nvarchar(4000)

    DECLARE @xmpPLUS_ReuseAllowed nvarchar(4000)

    DECLARE @Iptc4xmpCore_IntellectualGenre nvarchar(4000)

    DECLARE @Iptc4xmpCore_Location nvarchar(4000)

    DECLARE @Iptc4xmpCore_CountryCode nvarchar(4000)

    DECLARE @Iptc4xmpCore_CreatorContactInfo_rdf_parseType nvarchar(4000)

    DECLARE @Iptc4xmpCore_CiAdrExtadr nvarchar(4000)

    DECLARE @Iptc4xmpCore_CiAdrCity nvarchar(4000)

    DECLARE @Iptc4xmpCore_CiAdrRegion nvarchar(4000)

    DECLARE @Iptc4xmpCore_CiAdrPcode int

    DECLARE @Iptc4xmpCore_CiAdrCtry nvarchar(4000)

    DECLARE @Iptc4xmpCore_CiTelWork nvarchar(4000)

    DECLARE @Iptc4xmpCore_CiEmailWork nvarchar(4000)

    DECLARE @Iptc4xmpCore_CiUrlWork nvarchar(4000)

    DECLARE @rdf_li int

    DECLARE @exif_ColorSpace int

    DECLARE @exif_PixelXDimension int

    DECLARE @exif_PixelYDimension int

    DECLARE @photoshop_AuthorsPosition nvarchar(4000)

    DECLARE @photoshop_Headline nvarchar(4000)

    DECLARE @photoshop_CaptionWriter nvarchar(4000)

    DECLARE @photoshop_DateCreated nvarchar(4000)

    DECLARE @photoshop_City nvarchar(4000)

    DECLARE @photoshop_State nvarchar(4000)

    DECLARE @photoshop_Country nvarchar(4000)

    DECLARE @photoshop_TransmissionReference nvarchar(4000)

    DECLARE @photoshop_Instructions nvarchar(4000)

    DECLARE @photoshop_Credit nvarchar(4000)

    DECLARE @photoshop_Source nvarchar(4000)

    DECLARE @tiff_XResolution nvarchar(4000)

    DECLARE @tiff_YResolution nvarchar(4000)

    DECLARE @tiff_ResolutionUnit int

    DECLARE @tiff_Orientation int

    DECLARE @xap_CreateDate nvarchar(4000)

    DECLARE @xap_ModifyDate nvarchar(4000)

    DECLARE @xap_MetadataDate nvarchar(4000)

    DECLARE @xap_CreatorTool nvarchar(4000)

    DECLARE @xapMM_DerivedFrom_rdf_parseType nvarchar(4000)

    DECLARE @stRef_instanceID nvarchar(4000)

    DECLARE @stRef_documentID nvarchar(4000)

    DECLARE @xapMM_DocumentID nvarchar(4000)

    DECLARE @xapRights_Marked nvarchar(4000)

    DECLARE @xapRights_WebStatement nvarchar(4000)

    DECLARE @rdf_li_xml_lang nvarchar(4000)

    DECLARE @strRdf_li nvarchar(4000)

    DECLARE @dc_format nvarchar(4000)

    DECLARE @j int

    DECLARE @count_j int

    DECLARE @x_xmpmeta_xmlns_x nvarchar(4000)
    EXEC sp_OAMethod @xml, 'GetAttrValue', @x_xmpmeta_xmlns_x OUT, 'xmlns:x'
    DECLARE @x_xmpmeta_x_xmptk nvarchar(4000)
    EXEC sp_OAMethod @xml, 'GetAttrValue', @x_xmpmeta_x_xmptk OUT, 'x:xmptk'
    DECLARE @rdf_RDF_xmlns_rdf nvarchar(4000)
    EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_RDF_xmlns_rdf OUT, 'rdf:RDF|(xmlns:rdf)'
    DECLARE @rdf_RDF_xmlns_iX nvarchar(4000)
    EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_RDF_xmlns_iX OUT, 'rdf:RDF|(xmlns:iX)'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @xml, 'NumChildrenHavingTag', @count_i OUT, 'rdf:RDF|rdf:Description'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @xml, 'I', @i
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_rdf_about OUT, 'rdf:RDF|rdf:Description[i]|(rdf:about)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_xmpPLUS OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:xmpPLUS)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_Iptc4xmpCore OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:Iptc4xmpCore)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_exif OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:exif)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_pdf OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:pdf)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_photoshop OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:photoshop)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_tiff OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:tiff)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_xap OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:xap)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_stRef OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:stRef)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_xapMM OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:xapMM)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_xapRights OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:xapRights)'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_Description_xmlns_dc OUT, 'rdf:RDF|rdf:Description[i]|(xmlns:dc)'
        EXEC sp_OAMethod @xml, 'GetChildContent', @xmpPLUS_CreditLineReq OUT, 'rdf:RDF|rdf:Description[i]|xmpPLUS:CreditLineReq'
        EXEC sp_OAMethod @xml, 'GetChildContent', @xmpPLUS_ReuseAllowed OUT, 'rdf:RDF|rdf:Description[i]|xmpPLUS:ReuseAllowed'
        EXEC sp_OAMethod @xml, 'GetChildContent', @Iptc4xmpCore_IntellectualGenre OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:IntellectualGenre'
        EXEC sp_OAMethod @xml, 'GetChildContent', @Iptc4xmpCore_Location OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:Location'
        EXEC sp_OAMethod @xml, 'GetChildContent', @Iptc4xmpCore_CountryCode OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:CountryCode'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @Iptc4xmpCore_CreatorContactInfo_rdf_parseType OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:CreatorContactInfo|(rdf:parseType)'
        EXEC sp_OAMethod @xml, 'GetChildContent', @Iptc4xmpCore_CiAdrExtadr OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:CreatorContactInfo|Iptc4xmpCore:CiAdrExtadr'
        EXEC sp_OAMethod @xml, 'GetChildContent', @Iptc4xmpCore_CiAdrCity OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:CreatorContactInfo|Iptc4xmpCore:CiAdrCity'
        EXEC sp_OAMethod @xml, 'GetChildContent', @Iptc4xmpCore_CiAdrRegion OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:CreatorContactInfo|Iptc4xmpCore:CiAdrRegion'
        EXEC sp_OAMethod @xml, 'GetChildIntValue', @Iptc4xmpCore_CiAdrPcode OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:CreatorContactInfo|Iptc4xmpCore:CiAdrPcode'
        EXEC sp_OAMethod @xml, 'GetChildContent', @Iptc4xmpCore_CiAdrCtry OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:CreatorContactInfo|Iptc4xmpCore:CiAdrCtry'
        EXEC sp_OAMethod @xml, 'GetChildContent', @Iptc4xmpCore_CiTelWork OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:CreatorContactInfo|Iptc4xmpCore:CiTelWork'
        EXEC sp_OAMethod @xml, 'GetChildContent', @Iptc4xmpCore_CiEmailWork OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:CreatorContactInfo|Iptc4xmpCore:CiEmailWork'
        EXEC sp_OAMethod @xml, 'GetChildContent', @Iptc4xmpCore_CiUrlWork OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:CreatorContactInfo|Iptc4xmpCore:CiUrlWork'
        EXEC sp_OAMethod @xml, 'GetChildIntValue', @rdf_li OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:SubjectCode|rdf:Bag|rdf:li'
        EXEC sp_OAMethod @xml, 'GetChildIntValue', @rdf_li OUT, 'rdf:RDF|rdf:Description[i]|Iptc4xmpCore:Scene|rdf:Bag|rdf:li'
        EXEC sp_OAMethod @xml, 'GetChildIntValue', @exif_ColorSpace OUT, 'rdf:RDF|rdf:Description[i]|exif:ColorSpace'
        EXEC sp_OAMethod @xml, 'GetChildIntValue', @exif_PixelXDimension OUT, 'rdf:RDF|rdf:Description[i]|exif:PixelXDimension'
        EXEC sp_OAMethod @xml, 'GetChildIntValue', @exif_PixelYDimension OUT, 'rdf:RDF|rdf:Description[i]|exif:PixelYDimension'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_AuthorsPosition OUT, 'rdf:RDF|rdf:Description[i]|photoshop:AuthorsPosition'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_Headline OUT, 'rdf:RDF|rdf:Description[i]|photoshop:Headline'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_CaptionWriter OUT, 'rdf:RDF|rdf:Description[i]|photoshop:CaptionWriter'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_DateCreated OUT, 'rdf:RDF|rdf:Description[i]|photoshop:DateCreated'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_City OUT, 'rdf:RDF|rdf:Description[i]|photoshop:City'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_State OUT, 'rdf:RDF|rdf:Description[i]|photoshop:State'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_Country OUT, 'rdf:RDF|rdf:Description[i]|photoshop:Country'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_TransmissionReference OUT, 'rdf:RDF|rdf:Description[i]|photoshop:TransmissionReference'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_Instructions OUT, 'rdf:RDF|rdf:Description[i]|photoshop:Instructions'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_Credit OUT, 'rdf:RDF|rdf:Description[i]|photoshop:Credit'
        EXEC sp_OAMethod @xml, 'GetChildContent', @photoshop_Source OUT, 'rdf:RDF|rdf:Description[i]|photoshop:Source'
        EXEC sp_OAMethod @xml, 'GetChildContent', @tiff_XResolution OUT, 'rdf:RDF|rdf:Description[i]|tiff:XResolution'
        EXEC sp_OAMethod @xml, 'GetChildContent', @tiff_YResolution OUT, 'rdf:RDF|rdf:Description[i]|tiff:YResolution'
        EXEC sp_OAMethod @xml, 'GetChildIntValue', @tiff_ResolutionUnit OUT, 'rdf:RDF|rdf:Description[i]|tiff:ResolutionUnit'
        EXEC sp_OAMethod @xml, 'GetChildIntValue', @tiff_Orientation OUT, 'rdf:RDF|rdf:Description[i]|tiff:Orientation'
        EXEC sp_OAMethod @xml, 'GetChildContent', @xap_CreateDate OUT, 'rdf:RDF|rdf:Description[i]|xap:CreateDate'
        EXEC sp_OAMethod @xml, 'GetChildContent', @xap_ModifyDate OUT, 'rdf:RDF|rdf:Description[i]|xap:ModifyDate'
        EXEC sp_OAMethod @xml, 'GetChildContent', @xap_MetadataDate OUT, 'rdf:RDF|rdf:Description[i]|xap:MetadataDate'
        EXEC sp_OAMethod @xml, 'GetChildContent', @xap_CreatorTool OUT, 'rdf:RDF|rdf:Description[i]|xap:CreatorTool'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @xapMM_DerivedFrom_rdf_parseType OUT, 'rdf:RDF|rdf:Description[i]|xapMM:DerivedFrom|(rdf:parseType)'
        EXEC sp_OAMethod @xml, 'GetChildContent', @stRef_instanceID OUT, 'rdf:RDF|rdf:Description[i]|xapMM:DerivedFrom|stRef:instanceID'
        EXEC sp_OAMethod @xml, 'GetChildContent', @stRef_documentID OUT, 'rdf:RDF|rdf:Description[i]|xapMM:DerivedFrom|stRef:documentID'
        EXEC sp_OAMethod @xml, 'GetChildContent', @xapMM_DocumentID OUT, 'rdf:RDF|rdf:Description[i]|xapMM:DocumentID'
        EXEC sp_OAMethod @xml, 'GetChildContent', @xapRights_Marked OUT, 'rdf:RDF|rdf:Description[i]|xapRights:Marked'
        EXEC sp_OAMethod @xml, 'GetChildContent', @xapRights_WebStatement OUT, 'rdf:RDF|rdf:Description[i]|xapRights:WebStatement'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_li_xml_lang OUT, 'rdf:RDF|rdf:Description[i]|xapRights:RightsUsageTerms|rdf:Alt|rdf:li|(xml:lang)'
        EXEC sp_OAMethod @xml, 'GetChildContent', @strRdf_li OUT, 'rdf:RDF|rdf:Description[i]|xapRights:RightsUsageTerms|rdf:Alt|rdf:li'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_li_xml_lang OUT, 'rdf:RDF|rdf:Description[i]|xapRights:UsageTerms|rdf:Alt|rdf:li|(xml:lang)'
        EXEC sp_OAMethod @xml, 'GetChildContent', @strRdf_li OUT, 'rdf:RDF|rdf:Description[i]|xapRights:UsageTerms|rdf:Alt|rdf:li'
        EXEC sp_OAMethod @xml, 'GetChildContent', @dc_format OUT, 'rdf:RDF|rdf:Description[i]|dc:format'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_li_xml_lang OUT, 'rdf:RDF|rdf:Description[i]|dc:description|rdf:Alt|rdf:li|(xml:lang)'
        EXEC sp_OAMethod @xml, 'GetChildContent', @strRdf_li OUT, 'rdf:RDF|rdf:Description[i]|dc:description|rdf:Alt|rdf:li'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_li_xml_lang OUT, 'rdf:RDF|rdf:Description[i]|dc:title|rdf:Alt|rdf:li|(xml:lang)'
        EXEC sp_OAMethod @xml, 'GetChildContent', @strRdf_li OUT, 'rdf:RDF|rdf:Description[i]|dc:title|rdf:Alt|rdf:li'
        EXEC sp_OAMethod @xml, 'ChilkatPath', @rdf_li_xml_lang OUT, 'rdf:RDF|rdf:Description[i]|dc:rights|rdf:Alt|rdf:li|(xml:lang)'
        EXEC sp_OAMethod @xml, 'GetChildContent', @strRdf_li OUT, 'rdf:RDF|rdf:Description[i]|dc:rights|rdf:Alt|rdf:li'
        EXEC sp_OAMethod @xml, 'GetChildContent', @strRdf_li OUT, 'rdf:RDF|rdf:Description[i]|dc:creator|rdf:Seq|rdf:li'
        SELECT @j = 0
        EXEC sp_OAMethod @xml, 'NumChildrenHavingTag', @count_j OUT, 'rdf:RDF|rdf:Description[i]|dc:subject|rdf:Bag|rdf:li'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @xml, 'J', @j
            EXEC sp_OAMethod @xml, 'GetChildContent', @strRdf_li OUT, 'rdf:RDF|rdf:Description[i]|dc:subject|rdf:Bag|rdf:li[j]'
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @xml


    EXEC @hr = sp_OADestroy @xmp


END
GO