2012-12-03 26 views
0

我有一個存儲照片的小工具。使用pl/sql腳本,我將圖像元數據提取到exifmetadata xmltype列。 我想選擇一個一個的元素,但我總是得到空回來,我不知道什麼是我的xpath表達式的問題。來自XMLTYPE列的Oracle JPG元數據xpath

<exifMetadata xmlns="http://xmlns.oracle.com/ord/meta/exif" xsi:schemaLocation="http://xmlns.oracle.com/ord/meta/exif http://xmlns.oracle.com/ord/meta/exif" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <TiffIfd> 
     <Make tag="271">Apple</Make> 
     <Model tag="272">iPhone 4S</Model> 
     <Orientation tag="274">top left</Orientation> 
     <XResolution tag="282">72.0</XResolution> 
     <YResolution tag="283">72.0</YResolution> 
     <ResolutionUnit tag="296">inches</ResolutionUnit> 
     <Software tag="305">6.0.1</Software> 
     <DateTime tag="306">2012-11-16T13:31:15</DateTime> 
     <YCbCrPositioning tag="531">centered</YCbCrPositioning> 
    </TiffIfd> 
    <ExifIfd tag="34665"> 
     <ExposureTime tag="33434">0.004405286</ExposureTime> 
     <FNumber tag="33437">2.4</FNumber> 
     <ExposureProgram tag="34850">Normal program</ExposureProgram> 
     <ExifVersion tag="36864">0221</ExifVersion> 
     <DateTimeOriginal tag="36867">2012-11-16T12:49:58</DateTimeOriginal> 
     <DateTimeDigitized tag="36868">2012-11-16T12:49:58</DateTimeDigitized> 
     <ComponentsConfiguration tag="37121">Y</ComponentsConfiguration> 
     <ShutterSpeedValue tag="37377">7.82697</ShutterSpeedValue> 
     <ApertureValue tag="37378">2.5260692</ApertureValue> 
     <BrightnessValue tag="37379">6.641153</BrightnessValue> 
     <MeteringMode tag="37383">Pattern</MeteringMode> 
     <Flash tag="37385"> 
     <Fired>No</Fired> 
     </Flash> 
     <FocalLength tag="37386">4.28</FocalLength> 
     <FlashpixVersion tag="40960">0100</FlashpixVersion> 
     <ColorSpace tag="40961">sRGB</ColorSpace> 
     <PixelXDimension tag="40962">2902</PixelXDimension> 
     <PixelYDimension tag="40963">1938</PixelYDimension> 
     <SensingMethod tag="41495">One-chip color area</SensingMethod> 
     <ExposureMode tag="41986">Auto exposure</ExposureMode> 
     <WhiteBalance tag="41987">Auto</WhiteBalance> 
     <FocalLengthIn35mmFilm tag="41989">35</FocalLengthIn35mmFilm> 
     <SceneCaptureType tag="41990">Standard</SceneCaptureType> 
    </ExifIfd> 
</exifMetadata> 

和SQL:

SELECT 
    p.metaexif.extract('//exifMetadata/TiffIfd/Make/text()').getStringVal() "Model" 
    FROM scott.photos p 
    WHERE id=22 
    ; 

的ID記錄22存在是肯定的。

回答

1

你有一個默認的命名空間設置,所以你必須應對這一點。

如用這個:

select extractvalue(p.metaexif,'/exifMetadata/TiffIfd/Make', 
     'xmlns="http://xmlns.oracle.com/ord/meta/exif"') 
+0

03,我忘了完全以,謝謝大家了!當然現在的作品像魅力:) – Greg