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

!4225 翻译完成:3894 语言编译相关文档规范修改

Merge pull request !4225 from wusongqing/TR3894
# URI String Parsing # URI String Parsing
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
> 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. > 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.
...@@ -10,15 +10,12 @@ ...@@ -10,15 +10,12 @@
import uri from '@ohos.uri' import uri from '@ohos.uri'
``` ```
## System Capabilities
SystemCapability.Utils.Lang
## URI ## URI
### Attributes ### Attributes
**System capability**: SystemCapability.Utils.Lang
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| scheme | string | Yes| No| Scheme in the URI.| | scheme | string | Yes| No| Scheme in the URI.|
...@@ -38,6 +35,8 @@ constructor(uri: string) ...@@ -38,6 +35,8 @@ constructor(uri: string)
A constructor used to create a URI instance. A constructor used to create a URI instance.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type.| Readable| Writable| Description| | Name| Type.| Readable| Writable| Description|
...@@ -59,6 +58,8 @@ new uri.URI('http://username:password@host:8080'); // Output 'http://username:pa ...@@ -59,6 +58,8 @@ new uri.URI('http://username:password@host:8080'); // Output 'http://username:pa
toString(): string toString(): string
**System capability**: SystemCapability.Utils.Lang
Obtains the query string applicable to this URL. Obtains the query string applicable to this URL.
**Return value** **Return value**
...@@ -81,6 +82,8 @@ equals(other: URI): boolean ...@@ -81,6 +82,8 @@ equals(other: URI): boolean
Checks whether this URI is the same as another URI object. Checks whether this URI is the same as another URI object.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type.| Mandatory| Description| | Name| Type.| Mandatory| Description|
...@@ -107,6 +110,8 @@ checkIsAbsolute(): boolean ...@@ -107,6 +110,8 @@ checkIsAbsolute(): boolean
Checks whether this URI is an absolute URI (whether the scheme component is defined). Checks whether this URI is an absolute URI (whether the scheme component is defined).
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type.| Description| | Type.| Description|
...@@ -127,6 +132,8 @@ normalize(): URI ...@@ -127,6 +132,8 @@ normalize(): URI
Normalizes the path of this URI. Normalizes the path of this URI.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type.| Description| | Type.| Description|
......
# URL String Parsing # URL String Parsing
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -10,10 +10,6 @@ ...@@ -10,10 +10,6 @@
import Url from '@ohos.url' import Url from '@ohos.url'
``` ```
## System Capabilities
SystemCapability.Utils.Lang
## URLSearchParams ## URLSearchParams
...@@ -23,11 +19,13 @@ constructor(init?: string[][] | Record&lt;string, string&gt; | string | URLSearc ...@@ -23,11 +19,13 @@ constructor(init?: string[][] | Record&lt;string, string&gt; | string | URLSearc
Creates a **URLSearchParams** instance. Creates a **URLSearchParams** instance.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| init | string[][]&nbsp;\|&nbsp;Record&lt;string,&nbsp;string&gt;&nbsp;\|&nbsp;string&nbsp;\|&nbsp;URLSearchParams | No| Input parameter objects, which include the following:<br>- **string[][]**: two-dimensional string array<br>- **Record&lt;string,&nbsp;string&gt;**: list of objects<br>- **string**: string<br>- **URLSearchParams**: object| | init | string[][]&nbsp;\|&nbsp;Record&lt;string,&nbsp;string&gt;&nbsp;\|&nbsp;string&nbsp;\|&nbsp;URLSearchParams | No| Input parameter objects, which include the following:<br>- **string[][]**: two-dimensional string array<br>-&nbsp;**Record&lt;string,&nbsp;string&gt;**: list of objects<br>- **string**: string<br>- **URLSearchParams**: object |
**Example** **Example**
...@@ -46,6 +44,8 @@ append(name: string, value: string): void ...@@ -46,6 +44,8 @@ append(name: string, value: string): void
Appends a key-value pair into the query string. Appends a key-value pair into the query string.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -68,6 +68,8 @@ delete(name: string): void ...@@ -68,6 +68,8 @@ delete(name: string): void
Deletes key-value pairs of the specified key. Deletes key-value pairs of the specified key.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -89,6 +91,8 @@ getAll(name: string): string[] ...@@ -89,6 +91,8 @@ getAll(name: string): string[]
Obtains all the key-value pairs based on the specified key. Obtains all the key-value pairs based on the specified key.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -117,6 +121,8 @@ entries(): IterableIterator<[string, string]> ...@@ -117,6 +121,8 @@ entries(): IterableIterator<[string, string]>
Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields of each array are the key and value respectively. Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields of each array are the key and value respectively.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -139,6 +145,8 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th ...@@ -139,6 +145,8 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
Traverses the key-value pairs in the **URLSearchParams** instance by using a callback. Traverses the key-value pairs in the **URLSearchParams** instance by using a callback.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -170,6 +178,8 @@ get(name: string): string | null ...@@ -170,6 +178,8 @@ get(name: string): string | null
Obtains the value of the first key-value pair based on the specified key. Obtains the value of the first key-value pair based on the specified key.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -199,6 +209,8 @@ has(name: string): boolean ...@@ -199,6 +209,8 @@ has(name: string): boolean
Checks whether a key has a value. Checks whether a key has a value.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -226,6 +238,8 @@ set(name: string, value: string): void ...@@ -226,6 +238,8 @@ set(name: string, value: string): void
Sets the value for a key. If key-value pairs matching the specified key exist, the value of the first key-value pair will be set to the specified value and other key-value pairs will be deleted. Otherwise, the key-value pair will be appended to the query string. Sets the value for a key. If key-value pairs matching the specified key exist, the value of the first key-value pair will be set to the specified value and other key-value pairs will be deleted. Otherwise, the key-value pair will be appended to the query string.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -246,8 +260,9 @@ paramsObject.set('baz', 3); // Add a third parameter. ...@@ -246,8 +260,9 @@ paramsObject.set('baz', 3); // Add a third parameter.
sort(): void sort(): void
Sorts all key-value pairs contained in this object based on the Unicode code points of the keys and returns undefined. This method uses a stable sorting algorithm, that is, the relative order between key-value pairs with equal keys is retained.
Sorts all key-value pairs contained in this object based on the Unicode code points of the keys and returns undefined. This method uses a stable sorting algorithm, that is, the relative order between key-value pairs with equal keys is retained. **System capability**: SystemCapability.Utils.Lang
**Example** **Example**
...@@ -262,9 +277,10 @@ console.log(searchParamsObject.toString()); // Display the sorted query string / ...@@ -262,9 +277,10 @@ console.log(searchParamsObject.toString()); // Display the sorted query string /
keys(): IterableIterator&lt;string&gt; keys(): IterableIterator&lt;string&gt;
Obtains an ES6 iterator that contains the keys of all the key-value pairs. Obtains an ES6 iterator that contains the keys of all the key-value pairs.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -287,6 +303,8 @@ values(): IterableIterator&lt;string&gt; ...@@ -287,6 +303,8 @@ values(): IterableIterator&lt;string&gt;
Obtains an ES6 iterator that contains the values of all the key-value pairs. Obtains an ES6 iterator that contains the values of all the key-value pairs.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -307,9 +325,10 @@ for (var value of searchParams.values()) { ...@@ -307,9 +325,10 @@ for (var value of searchParams.values()) {
[Symbol.iterator]\(): IterableIterator&lt;[string, string]&gt; [Symbol.iterator]\(): IterableIterator&lt;[string, string]&gt;
Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields of each array are the key and value respectively. Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields of each array are the key and value respectively.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -330,9 +349,10 @@ for (const [name, value] of paramsObject) { ...@@ -330,9 +349,10 @@ for (const [name, value] of paramsObject) {
toString(): string toString(): string
Obtains search parameters that are serialized as a string and, if necessary, percent-encodes the characters in the string. Obtains search parameters that are serialized as a string and, if necessary, percent-encodes the characters in the string.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -351,9 +371,10 @@ console.log(params.toString()); ...@@ -351,9 +371,10 @@ console.log(params.toString());
## URL ## URL
### Attributes ### Attributes
**System capability**: SystemCapability.Utils.Lang
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| hash | string | Yes| Yes| String that contains a harsh mark (#) followed by the fragment identifier of a URL.| | hash | string | Yes| Yes| String that contains a harsh mark (#) followed by the fragment identifier of a URL.|
...@@ -374,9 +395,10 @@ console.log(params.toString()); ...@@ -374,9 +395,10 @@ console.log(params.toString());
constructor(url: string, base?: string | URL) constructor(url: string, base?: string | URL)
Creates a URL. Creates a URL.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -408,6 +430,8 @@ toString(): string ...@@ -408,6 +430,8 @@ toString(): string
Converts the parsed URL into a string. Converts the parsed URL into a string.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -426,9 +450,10 @@ url.toString() ...@@ -426,9 +450,10 @@ url.toString()
toJSON(): string toJSON(): string
Converts the parsed URL into a JSON string. Converts the parsed URL into a JSON string.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
......
# XML Parsing and Generation # XML Parsing and Generation
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
> 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. > 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.
...@@ -10,10 +10,6 @@ ...@@ -10,10 +10,6 @@
import xml from '@ohos.xml'; import xml from '@ohos.xml';
``` ```
## System Capabilities
SystemCapability.Utils.Lang
## XmlSerializer ## XmlSerializer
...@@ -23,6 +19,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string) ...@@ -23,6 +19,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
A constructor used to create an **XmlSerializer** instance. A constructor used to create an **XmlSerializer** instance.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -45,6 +43,8 @@ setAttributes(name: string, value: string): void ...@@ -45,6 +43,8 @@ setAttributes(name: string, value: string): void
Sets an attribute. Sets an attribute.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -66,6 +66,8 @@ addEmptyElement(name: string): void ...@@ -66,6 +66,8 @@ addEmptyElement(name: string): void
Adds an empty element. Adds an empty element.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -86,6 +88,8 @@ setDeclaration(): void ...@@ -86,6 +88,8 @@ setDeclaration(): void
Sets a declaration. Sets a declaration.
**System capability**: SystemCapability.Utils.Lang
**Example** **Example**
```js ```js
...@@ -100,6 +104,8 @@ startElement(name: string): void ...@@ -100,6 +104,8 @@ startElement(name: string): void
Writes the start tag based on the given element name. Writes the start tag based on the given element name.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -122,6 +128,8 @@ endElement(): void ...@@ -122,6 +128,8 @@ endElement(): void
Writes the end tag of the element. Writes the end tag of the element.
**System capability**: SystemCapability.Utils.Lang
**Example** **Example**
```js ```js
...@@ -140,6 +148,8 @@ setNamespace(prefix: string, namespace: string): void ...@@ -140,6 +148,8 @@ setNamespace(prefix: string, namespace: string): void
Sets the namespace for an element tag. Sets the namespace for an element tag.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -164,6 +174,8 @@ setComment(text: string): void ...@@ -164,6 +174,8 @@ setComment(text: string): void
Sets the comment. Sets the comment.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -187,6 +199,8 @@ setCDATA(text: string): void ...@@ -187,6 +199,8 @@ setCDATA(text: string): void
Sets CDATA attributes. Sets CDATA attributes.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -208,6 +222,8 @@ setText(text: string): void ...@@ -208,6 +222,8 @@ setText(text: string): void
Sets **Text**. Sets **Text**.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -232,6 +248,8 @@ setDocType(text: string): void ...@@ -232,6 +248,8 @@ setDocType(text: string): void
Sets **DocType**. Sets **DocType**.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -256,6 +274,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string) ...@@ -256,6 +274,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
Creates and returns an **XmlPullParser** object. The **XmlPullParser** object passes two parameters. The first parameter is the memory of the **ArrayBuffer** or **DataView** type, and the second parameter is the file format (UTF-8 by default). Creates and returns an **XmlPullParser** object. The **XmlPullParser** object passes two parameters. The first parameter is the memory of the **ArrayBuffer** or **DataView** type, and the second parameter is the file format (UTF-8 by default).
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -289,6 +309,8 @@ parse(option: ParseOptions): void ...@@ -289,6 +309,8 @@ parse(option: ParseOptions): void
Parses XML information. Parses XML information.
**System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -329,6 +351,8 @@ that.parse(options); ...@@ -329,6 +351,8 @@ that.parse(options);
Defines the XML parsing options. Defines the XML parsing options.
**System capability**: SystemCapability.Utils.Lang
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -349,6 +373,8 @@ getColumnNumber(): number ...@@ -349,6 +373,8 @@ getColumnNumber(): number
Obtains the column line number, which starts from 1. Obtains the column line number, which starts from 1.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -362,6 +388,8 @@ getDepth(): number ...@@ -362,6 +388,8 @@ getDepth(): number
Obtains the depth of this element. Obtains the depth of this element.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -375,6 +403,8 @@ getLineNumber(): number ...@@ -375,6 +403,8 @@ getLineNumber(): number
Obtains the current line number, starting from 1. Obtains the current line number, starting from 1.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -388,6 +418,8 @@ getName(): string ...@@ -388,6 +418,8 @@ getName(): string
Obtains the name of this element. Obtains the name of this element.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -401,6 +433,8 @@ getNamespace(): string ...@@ -401,6 +433,8 @@ getNamespace(): string
Obtains the namespace of this element. Obtains the namespace of this element.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -414,6 +448,8 @@ getPrefix(): string ...@@ -414,6 +448,8 @@ getPrefix(): string
Obtains the prefix of this element. Obtains the prefix of this element.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -427,6 +463,8 @@ getText(): string ...@@ -427,6 +463,8 @@ getText(): string
Obtains the text of the current event. Obtains the text of the current event.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -440,6 +478,8 @@ isEmptyElementTag(): boolean ...@@ -440,6 +478,8 @@ isEmptyElementTag(): boolean
Checks whether the current element is empty. Checks whether the current element is empty.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -453,6 +493,8 @@ isWhitespace(): boolean ...@@ -453,6 +493,8 @@ isWhitespace(): boolean
Checks whether the current text event contains only whitespace characters. Checks whether the current text event contains only whitespace characters.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
...@@ -466,6 +508,8 @@ getAttributeCount(): number ...@@ -466,6 +508,8 @@ getAttributeCount(): number
Obtains the number of attributes for the current start tag. Obtains the number of attributes for the current start tag.
**System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
...@@ -476,6 +520,8 @@ Obtains the number of attributes for the current start tag. ...@@ -476,6 +520,8 @@ Obtains the number of attributes for the current start tag.
Enumerates the events. Enumerates the events.
**System capability**: SystemCapability.Utils.Lang
| Name| Value| Description| | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| START_DOCUMENT | 0 | Indicates a start document event.| | START_DOCUMENT | 0 | Indicates a start document event.|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册