From 7f64dd180a295ea6fb2e44f5c9ed0dc4a8cb4992 Mon Sep 17 00:00:00 2001 From: wusongqing Date: Fri, 13 May 2022 16:33:39 +0800 Subject: [PATCH] updated docs Signed-off-by: wusongqing --- .../apis/js-apis-abilityAccessCtrl.md | 18 +-- .../reference/apis/js-apis-convertxml.md | 107 +++++++++--------- .../reference/apis/js-apis-faultLogger.md | 8 +- 3 files changed, 67 insertions(+), 66 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md index 9f81d3aab8..874341bd76 100644 --- a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md +++ b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md @@ -1,11 +1,11 @@ # Ability Access Control -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```js import abilityAccessCtrl from '@ohos.abilityAccessCtrl' ``` @@ -26,7 +26,7 @@ Creates an **AtManager** instance, which is used for ability access control. **Example** -``` +```js var AtManager = abilityAccessCtrl.createAtManager(); ``` @@ -57,7 +57,7 @@ Checks whether an application has been granted the specified permission. This AP **Example** -``` +```js var AtManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; let promise = AtManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"); @@ -92,7 +92,7 @@ Grants a user granted permission to an application. This API uses a promise to r **Example** -``` +```js var AtManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; let promise = AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"); @@ -124,7 +124,7 @@ Grants a user granted permission to an application. This API uses an asynchronou **Example** -``` +```js var AtManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; let permissionFlag = 1; @@ -159,7 +159,7 @@ Revokes a user granted permission given to an application. This API uses a promi **Example** -``` +```js var AtManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; let permissionFlag = 1; @@ -190,7 +190,7 @@ Revokes a user granted permission given to an application. This API uses an asyn **Example** -``` +```js var AtManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag, data => { @@ -223,7 +223,7 @@ Obtains the flags of the specified permission of a given application. This API u **Example** -``` +```js var AtManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; let promise = AtManager.getPermissionFlags(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"); diff --git a/en/application-dev/reference/apis/js-apis-convertxml.md b/en/application-dev/reference/apis/js-apis-convertxml.md index 7bf2fc1da2..1b41a320c3 100644 --- a/en/application-dev/reference/apis/js-apis-convertxml.md +++ b/en/application-dev/reference/apis/js-apis-convertxml.md @@ -1,19 +1,15 @@ # XML-to-JavaScript Conversion -> **NOTE** +> **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```js import convertxml from '@ohos.convertxml'; ``` -## System Capabilities - -SystemCapability.Utils.Lang - ## ConvertXML @@ -23,61 +19,66 @@ convert(xml: string, options?: ConvertOptions) : Object Converts an XML text into a JavaScript object. +**System capability**: SystemCapability.Utils.Lang -- Parameters - | Name| Type| Mandatory| Description| - | ------- | --------------------------------- | ---- | ------------------ | - | xml | string | Yes| XML text to convert.| - | options | [ConvertOptions](#convertoptions) | No| Settings of the convert operation.| +**Parameters** -- Return value +| Name | Type | Mandatory| Description | +| ------- | --------------------------------- | ---- | --------------- | +| xml | string | Yes | XML text to convert.| +| options | [ConvertOptions](#convertoptions) | No | Options for coversion. | - | Type| Description| - | ------ | ---------------------------- | - | Object | JavaScript object.| +**Return value** -- Example +| Type | Description | +| ------ | ---------------------------- | +| Object | JavaScript object.| - ```js - let xml = - '' + - '' + - ' Happy' + - ' Work' + - ' Play' + - ''; - let conv = new convertxml.ConvertXML(); - let options = {trim : false, declarationKey:"_declaration", - instructionKey : "_instruction", attributesKey : "_attributes", - textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", - commentKey : "_comment", parentKey : "_parent", typeKey : "_type", - nameKey : "_name", elementsKey : "_elements"} - let result = JSON.stringify(conv.convert(xml, options)); - console.log(result) - ``` +**Example** +```js +let xml = + '' + + '' + + ' Happy' + + ' Work' + + ' Play' + + ''; +let conv = new convertxml.ConvertXML(); +let options = {trim : false, declarationKey:"_declaration", + instructionKey : "_instruction", attributesKey : "_attributes", + textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", + commentKey : "_comment", parentKey : "_parent", typeKey : "_type", + nameKey : "_name", elementsKey : "_elements"} +let result = JSON.stringify(conv.convert(xml, options)); +console.log(result) +``` ## ConvertOptions -| Name| Type| Mandatory| Description| +Options for coversion. + +**System capability**: SystemCapability.Utils.Lang + +| Name | Type| Mandatory| Description | | ----------------- | -------- | ---- | ----------------------------------------------------------- | -| trim | boolean | Yes| Whether to trim the whitespace characters before and after the text. The default value is **false**.| -| ignoreDeclaration | boolean | No| Whether to ignore the XML declaration. The default value is **false**.| -| ignoreInstruction | boolean | No| Whether to ignore the XML processing instruction. The default value is **false**.| -| ignoreAttributes | boolean | No| Whether to print attributes across multiple lines and indent attributes. The default value is **false**.| -| ignoreComment | boolean | No| Whether to ignore element comments. The default value is **false**.| -| ignoreCDATA | boolean | No| Whether to ignore the element's CDATA information. The default value is **false**.| -| ignoreDoctype | boolean | No| Whether to ignore the element's Doctype information. The default value is **false**.| -| ignoreText | boolean | No| Whether to ignore the element's text information. The default value is **false**.| -| declarationKey | string | Yes| Name of the attribute key for **declaration** in the output object. The default value is **_declaration**.| -| instructionKey | string | Yes| Name of the attribute key for **instruction** in the output object. The default value is **_instruction**.| -| attributesKey | string | Yes| Name of the attribute key for **attributes** in the output object. The default value is **_attributes**.| -| textKey | string | Yes| Name of the attribute key for **text** in the output object. The default value is **_text**.| -| cdataKey | string | Yes| Name of the attribute key for **CDATA** in the output object. The default value is **_cdata**.| -| doctypeKey | string | Yes| Name of the attribute key for **Doctype** in the output object. The default value is **_doctype**.| -| commentKey | string | Yes| Name of the attribute key for **comment** in the output object. The default value is **_comment**.| -| parentKey | string | Yes| Name of the attribute key for **parent** in the output object. The default value is **_parent**.| -| typeKey | string | Yes| Name of the attribute key for **type** in the output object. The default value is **_type**.| -| nameKey | string | Yes| Name of the attribute key for **name** in the output object. The default value is **_name**.| -| elementsKey | string | Yes| Name of the attribute key for **elements** in the output object. The default value is **_elements**.| +| trim | boolean | Yes | Whether to trim the whitespace characters before and after the text. The default value is **false**. | +| ignoreDeclaration | boolean | No | Whether to ignore the XML declaration. The default value is **false**. | +| ignoreInstruction | boolean | No | Whether to ignore the XML processing instruction. The default value is **false**. | +| ignoreAttributes | boolean | No | Whether to print attributes across multiple lines and indent attributes. The default value is **false**. | +| ignoreComment | boolean | No | Whether to ignore element comments. The default value is **false**. | +| ignoreCDATA | boolean | No | Whether to ignore the element's CDATA information. The default value is **false**. | +| ignoreDoctype | boolean | No | Whether to ignore the element's Doctype information. The default value is **false**. | +| ignoreText | boolean | No | Whether to ignore the element's text information. The default value is **false**. | +| declarationKey | string | Yes | Name of the attribute key for **declaration** in the output object. The default value is **_declaration**.| +| instructionKey | string | Yes | Name of the attribute key for **instruction** in the output object. The default value is **_instruction**.| +| attributesKey | string | Yes | Name of the attribute key for **attributes** in the output object. The default value is **_attributes**. | +| textKey | string | Yes | Name of the attribute key for **text** in the output object. The default value is **_text**. | +| cdataKey | string | Yes | Name of the attribute key for **CDATA** in the output object. The default value is **_cdata**. | +| doctypeKey | string | Yes | Name of the attribute key for **Doctype** in the output object. The default value is **_doctype**. | +| commentKey | string | Yes | Name of the attribute key for **comment** in the output object. The default value is **_comment**. | +| parentKey | string | Yes | Name of the attribute key for **parent** in the output object. The default value is **_parent**. | +| typeKey | string | Yes | Name of the attribute key for **type** in the output object. The default value is **_type**. | +| nameKey | string | Yes | Name of the attribute key for **name** in the output object. The default value is **_name**. | +| elementsKey | string | Yes | Name of the attribute key for **elements** in the output object. The default value is **_elements**. | diff --git a/en/application-dev/reference/apis/js-apis-faultLogger.md b/en/application-dev/reference/apis/js-apis-faultLogger.md index 1233939892..79748782fc 100644 --- a/en/application-dev/reference/apis/js-apis-faultLogger.md +++ b/en/application-dev/reference/apis/js-apis-faultLogger.md @@ -1,10 +1,10 @@ # Fault Logger -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```js import faultLogger from '@ohos.faultLogger' ``` @@ -56,7 +56,7 @@ Obtains the fault information about the current process. This API uses a callbac **Example** -``` +```js function queryFaultLogCallback(error, value) { if (error) { console.info('error is ' + error); @@ -101,7 +101,7 @@ Obtains the fault information about the current process. This API uses a promise **Example** -``` +```js async function getLog() { let value = await faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH); if (value) { -- GitLab