From 4ef43470e42825d9cfbc594b130e73827f85338b Mon Sep 17 00:00:00 2001 From: zengyawen Date: Wed, 11 May 2022 10:26:39 +0800 Subject: [PATCH] update docs Signed-off-by: zengyawen --- .../reference/apis/js-apis-convertxml.md | 58 +++++++++---------- .../reference/apis/js-apis-uri.md | 17 ++++-- .../reference/apis/js-apis-url.md | 47 +++++++++++---- .../reference/apis/js-apis-xml.md | 54 +++++++++++++++-- 4 files changed, 126 insertions(+), 50 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-convertxml.md b/zh-cn/application-dev/reference/apis/js-apis-convertxml.md index 30530aceb7..c62f2cbb5f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-convertxml.md +++ b/zh-cn/application-dev/reference/apis/js-apis-convertxml.md @@ -10,10 +10,6 @@ import convertxml from '@ohos.convertxml'; ``` -## 系统能力 - -SystemCapability.Utils.Lang - ## ConvertXML @@ -23,39 +19,41 @@ convert(xml: string, options?: ConvertOptions) : Object 转化xml文本为JavaScript对象。 +**系统能力:** SystemCapability.Utils.Lang -- 参数: + +**参数:** | 参数名 | 类型 | 必填 | 说明 | | ------- | --------------------------------- | ---- | ------------------ | | xml | string | 是 | 传入的xml文本。 | | options | [ConvertOptions](#convertoptions) | 否 | 用户可进行的选项。 | -- 返回值: - - | 类型 | 说明 | - | ------ | ---------------------------- | - | Object | 处理后返回的JavaScript对象。 | - -- 示例: - - ```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) - ``` +**返回值:** + +| 类型 | 说明 | +| ------ | ---------------------------- | +| Object | 处理后返回的JavaScript对象。 | + +**示例:** + +```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 diff --git a/zh-cn/application-dev/reference/apis/js-apis-uri.md b/zh-cn/application-dev/reference/apis/js-apis-uri.md index c15f3ae771..bde1c76afa 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uri.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uri.md @@ -10,15 +10,12 @@ import uri from '@ohos.uri' ``` -## 系统能力 - -SystemCapability.Utils.Lang - ## URI - ### 属性 +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang + | 名称 | 参数类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | scheme | string | 是 | 否 | 获取URI 的协议部分。 | @@ -38,6 +35,8 @@ constructor(uri: string) constructor是URI的构造函数。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 可读 | 可写 | 说明 | @@ -59,6 +58,8 @@ new uri.URI('http://username:password@host:8080'); // Output 'http://username:pa toString(): string +**系统能力:** SystemCapability.Utils.Lang + 返回适用于URL中的查询字符串。 **返回值:** @@ -81,6 +82,8 @@ equals(other: URI): boolean 判断此URI是否与其他URI对象相等。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -107,6 +110,8 @@ checkIsAbsolute(): boolean 判断此URI是否为绝对URI(是否定义了scheme组件)。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -127,6 +132,8 @@ normalize(): URI 规范化此URI的路径。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-url.md b/zh-cn/application-dev/reference/apis/js-apis-url.md index 685e6ee224..f27434cedf 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-url.md +++ b/zh-cn/application-dev/reference/apis/js-apis-url.md @@ -10,10 +10,6 @@ import Url from '@ohos.url' ``` -## 系统能力 - -SystemCapability.Utils.Lang - ## URLSearchParams @@ -23,6 +19,8 @@ constructor(init?: string[][] | Record<string, string> | string | URLSearc URLSearchParams的构造函数。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -46,6 +44,8 @@ append(name: string, value: string): void 将新的键值对插入到查询字符串。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -68,6 +68,8 @@ delete(name: string): void 删除指定名称的键值对。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -89,6 +91,8 @@ getAll(name: string): string[] 获取指定名称的所有键值对。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -117,6 +121,8 @@ entries(): IterableIterator<[string, string]> 返回一个ES6的迭代器,迭代器的每一项都是一个 JavaScript Array。Array的第一项是name,Array的第二项是value。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -139,6 +145,8 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th 通过回调函数来遍历URLSearchParams实例对象上的键值对。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -170,6 +178,8 @@ get(name: string): string | null 获取指定名称对应的第一个值。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -199,6 +209,8 @@ has(name: string): boolean 判断一个指定的键名对应的值是否存在。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -226,6 +238,8 @@ set(name: string, value: string): void 将与name关联的URLSearchParams对象中的值设置为value。如果存在名称为name的键值对,请将第一个键值对的值设置为value并删除所有其他值。如果不是,则将键值对附加到查询字符串。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -246,9 +260,10 @@ paramsObject.set('baz', 3); // Add a third parameter. sort(): void - 对包含在此对象中的所有键值对进行排序,并返回undefined。排序顺序是根据键的Unicode代码点。该方法使用稳定的排序算法 (即,将保留具有相等键的键值对之间的相对顺序)。 +**系统能力:** SystemCapability.Utils.Lang + **示例:** ```js @@ -262,9 +277,10 @@ console.log(searchParamsObject.toString()); // Display the sorted query string / keys(): IterableIterator<string> - 返回一个所有键值对的name的ES6迭代器。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -287,6 +303,8 @@ values(): IterableIterator<string> 返回一个所有键值对的value的ES6迭代器。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -307,9 +325,10 @@ for (var value of searchParams.values()) { [Symbol.iterator]\(): IterableIterator<[string, string]> - 返回一个ES6的迭代器,迭代器的每一项都是一个 JavaScript Array。Array的第一项是name,Array的第二项是value。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -330,9 +349,10 @@ for (const [name, value] of paramsObject) { toString(): string - 返回序列化为字符串的搜索参数,必要时对字符进行百分比编码。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -351,9 +371,10 @@ console.log(params.toString()); ## URL - ### 属性 +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang + | 名称 | 参数类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | hash | string | 是 | 是 | 获取和设置URL的片段部分。 | @@ -374,9 +395,10 @@ console.log(params.toString()); constructor(url: string, base?: string | URL) - URL的构造函数。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -408,6 +430,8 @@ toString(): string 将解析过后的URL转化为字符串。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -426,9 +450,10 @@ url.toString() toJSON(): string - 将解析过后的URL转化为JSON字符串。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-xml.md b/zh-cn/application-dev/reference/apis/js-apis-xml.md index 0ec2c2a72d..db42b40c7f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-xml.md +++ b/zh-cn/application-dev/reference/apis/js-apis-xml.md @@ -10,10 +10,6 @@ import xml from '@ohos.xml'; ``` -## 系统能力 - -SystemCapability.Utils.Lang - ## XmlSerializer @@ -23,6 +19,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string) XmlSerializer的构造函数。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -45,6 +43,8 @@ setAttributes(name: string, value: string): void 设置Attributes方法。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -66,6 +66,8 @@ addEmptyElement(name: string): void 写入一个空元素。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -86,6 +88,8 @@ setDeclaration(): void 设置Declaration方法。 +**系统能力:** SystemCapability.Utils.Lang + **示例:** ```js @@ -100,6 +104,8 @@ startElement(name: string): void 根据给定名称写入元素开始标记。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -122,6 +128,8 @@ endElement(): void 写入元素结束标记。 +**系统能力:** SystemCapability.Utils.Lang + **示例:** ```js @@ -140,6 +148,8 @@ setNamespace(prefix: string, namespace: string): void 写入当前元素标记的命名空间。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -164,6 +174,8 @@ setComment(text: string): void 写入comment属性。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -187,6 +199,8 @@ setCDATA(text: string): void 写入CDATA属性。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -208,6 +222,8 @@ setText(text: string): void 设置Text方法。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -232,6 +248,8 @@ setDocType(text: string): void 写入DocType属性。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -256,6 +274,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string) 创建并返回一个XmlPullParser对象,该XmlPullParser对象传参两个, 第一参数是ArrayBuffer或DataView类型的一段内存,第二个参数为文件格式(默认为UTF-8) +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -289,6 +309,8 @@ parse(option: ParseOptions): void 该接口用于解析xml。 +**系统能力:** SystemCapability.Utils.Lang + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -329,6 +351,8 @@ that.parse(options); xml解析选项。 +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang + | 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | @@ -349,6 +373,8 @@ getColumnNumber(): number 获取当前列号,从1开始。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -362,6 +388,8 @@ getDepth(): number 获取元素的当前深度。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -375,6 +403,8 @@ getLineNumber(): number 获取当前行号,从1开始。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -388,6 +418,8 @@ getName(): string 获取当前元素名称。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -401,6 +433,8 @@ getNamespace(): string 获取当前元素的命名空间。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -414,6 +448,8 @@ getPrefix(): string 获取当前元素前缀。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -427,6 +463,8 @@ getText(): string 获取当前事件的文本内容。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -440,6 +478,8 @@ isEmptyElementTag(): boolean 判断当前元素是否为空元素。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -453,6 +493,8 @@ isWhitespace(): boolean 判断当前文本事件是否仅包含空格字符。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | @@ -466,6 +508,8 @@ getAttributeCount(): number 获取当前开始标记的属性数。 +**系统能力:** SystemCapability.Utils.Lang + **返回值:** | 类型 | 说明 | | -------- | -------- | @@ -476,6 +520,8 @@ getAttributeCount(): number 事件枚举。 +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang + | 名称 | 枚举值 | 说明 | | -------- | -------- | -------- | | START_DOCUMENT | 0 | 启动文件事件。 | -- GitLab