1. 程式人生 > >資料庫中儲存xml

資料庫中儲存xml

<select id="getDeviceConfigInfo" parameterClass="device" 
    	resultClass="java.util.HashMap">
    	SELECT EXTRACTVALUE(odp.profile,'profile/general/timeZone') timeZone,
    	EXTRACTVALUE(odp.profile,'profile/general/status') deviceStatus,
    	EXTRACTVALUE(odp.profile,'profile/general/HDVideo') HDVideo,
    	EXTRACTVALUE(odp.profile,'profile/general/videoQuality') videoQuality
    	FROM o_device_profile odp where deviceid=#deviceid# and uid=#uid#
    </select>

mybatis寫的,資料庫中可以儲存xml,並且可以對xml內容進行操作。

<?xml version="1.0" encoding="UTF-8"?>
<profile>
	<general>
		<title>111</title>
		<description/>
		<status>On</status>
		<scheduleTurnOff>
			<status>On</status>
			<schedules>
			</schedules>
		</scheduleTurnOff>
		<scheduleNotUpload>
			<status>On</status>
			<schedules>
			</schedules>
		</scheduleNotUpload>
		<DVRPlan>2-Week trial</DVRPlan>
		<motionDetection>On</motionDetection>
		<motionSensitivity>50</motionSensitivity>
		<soundDetection>Off</soundDetection>
		<soundSensitivity support="1">90</soundSensitivity>
		<recordTo>Cloud</recordTo>
		<infraredLight>Auto</infraredLight>
		<volumeMute>On</volumeMute>
		<cameraSound>On</cameraSound>
		<antiFlicker>60</antiFlicker>
		<cameraImageRotate>0</cameraImageRotate>
		<faceSensitivity>1</faceSensitivity>
		<notificationInterval>0</notificationInterval>
		<cloudRecord>On</cloudRecord>
		<scheduleCloudRecord>
			<status>On</status>
			<schedules>
			</schedules>
		</scheduleCloudRecord>
		<faceDetection>Off</faceDetection>
		<videoQuality>high</videoQuality>
		<motionRegions>
		<motionRegion>
			<id>0</id>
			<left>0</left>
			<top>0</top>
			<right>0</right>
			<bottom>0</bottom>
			<sensitivity>0</sensitivity>
			<enable>false</enable>
		</motionRegion>
		</motionRegions>
		<scheduleInfraredLight>
			<status>On</status>
			<schedules>
			</schedules>
		</scheduleInfraredLight>
		<nightVision>Auto</nightVision>
		<scheduleNightVision>
			<status>On</status>
			<schedules>
			</schedules>
		</scheduleNightVision>
		<statusLight>On</statusLight>
		<HDVideo>On</HDVideo>
		<backgroundAudioStreaming>Off</backgroundAudioStreaming>
		<zoomScale>0</zoomScale>
		<timeZone>Asia/Shanghai</timeZone>
		<wifiNetWork/>
		<deviceId/>
		<macAddress/>
		<deviceType/>
		<scheduleMute>
			<status>Off</status>
			<schedules>
			</schedules>
		</scheduleMute>
	</general>
	<alerts>
		<sendAlerts>On</sendAlerts>
		<sendMotionAlerts>On</sendMotionAlerts>
		<sendSoundAlerts>Off</sendSoundAlerts>
		<sendOfflineAlerts>On</sendOfflineAlerts>
		<scheduleNotSendAlerts>
			<status>On</status>
			<schedules>
 			</schedules>
		</scheduleNotSendAlerts>
	</alerts>
</profile>