未验证 提交 f7735141 编写于 作者: O openharmony_ci 提交者: Gitee

!1444 API文档自动化测试修改

Merge pull request !1444 from zengyawen/master
...@@ -7,11 +7,6 @@ import audio from '@ohos.multimedia.audio'; ...@@ -7,11 +7,6 @@ import audio from '@ohos.multimedia.audio';
``` ```
## 权限
## getAudioManager ## getAudioManager
getAudioManager(): AudioManager getAudioManager(): AudioManager
...@@ -115,6 +110,7 @@ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback&l ...@@ -115,6 +110,7 @@ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback&l
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10, (err)=>{ audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10, (err)=>{
if (err) { if (err) {
console.error('Failed to set the volume. ${err.message}'); console.error('Failed to set the volume. ${err.message}');
...@@ -146,6 +142,7 @@ setVolume(volumeType: AudioVolumeType, volume: number): Promise<void> ...@@ -146,6 +142,7 @@ setVolume(volumeType: AudioVolumeType, volume: number): Promise<void>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10).then(()=> audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10).then(()=>
console.log('Promise returned to indicate a successful volume setting.'); console.log('Promise returned to indicate a successful volume setting.');
) )
...@@ -167,6 +164,7 @@ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): v ...@@ -167,6 +164,7 @@ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): v
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the volume. ${err.message}'); console.error('Failed to obtain the volume. ${err.message}');
...@@ -197,6 +195,7 @@ getVolume(volumeType: AudioVolumeType): Promise<number> ...@@ -197,6 +195,7 @@ getVolume(volumeType: AudioVolumeType): Promise<number>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) => audioManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) =>
console.log('Promise returned to indicate that the volume is obtained.' + value); console.log('Promise returned to indicate that the volume is obtained.' + value);
) )
...@@ -218,6 +217,7 @@ getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>) ...@@ -218,6 +217,7 @@ getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>)
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getMinVolume(audio.AudioVolumeType.MEDIA, (err, value) => { audioManager.getMinVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the minimum volume. ${err.message}'); console.error('Failed to obtain the minimum volume. ${err.message}');
...@@ -248,6 +248,7 @@ getMinVolume(volumeType: AudioVolumeType): Promise<number> ...@@ -248,6 +248,7 @@ getMinVolume(volumeType: AudioVolumeType): Promise<number>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((value) => audioManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((value) =>
console.log('Promised returned to indicate that the minimum volume is obtained.' + value); console.log('Promised returned to indicate that the minimum volume is obtained.' + value);
) )
...@@ -269,6 +270,7 @@ getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>) ...@@ -269,6 +270,7 @@ getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>)
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA, (err, value) => { audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the maximum volume. ${err.message}'); console.error('Failed to obtain the maximum volume. ${err.message}');
...@@ -299,6 +301,7 @@ getMaxVolume(volumeType: AudioVolumeType): Promise<number> ...@@ -299,6 +301,7 @@ getMaxVolume(volumeType: AudioVolumeType): Promise<number>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data)=> audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data)=>
console.log('Promised returned to indicate that the maximum volume is obtained.'); console.log('Promised returned to indicate that the maximum volume is obtained.');
) )
...@@ -321,6 +324,7 @@ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void ...@@ -321,6 +324,7 @@ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.mute(audio.AudioVolumeType.MEDIA, true, (err) => { audioManager.mute(audio.AudioVolumeType.MEDIA, true, (err) => {
if (err) { if (err) {
console.error('Failed to mute the stream. ${err.message}'); console.error('Failed to mute the stream. ${err.message}');
...@@ -353,6 +357,7 @@ mute(volumeType: AudioVolumeType, mute: boolean): Promise<void> ...@@ -353,6 +357,7 @@ mute(volumeType: AudioVolumeType, mute: boolean): Promise<void>
``` ```
var audioManager = audio.getAudioManager();
audioManager.mute(audio.AudioVolumeType.MEDIA, true).then(() => audioManager.mute(audio.AudioVolumeType.MEDIA, true).then(() =>
console.log('Promise returned to indicate that the stream is muted.'); console.log('Promise returned to indicate that the stream is muted.');
) )
...@@ -375,6 +380,7 @@ isMute(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): voi ...@@ -375,6 +380,7 @@ isMute(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): voi
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, value) => { audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the mute status. ${err.message}'); console.error('Failed to obtain the mute status. ${err.message}');
...@@ -406,6 +412,7 @@ isMute(volumeType: AudioVolumeType): Promise<boolean> ...@@ -406,6 +412,7 @@ isMute(volumeType: AudioVolumeType): Promise<boolean>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.isMute(audio.AudioVolumeType.MEDIA).then((value) => audioManager.isMute(audio.AudioVolumeType.MEDIA).then((value) =>
console.log('Promise returned to indicate that the mute status of the stream is obtained.' + value); console.log('Promise returned to indicate that the mute status of the stream is obtained.' + value);
) )
...@@ -427,6 +434,7 @@ isActive(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): v ...@@ -427,6 +434,7 @@ isActive(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): v
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.isActive(audio.AudioVolumeType.MEDIA, (err, value) => { audioManager.isActive(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the active status of the stream. ${err.message}'); console.error('Failed to obtain the active status of the stream. ${err.message}');
...@@ -457,6 +465,7 @@ isActive(volumeType: AudioVolumeType): Promise<boolean> ...@@ -457,6 +465,7 @@ isActive(volumeType: AudioVolumeType): Promise<boolean>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.isActive(audio.AudioVolumeType.MEDIA).then((value) => audioManager.isActive(audio.AudioVolumeType.MEDIA).then((value) =>
console.log('Promise returned to indicate that the active status of the stream is obtained.' + value); console.log('Promise returned to indicate that the active status of the stream is obtained.' + value);
) )
...@@ -478,6 +487,7 @@ setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void ...@@ -478,6 +487,7 @@ setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL, (err) => { audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL, (err) => {
if (err) { if (err) {
console.error('Failed to set the ringer mode.​ ${err.message}'); console.error('Failed to set the ringer mode.​ ${err.message}');
...@@ -508,6 +518,7 @@ setRingerMode(mode: AudioRingMode): Promise<void> ...@@ -508,6 +518,7 @@ setRingerMode(mode: AudioRingMode): Promise<void>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL).then(() => audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL).then(() =>
console.log('Promise returned to indicate a successful setting of the ringer mode.'); console.log('Promise returned to indicate a successful setting of the ringer mode.');
) )
...@@ -529,6 +540,7 @@ getRingerMode(callback: AsyncCallback<AudioRingMode>): void ...@@ -529,6 +540,7 @@ getRingerMode(callback: AsyncCallback<AudioRingMode>): void
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getRingerMode((err, value) => { audioManager.getRingerMode((err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the ringer mode.​ ${err.message}'); console.error('Failed to obtain the ringer mode.​ ${err.message}');
...@@ -554,6 +566,7 @@ getRingerMode(): Promise<AudioRingMode> ...@@ -554,6 +566,7 @@ getRingerMode(): Promise<AudioRingMode>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getRingerMode().then((value) => audioManager.getRingerMode().then((value) =>
console.log('Promise returned to indicate that the ringer mode is obtained.' + value); console.log('Promise returned to indicate that the ringer mode is obtained.' + value);
) )
...@@ -576,6 +589,7 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback<void&gt ...@@ -576,6 +589,7 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback<void&gt
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.setAudioParameter('PBits per sample', '8 bit', (err) => { audioManager.setAudioParameter('PBits per sample', '8 bit', (err) => {
if (err) { if (err) {
console.error('Failed to set the audio parameter. ${err.message}'); console.error('Failed to set the audio parameter. ${err.message}');
...@@ -607,6 +621,7 @@ setAudioParameter(key: string, value: string): Promise<void> ...@@ -607,6 +621,7 @@ setAudioParameter(key: string, value: string): Promise<void>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.setAudioParameter('PBits per sample', '8 bit').then(() => audioManager.setAudioParameter('PBits per sample', '8 bit').then(() =>
console.log('Promise returned to indicate a successful setting of the audio parameter.'); console.log('Promise returned to indicate a successful setting of the audio parameter.');
) )
...@@ -628,6 +643,7 @@ getAudioParameter(key: string, callback: AsyncCallback<string>): void ...@@ -628,6 +643,7 @@ getAudioParameter(key: string, callback: AsyncCallback<string>): void
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getAudioParameter('PBits per sample', (err, value) => { audioManager.getAudioParameter('PBits per sample', (err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the value of the audio parameter. ${err.message}'); console.error('Failed to obtain the value of the audio parameter. ${err.message}');
...@@ -658,6 +674,7 @@ getAudioParameter(key: string): Promise<string> ...@@ -658,6 +674,7 @@ getAudioParameter(key: string): Promise<string>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getAudioParameter('PBits per sample').then((value) => audioManager.getAudioParameter('PBits per sample').then((value) =>
console.log('Promise returned to indicate that the value of the audio parameter is obtained.' + value); console.log('Promise returned to indicate that the value of the audio parameter is obtained.' + value);
) )
...@@ -678,6 +695,7 @@ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescrip ...@@ -678,6 +695,7 @@ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescrip
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value)=>{ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value)=>{
if (err) { if (err) {
console.error('Failed to obtain the device list. ${err.message}'); console.error('Failed to obtain the device list. ${err.message}');
...@@ -708,6 +726,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value)=>{ ...@@ -708,6 +726,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value)=>{
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=> audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=>
console.log('Promise returned to indicate that the device list is obtained.'); console.log('Promise returned to indicate that the device list is obtained.');
) )
...@@ -730,6 +749,7 @@ setDeviceActive(deviceType: DeviceType, active: boolean, callback: AsyncCallback ...@@ -730,6 +749,7 @@ setDeviceActive(deviceType: DeviceType, active: boolean, callback: AsyncCallback
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> {
if (err) { if (err) {
console.error('Failed to set the active status of the device. ${err.message}'); console.error('Failed to set the active status of the device. ${err.message}');
...@@ -762,6 +782,7 @@ setDeviceActive(deviceType: DeviceType, active: boolean): Promise<void> ...@@ -762,6 +782,7 @@ setDeviceActive(deviceType: DeviceType, active: boolean): Promise<void>
``` ```
var audioManager = audio.getAudioManager();
audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=> audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=>
console.log('Promise returned to indicate that the device is set to the active status.'); console.log('Promise returned to indicate that the device is set to the active status.');
) )
...@@ -783,6 +804,7 @@ isDeviceActive(deviceType: DeviceType, callback: AsyncCallback<boolean>): ...@@ -783,6 +804,7 @@ isDeviceActive(deviceType: DeviceType, callback: AsyncCallback<boolean>):
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the active status of the device. ${err.message}'); console.error('Failed to obtain the active status of the device. ${err.message}');
...@@ -814,6 +836,7 @@ isDeviceActive(deviceType: DeviceType): Promise<boolean> ...@@ -814,6 +836,7 @@ isDeviceActive(deviceType: DeviceType): Promise<boolean>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.isDeviceActive(audio.DeviceType.SPEAKER).then((value) => audioManager.isDeviceActive(audio.DeviceType.SPEAKER).then((value) =>
console.log('Promise returned to indicate that the active status of the device is obtained.' + value); console.log('Promise returned to indicate that the active status of the device is obtained.' + value);
) )
...@@ -835,6 +858,7 @@ setMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void ...@@ -835,6 +858,7 @@ setMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.setMicrophoneMute(true, (err) => { audioManager.setMicrophoneMute(true, (err) => {
if (err) { if (err) {
console.error('Failed to mute the microphone. ${err.message}'); console.error('Failed to mute the microphone. ${err.message}');
...@@ -865,6 +889,7 @@ setMicrophoneMute(mute: boolean): Promise<void> ...@@ -865,6 +889,7 @@ setMicrophoneMute(mute: boolean): Promise<void>
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.setMicrophoneMute(true).then(() => audioManager.setMicrophoneMute(true).then(() =>
console.log('Promise returned to indicate that the microphone is muted.'); console.log('Promise returned to indicate that the microphone is muted.');
) )
...@@ -885,6 +910,7 @@ isMicrophoneMute(callback: AsyncCallback<boolean>): void ...@@ -885,6 +910,7 @@ isMicrophoneMute(callback: AsyncCallback<boolean>): void
**示例:** **示例:**
``` ```
var audioManager = audio.getAudioManager();
audioManager.isMicrophoneMute((err, value) => { audioManager.isMicrophoneMute((err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the mute status of the microphone. ${err.message}'); console.error('Failed to obtain the mute status of the microphone. ${err.message}');
...@@ -910,6 +936,7 @@ isMicrophoneMute(): Promise<boolean> ...@@ -910,6 +936,7 @@ isMicrophoneMute(): Promise<boolean>
``` ```
var audioManager = audio.getAudioManager();
audioManager.isMicrophoneMute().then((value) => audioManager.isMicrophoneMute().then((value) =>
console.log('Promise returned to indicate that the mute status of the microphone is obtained.', + value); console.log('Promise returned to indicate that the mute status of the microphone is obtained.', + value);
) )
......
...@@ -7,14 +7,9 @@ ...@@ -7,14 +7,9 @@
## 导入模块 ## 导入模块
``` ```
import convertxml from '@ohos.convertxml' import convertxml from '@ohos.convertxml';
``` ```
## 权限
## ConvertXML ## ConvertXML
...@@ -48,7 +43,7 @@ convert(xml: string, options?: ConvertOptions) : Object ...@@ -48,7 +43,7 @@ convert(xml: string, options?: ConvertOptions) : Object
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv= new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = conv.convert(xml, {trim: false, ignoreDeclaration: false}); var result1 = conv.convert(xml, {trim: false, ignoreDeclaration: false});
console.log(result1) console.log(result1)
``` ```
...@@ -63,7 +58,7 @@ convert(xml: string, options?: ConvertOptions) : Object ...@@ -63,7 +58,7 @@ convert(xml: string, options?: ConvertOptions) : Object
| ignoreInstruction | boolean | 否 | 是否忽略xml的写入处理指令,默认false。 | | ignoreInstruction | boolean | 否 | 是否忽略xml的写入处理指令,默认false。 |
| ignoreAttributes | boolean | 否 | 是否跨多行打印属性并缩进属性,默认false。 | | ignoreAttributes | boolean | 否 | 是否跨多行打印属性并缩进属性,默认false。 |
| ignoreComment | boolean | 否 | 是否忽略元素的注释信息,默认false。 | | ignoreComment | boolean | 否 | 是否忽略元素的注释信息,默认false。 |
| ignoreCdata | boolean | 否 | 是否忽略元素的CData信息,默认false。 | | ignoreCDATA | boolean | 否 | 是否忽略元素的CDATA信息,默认false。 |
| ignoreDoctype | boolean | 否 | 是否忽略元素的Doctype信息,默认false。 | | ignoreDoctype | boolean | 否 | 是否忽略元素的Doctype信息,默认false。 |
| ignoreText | boolean | 否 | 是否忽略元素的文本信息,默认false。 | | ignoreText | boolean | 否 | 是否忽略元素的文本信息,默认false。 |
| declarationKey | string | 否 | 用于输出对象中declaration的属性键的名称,默认_declaration。 | | declarationKey | string | 否 | 用于输出对象中declaration的属性键的名称,默认_declaration。 |
......
...@@ -575,6 +575,7 @@ prepare(config: AudioRecorderConfig): void ...@@ -575,6 +575,7 @@ prepare(config: AudioRecorderConfig): void
**示例:** **示例:**
``` ```
var audiorecorder = media.createAudioRecorder();
let audioRecorderConfig = { let audioRecorderConfig = {
audioEncoder : AAC_LC , audioEncoder : AAC_LC ,
audioEncodeBitRate : 22050, audioEncodeBitRate : 22050,
...@@ -596,6 +597,7 @@ start(): void ...@@ -596,6 +597,7 @@ start(): void
**示例:** **示例:**
``` ```
var audiorecorder = media.createAudioRecorder();
audiorecorder.start(); audiorecorder.start();
``` ```
...@@ -608,6 +610,7 @@ stop(): void ...@@ -608,6 +610,7 @@ stop(): void
**示例:** **示例:**
``` ```
var audiorecorder = media.createAudioRecorder();
audiorecorder.stop(); audiorecorder.stop();
``` ```
...@@ -620,6 +623,7 @@ release(): void ...@@ -620,6 +623,7 @@ release(): void
**示例:** **示例:**
``` ```
var audiorecorder = media.createAudioRecorder();
audiorecorder.release(); audiorecorder.release();
``` ```
...@@ -634,6 +638,7 @@ reset(): void ...@@ -634,6 +638,7 @@ reset(): void
**示例:** **示例:**
``` ```
var audiorecorder = media.createAudioRecorder();
audiorecorder.reset(); audiorecorder.reset();
``` ```
...@@ -653,6 +658,7 @@ on(type: 'prepare' | 'start' | 'stop' | 'release' | 'reset', callback: () => voi ...@@ -653,6 +658,7 @@ on(type: 'prepare' | 'start' | 'stop' | 'release' | 'reset', callback: () => voi
**示例:** **示例:**
``` ```
var audiorecorder = media.createAudioRecorder();
audiorecorder.on('prepare', () => { audiorecorder.on('prepare', () => {
console.log('Preparation succeeded.'); console.log('Preparation succeeded.');
audiorecorder.start(); audiorecorder.start();
......
...@@ -11,11 +11,6 @@ import process from '@ohos.process'; ...@@ -11,11 +11,6 @@ import process from '@ohos.process';
``` ```
## 权限
## 属性 ## 属性
| 名称 | 类型 | 可读 | 可写 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
...@@ -143,12 +138,12 @@ kill函数用来发送信号给子进程,结束指定进程。 ...@@ -143,12 +138,12 @@ kill函数用来发送信号给子进程,结束指定进程。
isIsolatedProcess(): boolean isIsolatedProcess(): boolean
检查进程是否被隔离。 判断进程是否被隔离。
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 进程是否隔离 | | boolean | 返回判断结果,如果返回true表示进程被隔离。 |
- 示例: - 示例:
``` ```
...@@ -160,17 +155,17 @@ isIsolatedProcess(): boolean ...@@ -160,17 +155,17 @@ isIsolatedProcess(): boolean
isAppUid(v:number): boolean isAppUid(v:number): boolean
判断是否特定程序的uid 判断uid是否属于应用程序
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| v | number | 是 | 进程的id。 | | v | number | 是 | 应用程序的uid。 |
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 是否是当前app的uid | | boolean | 返回判断结果,如果返回true表示为应用程序的uid。|
- 示例: - 示例:
``` ```
...@@ -182,12 +177,12 @@ isAppUid(v:number): boolean ...@@ -182,12 +177,12 @@ isAppUid(v:number): boolean
is64Bit(): boolean is64Bit(): boolean
判断运行环境是不是64位。 判断运行环境是64位。
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 是不是64位环境 | | boolean | 返回判断结果,如果返回true表示为64位环境。 |
- 示例: - 示例:
``` ```
...@@ -204,12 +199,12 @@ getUidForName(v:string): number ...@@ -204,12 +199,12 @@ getUidForName(v:string): number
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| v | string | 是 | 进程name | | v | string | 是 | 进程名。 |
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 进程的uid | | number | 返回进程uid。|
- 示例: - 示例:
``` ```
...@@ -221,17 +216,17 @@ getUidForName(v:string): number ...@@ -221,17 +216,17 @@ getUidForName(v:string): number
getThreadPriority(v:number): number getThreadPriority(v:number): number
根据指定的 TID 获取线程优先级。 根据指定的tid获取线程优先级。
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| v | number | 是 | 进程的id | | v | number | 是 | 指定的线程tid。 |
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 进程的优先级 | | number | 返回线程的优先级。 |
- 示例: - 示例:
``` ```
...@@ -249,7 +244,7 @@ getStartRealtime() :number ...@@ -249,7 +244,7 @@ getStartRealtime() :number
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 时间 | | number | 返回经过的实时时间。|
- 示例: - 示例:
``` ```
...@@ -261,12 +256,12 @@ getStartRealtime() :number ...@@ -261,12 +256,12 @@ getStartRealtime() :number
getAvailableCores() :number[] getAvailableCores() :number[]
获取多核设备上当前进程可用的 CPU 内核。 获取多核设备上当前进程可用的CPU内核。
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number[] | 可用内核数 | | number[] | 返回可用内核数。 |
- 示例: - 示例:
``` ```
...@@ -283,7 +278,7 @@ getPastCputime() :number ...@@ -283,7 +278,7 @@ getPastCputime() :number
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 时间 | | number | 返回经过的CPU时间。 |
- 示例: - 示例:
``` ```
...@@ -295,17 +290,17 @@ getPastCputime() :number ...@@ -295,17 +290,17 @@ getPastCputime() :number
getSystemConfig(name:number): number getSystemConfig(name:number): number
用该方法发送signal到指定的进程 获取系统配置信息
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | number | 是 | 系统配置参数名 | | name | number | 是 | 指定系统配置参数名。 |
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 配置信息 | | number | 返回系统配置信息。 |
- 示例: - 示例:
``` ```
...@@ -323,12 +318,12 @@ getEnvironmentVar(name:string): string ...@@ -323,12 +318,12 @@ getEnvironmentVar(name:string): string
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | 是 | 环境 | | name | string | 是 | 环境变量名。 |
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 环境名对应的value | | string | 返回环境变量名对应的value。 |
- 示例: - 示例:
``` ```
...@@ -367,7 +362,7 @@ runCmd(command: string, options?: { timeout : number, killSignal :number | str ...@@ -367,7 +362,7 @@ runCmd(command: string, options?: { timeout : number, killSignal :number | str
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
console.log("child.getOutput = " + val); console.log("child.getOutput = " + val);
} })
``` ```
......
...@@ -10,12 +10,6 @@ ...@@ -10,12 +10,6 @@
import uri from '@ohos.uri' import uri from '@ohos.uri'
``` ```
## 权限
## URI ## URI
...@@ -64,7 +58,7 @@ toString(): string ...@@ -64,7 +58,7 @@ toString(): string
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 用于返回网址的字符串序列化。 | | string | 返回网址的字符串序列化。 |
- 示例: - 示例:
``` ```
...@@ -87,7 +81,7 @@ equals(other: URI): boolean ...@@ -87,7 +81,7 @@ equals(other: URI): boolean
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 用于测试此URI是否与其他URI对象相等。 | | boolean | 返回true表示相等,否则返回false。 |
- 示例: - 示例:
``` ```
...@@ -96,15 +90,16 @@ equals(other: URI): boolean ...@@ -96,15 +90,16 @@ equals(other: URI): boolean
uriInstance.equals(uriInstance1); uriInstance.equals(uriInstance1);
``` ```
### checkIsAbsolute ### checkIsAbsolute
判断此URI是否为绝对URI。 checkIsAbsolute(): boolean
判断此URI是否为绝对URI(是否定义了scheme组件)。
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 用于说明此URI是否为绝对URI(是否定义了scheme组件)。 | | boolean | 返回true表示该URI是否为绝对URI。 |
- 示例: - 示例:
``` ```
...@@ -122,7 +117,7 @@ normalize(): URI ...@@ -122,7 +117,7 @@ normalize(): URI
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| URI | 用于规范化此URI的路径,并返回一个path被规范化后的URI对象。 | | URI | 返回一个path被规范化后的URI对象。 |
- 示例: - 示例:
``` ```
......
...@@ -11,11 +11,6 @@ import Url from '@ohos.url' ...@@ -11,11 +11,6 @@ import Url from '@ohos.url'
``` ```
## 权限
## URLSearchParams ## URLSearchParams
......
...@@ -15,11 +15,6 @@ import util from '@ohos.util'; ...@@ -15,11 +15,6 @@ import util from '@ohos.util';
``` ```
## 权限
## util.printf ## util.printf
printf(format: string, ...args: Object[]): string printf(format: string, ...args: Object[]): string
...@@ -296,7 +291,7 @@ RationalNumber的构造函数。 ...@@ -296,7 +291,7 @@ RationalNumber的构造函数。
- 示例: - 示例:
``` ```
var rationalNumber = new util.RationalNumber(1,2) var rationalNumber = new util.RationalNumber(1,2);
``` ```
...@@ -551,7 +546,7 @@ constructor(capacity?:number) ...@@ -551,7 +546,7 @@ constructor(capacity?:number)
- 示例: - 示例:
``` ```
var lrubuffer= new util.LruBuffer() var lrubuffer= new util.LruBuffer();
``` ```
...@@ -661,7 +656,7 @@ getMissCount():number ...@@ -661,7 +656,7 @@ getMissCount():number
``` ```
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2) pro.get(2);
var result = pro.getMissCount(); var result = pro.getMissCount();
``` ```
...@@ -896,7 +891,7 @@ afterRemoval(isEvict:boolean,key:K,value:V,newValue:V):void ...@@ -896,7 +891,7 @@ afterRemoval(isEvict:boolean,key:K,value:V,newValue:V):void
} }
} }
} }
ChildLruBuffer.getInstance().afterRemoval(false,10,30,null) ChildLruBuffer.getInstance().afterRemoval(false,10,30,null);
``` ```
...@@ -1115,7 +1110,7 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope ...@@ -1115,7 +1110,7 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
var tempMidS = new Temperature(39); var tempMidS = new Temperature(39);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
var result = range.intersect(tempMiDF, tempMidS) var result = range.intersect(tempMiDF, tempMidS);
``` ```
...@@ -1135,7 +1130,7 @@ getUpper():ScopeType ...@@ -1135,7 +1130,7 @@ getUpper():ScopeType
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
var result = range.getUpper() var result = range.getUpper();
``` ```
...@@ -1155,7 +1150,7 @@ getLower():ScopeType ...@@ -1155,7 +1150,7 @@ getLower():ScopeType
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
var result = range.getLower() var result = range.getLower();
``` ```
...@@ -1183,7 +1178,7 @@ expand(lowerObj:ScopeType,upperObj:ScopeType):Scope ...@@ -1183,7 +1178,7 @@ expand(lowerObj:ScopeType,upperObj:ScopeType):Scope
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
var tempMidS = new Temperature(39); var tempMidS = new Temperature(39);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
var result = range.expand(tempMiDF, tempMidS) var result = range.expand(tempMiDF, tempMidS);
``` ```
...@@ -1211,7 +1206,7 @@ expand(range:Scope):Scope ...@@ -1211,7 +1206,7 @@ expand(range:Scope):Scope
var tempMidS = new Temperature(39); var tempMidS = new Temperature(39);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
var rangeFir = new util.Scope(tempMiDF, tempMidS); var rangeFir = new util.Scope(tempMiDF, tempMidS);
var result = range.expand(rangeFir) var result = range.expand(rangeFir);
``` ```
...@@ -1237,7 +1232,7 @@ expand(value:ScopeType):Scope ...@@ -1237,7 +1232,7 @@ expand(value:ScopeType):Scope
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
var result = range.expand(tempMiDF) var result = range.expand(tempMiDF);
``` ```
...@@ -1263,7 +1258,7 @@ contains(value:ScopeType):boolean ...@@ -1263,7 +1258,7 @@ contains(value:ScopeType):boolean
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
range.contains(tempMiDF) range.contains(tempMiDF);
``` ```
...@@ -1291,7 +1286,7 @@ contains(range:Scope):boolean ...@@ -1291,7 +1286,7 @@ contains(range:Scope):boolean
var tempLess = new Temperature(20); var tempLess = new Temperature(20);
var tempMore = new Temperature(45); var tempMore = new Temperature(45);
var rangeSec = new util.Scope(tempLess, tempMore); var rangeSec = new util.Scope(tempLess, tempMore);
var result = range.contains(rangeSec) var result = range.contains(rangeSec);
``` ```
...@@ -1309,7 +1304,7 @@ clamp(value:ScopeType):ScopeType ...@@ -1309,7 +1304,7 @@ clamp(value:ScopeType):ScopeType
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | 如果传入的value小于下限,则返回lowerObj;如果大于上限值则返回upperObj;如果在当前范围内,则返回value | | [ScopeType](#scopetype8) | 如果传入的value小于下限,则返回lowerObj;如果大于上限值则返回upperObj;如果在当前范围内,则返回value |
- 示例: - 示例:
``` ```
...@@ -1317,7 +1312,7 @@ clamp(value:ScopeType):ScopeType ...@@ -1317,7 +1312,7 @@ clamp(value:ScopeType):ScopeType
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
var result = range.clamp(tempMiDF) var result = range.clamp(tempMiDF);
``` ```
...@@ -1332,7 +1327,7 @@ Base64的构造函数。 ...@@ -1332,7 +1327,7 @@ Base64的构造函数。
- 示例: - 示例:
``` ```
var base64 = new util.Base64() var base64 = new util.Base64();
``` ```
...@@ -1429,12 +1424,11 @@ encode(src:Uint8Array):Promise&lt;Uint8Array&gt; ...@@ -1429,12 +1424,11 @@ encode(src:Uint8Array):Promise&lt;Uint8Array&gt;
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var rarray = new Uint8Array([99,122,69,122]); var rarray = new Uint8Array([99,122,69,122]);
await that.encode(array).then(val=>{ that.encode(array).then(val=>{
for (var i = 0; i < rarray.length; i++) { for (var i = 0; i < rarray.length; i++) {
expect(val[i]).assertEqual(rarray[i]) expect(val[i]).assertEqual(rarray[i])
} }
}) })
done();
``` ```
...@@ -1458,10 +1452,9 @@ encodeToString(src:Uint8Array):Promise&lt;string&gt; ...@@ -1458,10 +1452,9 @@ encodeToString(src:Uint8Array):Promise&lt;string&gt;
``` ```
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
await that.encodeToString(array).then(val=>{ that.encodeToString(array).then(val=>{
expect(val).assertEqual('czEz') expect(val).assertEqual('czEz')
}) })
done();
``` ```
...@@ -1486,12 +1479,11 @@ decode(src:Uint8Array | string):Promise&lt;Uint8Array&gt; ...@@ -1486,12 +1479,11 @@ decode(src:Uint8Array | string):Promise&lt;Uint8Array&gt;
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([99,122,69,122]); var array = new Uint8Array([99,122,69,122]);
var rarray = new Uint8Array([115,49,51]); var rarray = new Uint8Array([115,49,51]);
await that.decode(array).then(val=>{ that.decode(array).then(val=>{
for (var i = 0; i < rarray.length; i++) { for (var i = 0; i < rarray.length; i++) {
expect(val[i]).assertEqual(rarray[i]) expect(val[i]).assertEqual(rarray[i])
} }
}) })
done();
``` ```
...@@ -1588,7 +1580,7 @@ isArgumentsObject(value: Object):boolean ...@@ -1588,7 +1580,7 @@ isArgumentsObject(value: Object):boolean
isArrayBuffer(value: Object):boolean isArrayBuffer(value: Object):boolean
检查输入的value是否是ArrayBuffer对象类型。 检查输入的value是否是ArrayBuffer类型。
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
......
...@@ -11,11 +11,6 @@ import worker from '@ohos.worker'; ...@@ -11,11 +11,6 @@ import worker from '@ohos.worker';
``` ```
## 权限
## 属性 ## 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
...@@ -51,7 +46,7 @@ worker构造函数。 ...@@ -51,7 +46,7 @@ worker构造函数。
| options | [WorkerOptions](#workeroptions) | 否 | worker构造的选项。 | | options | [WorkerOptions](#workeroptions) | 否 | worker构造的选项。 |
- 返回值: - 返回值:
| 参数名 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| worker | 执行Worker构造函数生成的Worker对象,失败则返回undefined。 | | worker | 执行Worker构造函数生成的Worker对象,失败则返回undefined。 |
...@@ -294,7 +289,7 @@ dispatchEvent(event: Event): boolean ...@@ -294,7 +289,7 @@ dispatchEvent(event: Event): boolean
| event | [Event](#event) | 是 | 需要分发的事件。 | | event | [Event](#event) | 是 | 需要分发的事件。 |
- 返回值: - 返回值:
| 参数名 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 分发的结果,false表示分发失败。 | | boolean | 分发的结果,false表示分发失败。 |
...@@ -347,7 +342,7 @@ worker向宿主线程发送消息。 ...@@ -347,7 +342,7 @@ worker向宿主线程发送消息。
``` ```
``` ```
// worker.js // worker.js
import worker from "@ohos.worker"; import worker from '@ohos.worker';
const parentPort = worker.parentPort; const parentPort = worker.parentPort;
parentPort.onmessage = function(e){ parentPort.onmessage = function(e){
parentPort.postMessage("receive data from main.js") parentPort.postMessage("receive data from main.js")
...@@ -369,7 +364,7 @@ close(): void ...@@ -369,7 +364,7 @@ close(): void
``` ```
``` ```
// worker.js // worker.js
import worker from "@ohos.worker"; import worker from '@ohos.worker';
const parentPort = worker.parentPort; const parentPort = worker.parentPort;
parentPort.onmessage = function(e) { parentPort.onmessage = function(e) {
parentPort.close() parentPort.close()
...@@ -397,7 +392,7 @@ DedicatedWorkerGlobalScope的onmessage属性表示worker线程收到来自其宿 ...@@ -397,7 +392,7 @@ DedicatedWorkerGlobalScope的onmessage属性表示worker线程收到来自其宿
``` ```
``` ```
// worker.js // worker.js
import worker from "@ohos.worker"; import worker from '@ohos.worker';
const parentPort = worker.parentPort; const parentPort = worker.parentPort;
parentPort.onmessage = function(e) { parentPort.onmessage = function(e) {
console.log("receive main.js message") console.log("receive main.js message")
...@@ -424,7 +419,7 @@ DedicatedWorkerGlobalScope的onmessageerror属性表示当 Worker 对象接收 ...@@ -424,7 +419,7 @@ DedicatedWorkerGlobalScope的onmessageerror属性表示当 Worker 对象接收
``` ```
``` ```
// worker.js // worker.js
import worker from "@ohos.worker"; import worker from '@ohos.worker';
const parentPort = worker.parentPort; const parentPort = worker.parentPort;
parentPort.onmessageerror= function(e) { parentPort.onmessageerror= function(e) {
console.log("worker.js onmessageerror") console.log("worker.js onmessageerror")
...@@ -466,7 +461,7 @@ DedicatedWorkerGlobalScope的onmessageerror属性表示当 Worker 对象接收 ...@@ -466,7 +461,7 @@ DedicatedWorkerGlobalScope的onmessageerror属性表示当 Worker 对象接收
| evt | [Event](#event) | 是 | 回调的事件类。 | | evt | [Event](#event) | 是 | 回调的事件类。 |
- 返回值 - 返回值
| 参数名 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| void&nbsp;\|&nbsp;Promise&lt;void&gt; | 无返回值或者以Promise形式返回。 | | void&nbsp;\|&nbsp;Promise&lt;void&gt; | 无返回值或者以Promise形式返回。 |
...@@ -533,7 +528,7 @@ WorkerGlobalScope的onerror属性表示worker在执行过程中发生异常被 ...@@ -533,7 +528,7 @@ WorkerGlobalScope的onerror属性表示worker在执行过程中发生异常被
``` ```
``` ```
// worker.js // worker.js
import worker from "@ohos.worker"; import worker from '@ohos.worker';
const parentPort = worker.parentPort const parentPort = worker.parentPort
parentPort.onerror = function(e){ parentPort.onerror = function(e){
console.log("worker.js onerror") console.log("worker.js onerror")
......
...@@ -11,11 +11,6 @@ import xml from '@ohos.xml'; ...@@ -11,11 +11,6 @@ import xml from '@ohos.xml';
``` ```
## 权限
## XmlSerializer ## XmlSerializer
...@@ -28,7 +23,7 @@ XmlSerializer的构造函数。 ...@@ -28,7 +23,7 @@ XmlSerializer的构造函数。
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | 是 | 用于接收写入xml信息的ArrayBuffer&nbsp;\|&nbsp;DataView内存。 | | buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | 是 | 用于接收写入xml信息的ArrayBufferDataView内存。 |
| encoding | string | 否 | 编码格式。 | | encoding | string | 否 | 编码格式。 |
- 示例: - 示例:
...@@ -48,8 +43,8 @@ setAttributes(name: string, value: string):void ...@@ -48,8 +43,8 @@ setAttributes(name: string, value: string):void
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | 是 | 属性的key值 | | name | string | 是 | 属性的key值 |
| value | string | 是 | 属性的value值 | | value | string | 是 | 属性的value值 |
- 示例: - 示例:
``` ```
...@@ -67,7 +62,7 @@ addEmptyElement(name: string): void ...@@ -67,7 +62,7 @@ addEmptyElement(name: string): void
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | 是 | 该空元素的元素名 | | name | string | 是 | 该空元素的元素名 |
- 示例: - 示例:
``` ```
...@@ -93,12 +88,12 @@ setDeclaration(): void ...@@ -93,12 +88,12 @@ setDeclaration(): void
startElement(name: string): void startElement(name: string): void
XmlSerializer的构造函数 根据给定名称写入元素开始标记
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | 是 | 当前元素的元素名 | | name | string | 是 | 当前元素的元素名 |
- 示例: - 示例:
``` ```
...@@ -113,7 +108,7 @@ XmlSerializer的构造函数。 ...@@ -113,7 +108,7 @@ XmlSerializer的构造函数。
endElement(): void endElement(): void
设置结束元素方法 写入元素结束标记
- 示例: - 示例:
``` ```
...@@ -135,8 +130,8 @@ setNamespace(prefix: string, namespace: string): void ...@@ -135,8 +130,8 @@ setNamespace(prefix: string, namespace: string): void
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| prefix | string | 是 | 当前元素及其子元素的前缀 | | prefix | string | 是 | 当前元素及其子元素的前缀 |
| namespace | string | 是 | 当前元素及其子元素的命名空间 | | namespace | string | 是 | 当前元素及其子元素的命名空间 |
- 示例: - 示例:
``` ```
...@@ -148,43 +143,43 @@ setNamespace(prefix: string, namespace: string): void ...@@ -148,43 +143,43 @@ setNamespace(prefix: string, namespace: string): void
thatSer.endElement();// = >'<?xml version="1.0" encoding="utf-8"?>\r\n<h:note xmlns:h="http://www.w3.org/TR/html4/"/>'; thatSer.endElement();// = >'<?xml version="1.0" encoding="utf-8"?>\r\n<h:note xmlns:h="http://www.w3.org/TR/html4/"/>';
``` ```
### setCommnet ### setComment
setCommnet(text: string): void setComment(text: string): void
写入comment属性。 写入comment属性。
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| text | string | 是 | 当前元素的注释内容 | | text | string | 是 | 当前元素的注释内容 |
- 示例: - 示例:
``` ```
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
thatSer.setCommnet("Hi!"); thatSer.setComment("Hi!");
thatSer.endElement(); // => '<note>\r\n <!--Hi!-->\r\n</note>'; thatSer.endElement(); // => '<note>\r\n <!--Hi!-->\r\n</note>';
``` ```
### setCData ### setCDATA
setCData(text: string): void setCDATA(text: string): void
写入CData属性。 写入CDATA属性。
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| text | string | 是 | CDate属性的内容 | | text | string | 是 | CDATA属性的内容。 |
- 示例: - 示例:
``` ```
var arrayBuffer = new ArrayBuffer(1028); var arrayBuffer = new ArrayBuffer(1028);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCData('root SYSTEM') // => '<![CDATA[root SYSTEM]]>'; thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>';
``` ```
...@@ -197,7 +192,7 @@ setText(text: string): void ...@@ -197,7 +192,7 @@ setText(text: string): void
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| text | string | 是 | text属性的内容 | | text | string | 是 | text属性的内容 |
- 示例: - 示例:
``` ```
...@@ -219,7 +214,7 @@ setDocType(text: string): void ...@@ -219,7 +214,7 @@ setDocType(text: string): void
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| text | string | 是 | DocType属性的内容 | | text | string | 是 | DocType属性的内容 |
- 示例: - 示例:
``` ```
...@@ -241,8 +236,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string) ...@@ -241,8 +236,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | 是 | 含有xml文本信息的ArrayBuffer&nbsp;或者DataView | | buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | 是 | 含有xml文本信息的ArrayBuffer或者DataView。 |
| encoding | string | 否 | 编码格式(仅支持utf-8) | | encoding | string | 否 | 编码格式(仅支持utf-8) |
- 示例: - 示例:
``` ```
...@@ -325,12 +320,12 @@ xml解析选项。 ...@@ -325,12 +320,12 @@ xml解析选项。
getColumnNumber(): number getColumnNumber(): number
获取当前号,从1开始。 获取当前号,从1开始。
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回当前号。 | | number | 返回当前号。 |
### getDepth ### getDepth
...@@ -349,12 +344,12 @@ getDepth(): number ...@@ -349,12 +344,12 @@ getDepth(): number
getLineNumber(): number getLineNumber(): number
获取当前号,从1开始。 获取当前号,从1开始。
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回当前号。 | | number | 返回当前号。 |
### getName ### getName
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册