Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
ab7ed359
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ab7ed359
编写于
12月 20, 2022
作者:
G
Gloria
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update docs against 11917+11936
Signed-off-by: wusongqing<wusongqing@huawei.com>
上级
0ed48d81
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
92 addition
and
86 deletion
+92
-86
en/application-dev/reference/apis/js-apis-xml.md
en/application-dev/reference/apis/js-apis-xml.md
+84
-84
en/contribute/code-contribution.md
en/contribute/code-contribution.md
+8
-2
未找到文件。
en/application-dev/reference/apis/js-apis-xml.md
浏览文件 @
ab7ed359
#
XML Parsing and Generation
#
@ohos.xml (XML Parsing and Generation)
> **NOTE**
>
...
...
@@ -24,10 +24,10 @@ A constructor used to create an **XmlSerializer** instance.
**Parameters**
| Name
| Type| Mandatory| Description
|
| -------- | --------
| -------- |
-------- |
| buffer
| ArrayBuffer
\|
DataView | Yes
|
**ArrayBuffer**
or
**DataView**
for storing the XML information to write.|
| encoding | string
| No| Encoding format.
|
| Name
| Type | Mandatory| Description
|
| -------- | --------
------------------------- | ---- | ----------------------------------------
-------- |
| buffer
| ArrayBuffer
\|
DataView | Yes
|
**ArrayBuffer**
or
**DataView**
for storing the XML information to write.|
| encoding | string
| No | Encoding format.
|
**Example**
...
...
@@ -48,10 +48,10 @@ Sets an attribute.
**Parameters**
| Name| Type
| Mandatory| Description
|
| ------
-- | -------- | -------- |
-------- |
| name
| string | Yes| Key of the attribute.
|
| value
| string | Yes
| Value of the attribute.|
| Name| Type
| Mandatory| Description
|
| ------
| ------ | ---- | -------
-------- |
| name
| string | Yes | Key of the attribute.
|
| value
| string | Yes
| Value of the attribute.|
**Example**
...
...
@@ -75,9 +75,9 @@ Adds an empty element.
**Parameters**
| Name| Type
| Mandatory| Description
|
| ------
-- | -------- | -------- |
-------- |
| name
| string | Yes
| Name of the empty element to add.|
| Name| Type
| Mandatory| Description
|
| ------
| ------ | ---- | ----------
-------- |
| name
| string | Yes
| Name of the empty element to add.|
**Example**
...
...
@@ -117,9 +117,9 @@ Writes the start tag based on the given element name.
**Parameters**
| Name| Type
| Mandatory| Description
|
| ------
-- | -------- | -------- |
-------- |
| name
| string | Yes
| Name of the element.|
| Name| Type
| Mandatory| Description
|
| ------
| ------ | ---- | ----------
-------- |
| name
| string | Yes
| Name of the element.|
**Example**
...
...
@@ -145,11 +145,11 @@ Writes the end tag of the element.
let
arrayBuffer
=
new
ArrayBuffer
(
1024
);
let
bufView
=
new
DataView
(
arrayBuffer
);
let
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
thatSer
.
setNamespace
(
"
h
"
,
"
http://www.w3.org/TR/html4/
"
);
thatSer
.
setNamespace
(
"
h
"
,
"
http
s
://www.w3.org/TR/html4/
"
);
thatSer
.
startElement
(
"
table
"
);
thatSer
.
setAttributes
(
"
importance
"
,
"
high
"
);
thatSer
.
setText
(
"
Happy
"
);
thatSer
.
endElement
();
// => <h:table importance="high" xmlns:h="http://www.w3.org/TR/html4/">Happy</h:table>
thatSer
.
endElement
();
// => <h:table importance="high" xmlns:h="http
s
://www.w3.org/TR/html4/">Happy</h:table>
```
...
...
@@ -163,10 +163,10 @@ Sets the namespace for an element tag.
**Parameters**
| Name
| Type| Mandatory| Description
|
| --------
| -------- | -------- |
-------- |
| prefix
| string | Yes| Prefix of the element and its child elements.
|
| namespace | string | Yes| Namespace to set.|
| Name
| Type | Mandatory| Description
|
| --------
- | ------ | ---- | ----------------------
-------- |
| prefix
| string | Yes | Prefix of the element and its child elements.
|
| namespace | string | Yes
| Namespace to set.|
**Example**
...
...
@@ -174,9 +174,9 @@ Sets the namespace for an element tag.
let
arrayBuffer
=
new
ArrayBuffer
(
1024
);
let
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
setDeclaration
();
thatSer
.
setNamespace
(
"
h
"
,
"
http://www.w3.org/TR/html4/
"
);
thatSer
.
setNamespace
(
"
h
"
,
"
http
s
://www.w3.org/TR/html4/
"
);
thatSer
.
startElement
(
"
note
"
);
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
s
://www.w3.org/TR/html4/"/>';
```
### setComment
...
...
@@ -189,9 +189,9 @@ Sets the comment.
**Parameters**
| Name| Type
| Mandatory| Description
|
| ------
-- | -------- | -------- |
-------- |
| text
| string | Yes
| Comment to set.|
| Name| Type
| Mandatory| Description
|
| ------
| ------ | ---- | ------------
-------- |
| text
| string | Yes
| Comment to set.|
**Example**
...
...
@@ -214,9 +214,9 @@ Sets CDATA attributes.
**Parameters**
| Name| Type
| Mandatory| Description
|
| ------
-- | -------- | -------- |
-------- |
| text
| string | Yes
| CDATA attribute to set.|
| Name| Type
| Mandatory| Description
|
| ------
| ------ | ---- | ---------
-------- |
| text
| string | Yes
| CDATA attribute to set.|
**Example**
...
...
@@ -237,9 +237,9 @@ Sets **Text**.
**Parameters**
| Name| Type
| Mandatory| Description
|
| ------
-- | -------- | -------- |
-------- |
| text
| string | Yes
| Content of the
**Text**
to set.|
| Name| Type
| Mandatory| Description
|
| ------
| ------ | ---- | --------
-------- |
| text
| string | Yes
| Content of the
**Text**
to set.|
**Example**
...
...
@@ -263,9 +263,9 @@ Sets **DocType**.
**Parameters**
| Name| Type
| Mandatory| Description
|
| ------
-- | -------- | -------- |
-------- |
| text
| string | Yes
| Content of
**DocType**
to set.|
| Name| Type
| Mandatory| Description
|
| ------
| ------ | ---- | -----------
-------- |
| text
| string | Yes
| Content of
**DocType**
to set.|
**Example**
...
...
@@ -289,10 +289,10 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa
**Parameters**
| Name
| Type| Mandatory| Description
|
| -------- | --------
| -------- |
-------- |
| buffer
| ArrayBuffer
\|
DataView | Yes
|
**ArrayBuffer**
or
**DataView**
that contains XML text information.|
| encoding | string
| No| Encoding format. Only UTF-8 is supported.
|
| Name
| Type | Mandatory| Description
|
| -------- | --------
------------------------- | ---- | ----------------------------------
-------- |
| buffer
| ArrayBuffer
\|
DataView | Yes
|
**ArrayBuffer**
or
**DataView**
that contains XML text information.|
| encoding | string
| No | Encoding format. Only UTF-8 is supported.
|
**Example**
...
...
@@ -324,9 +324,9 @@ Parses XML information.
**Parameters**
| Name| Type
| Mandatory| Description
|
| ------
-- | -------- | -------- |
-------- |
| option |
[
ParseOptions
](
#parseoptions
)
| Yes| Options for controlling and obtaining the parsed information.|
| Name| Type
| Mandatory| Description
|
| ------
| ----------------------------- | ---- | ------------------------
-------- |
| option |
[
ParseOptions
](
#parseoptions
)
| Yes
| Options for controlling and obtaining the parsed information.|
**Example**
...
...
@@ -372,13 +372,13 @@ Defines the XML parsing options.
**System capability**
: SystemCapability.Utils.Lang
| Name
| Type| Mandatory| Description
|
| --------
| -------- | -------- |
-------- |
| supportDoctype
| boolean | No
| Whether to ignore
**Doctype**
. The default value is
**false**
.|
| ignoreNameSpace
| boolean | No| Whether to ignore
**Namespace**
. The default value is
**false**
.
|
| tagValueCallbackFunction
| (name:
string,
value:
string)=
>
boolean | No| Callback used to return
**tagValue**
.
|
| attributeValueCallbackFunction | (name:
string,
value:
string)=
>
boolean | No| Callback used to return
**attributeValue**
.
|
| tokenValueCallbackFunction
| (eventType:
[EventType](#eventtype),
value:
[ParseInfo](#parseinfo))=
>
boolean | No| Callback used to return
**tokenValue**
.
|
| Name
| Type | Mandatory| Description
|
| --------
---------------------- | ------------------------------------------------------------ | ---- | -------------------------------
-------- |
| supportDoctype
| boolean | No
| Whether to ignore
**Doctype**
. The default value is
**false**
.|
| ignoreNameSpace
| boolean | No | Whether to ignore
**Namespace**
. The default value is
**false**
.
|
| tagValueCallbackFunction
| (name: string, value: string) =
>
boolean | No | Callback used to return
**tagValue**
.
|
| attributeValueCallbackFunction | (name:
string, value: string) =
>
boolean | No | Callback used to return
**attributeValue**
.
|
| tokenValueCallbackFunction
| (eventType:
[
EventType
](
#eventtype
)
, value:
[
ParseInfo
](
#parseinfo
)
) =
>
boolean | No | Callback used to return
**tokenValue**
.
|
## ParseInfo
...
...
@@ -395,8 +395,8 @@ Obtains the column line number, starting from 1.
**Return value**
| Type
| Description
|
| ------
-- |
-------- |
| Type
| Description
|
| ------
| ------
-------- |
| number | Column number obtained.|
...
...
@@ -410,8 +410,8 @@ Obtains the depth of this element.
**Return value**
| Type
| Description
|
| ------
-- |
-------- |
| Type
| Description
|
| ------
| ------------
-------- |
| number | Depth obtained.|
...
...
@@ -425,8 +425,8 @@ Obtains the current line number, starting from 1.
**Return value**
| Type
| Description
|
| ------
-- |
-------- |
| Type
| Description
|
| ------
| ------
-------- |
| number | Line number obtained.|
...
...
@@ -440,8 +440,8 @@ Obtains the name of this element.
**Return value**
| Type
| Description
|
| ------
-- |
-------- |
| Type
| Description
|
| ------
| ----------
-------- |
| string | Element name obtained.|
...
...
@@ -455,8 +455,8 @@ Obtains the namespace of this element.
**Return value**
| Type
| Description
|
| ------
-- |
-------- |
| Type
| Description
|
| ------
| ----------------
-------- |
| string | Namespace obtained.|
...
...
@@ -470,8 +470,8 @@ Obtains the prefix of this element.
**Return value**
| Type
| Description
|
| ------
-- |
-------- |
| Type
| Description
|
| ------
| ----------
-------- |
| string | Element prefix obtained.|
...
...
@@ -485,8 +485,8 @@ Obtains the text of the current event.
**Return value**
| Type
| Description
|
| ------
-- |
-------- |
| Type
| Description
|
| ------
| ----------------
-------- |
| string | Text content obtained.|
...
...
@@ -500,8 +500,8 @@ Checks whether the current element is empty.
**Return value**
| Type
| Description
|
| -------
- |
-------- |
| Type
| Description
|
| -------
| --------------------
-------- |
| boolean | Returns
**true**
if the element is empty; returns
**false**
otherwise.|
...
...
@@ -515,8 +515,8 @@ Checks whether the current text event contains only whitespace characters.
**Return value**
| Type
| Description
|
| -------
- |
-------- |
| Type
| Description
|
| -------
| ------------------------------
-------- |
| boolean | Returns
**true**
if the text event contains only whitespace characters; returns
**false**
otherwise.|
...
...
@@ -529,8 +529,8 @@ Obtains the number of attributes for the current start tag.
**System capability**
: SystemCapability.Utils.Lang
**Return value**
| Type
| Description
|
| ------
-- |
-------- |
| Type
| Description
|
| ------
| --------------
-------- |
| number | Number of attributes obtained.|
...
...
@@ -540,16 +540,16 @@ Enumerates the events.
**System capability**
: SystemCapability.Utils.Lang
| Name
| Value| Description
|
| --------
| -------- |
-------- |
| START_DOCUMENT
| 0 | Indicates a start document event.
|
| END_DOCUMENT
| 1 | Indicates an end document event.
|
| START_TAG
| 2 | Indicates a start tag event.
|
| END_TAG
| 3 | Indicates an end tag event.
|
| TEXT
| 4 | Indicates a text event.
|
| CDSECT
| 5 | Indicates a CDATA section event.
|
| COMMENT
| 6 | Indicates an XML comment event.
|
| Name
| Value | Description
|
| --------
-------- | ---- | -------------
-------- |
| START_DOCUMENT
| 0 | Indicates a start document event.
|
| END_DOCUMENT
| 1 | Indicates an end document event.
|
| START_TAG
| 2 | Indicates a start tag event.
|
| END_TAG
| 3 | Indicates an end tag event.
|
| TEXT
| 4 | Indicates a text event.
|
| CDSECT
| 5 | Indicates a CDATA section event.
|
| COMMENT
| 6 | Indicates an XML comment event.
|
| DOCDECL | 7 | Indicates an XML document type declaration event.|
| INSTRUCTION | 8 | Indicates an XML processing instruction event.|
| ENTITY_REFERENCE | 9
| Indicates an entity reference event.
|
| WHITESPACE
| 10 | Indicates a whitespace character event.
|
| ENTITY_REFERENCE | 9
| Indicates an entity reference event.
|
| WHITESPACE
| 10 | Indicates a whitespace character event.
|
en/contribute/code-contribution.md
浏览文件 @
ab7ed359
...
...
@@ -25,6 +25,9 @@ Develop, review, and test code following the OpenHarmony coding standards. Make
### Introducing Open-source Software
For details, see
[
Introducing Open-Source Software
](
introducing-open-source-software.md
)
.
### Test Guide
[
OpenHarmony Secure Test Guide
](
OpenHarmony-security-test-guide.md
)
## Contribution Workflow
...
...
@@ -33,6 +36,9 @@ For details, see [Contribution Process](contribution-process.md).
## Security Issue Disclosure
-
[
OpenHarmony Security Vulnerability Governance
](
https://gitee.com/openharmony/security/blob/master/en/security-process/README.md
)
-
[
OpenHarmony Security and Disclosure Statement
](
https://gitee.com/openharmony/security/blob/master/en/security-process/security-disclosure.md
)
<!--no_check-->
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录