Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
c8d07da9
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
未验证
提交
c8d07da9
编写于
4月 18, 2022
作者:
O
openharmony_ci
提交者:
Gitee
4月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3158 Fix bug convertxml cannot work for release branch
Merge pull request !3158 from hunili/OpenHarmony-3.1-Release
上级
37473f5f
3e1a248d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
18 deletion
+24
-18
en/application-dev/reference/apis/js-apis-convertxml.md
en/application-dev/reference/apis/js-apis-convertxml.md
+2
-1
zh-cn/application-dev/reference/apis/js-apis-convertxml.md
zh-cn/application-dev/reference/apis/js-apis-convertxml.md
+22
-17
未找到文件。
en/application-dev/reference/apis/js-apis-convertxml.md
浏览文件 @
c8d07da9
...
@@ -40,13 +40,14 @@ Converts an XML text into a JavaScript object.
...
@@ -40,13 +40,14 @@ Converts an XML text into a JavaScript object.
-
Example
-
Example
```
```
var
xml =
let
xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
' <todo>Play</todo>' +
'</note>';
'</note>';
let conv = new convertxml.ConvertXML();
let options = {trim : false, declarationKey:"_declaration",
let options = {trim : false, declarationKey:"_declaration",
instructionKey : "_instruction", attributesKey : "_attributes",
instructionKey : "_instruction", attributesKey : "_attributes",
textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
...
...
zh-cn/application-dev/reference/apis/js-apis-convertxml.md
浏览文件 @
c8d07da9
...
@@ -35,21 +35,26 @@ convert(xml: string, options?: ConvertOptions) : Object
...
@@ -35,21 +35,26 @@ convert(xml: string, options?: ConvertOptions) : Object
| 类型 | 说明 |
| 类型 | 说明 |
| ------ | ---------------------------- |
| ------ | ---------------------------- |
|
string
| 处理后返回的JavaScript对象。 |
|
Object
| 处理后返回的JavaScript对象。 |
-
示例:
-
示例:
```
```
var
xml =
let
xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
' <todo>Play</todo>' +
'</note>';
'</note>';
var conv = new convertxml.ConvertXML();
let conv = new convertxml.ConvertXML();
var result1 = conv.convert(xml, {trim: false, ignoreDeclaration: false});
let options = {trim : false, declarationKey:"_declaration",
console.log(result1)
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)
```
```
...
@@ -57,7 +62,7 @@ convert(xml: string, options?: ConvertOptions) : Object
...
@@ -57,7 +62,7 @@ convert(xml: string, options?: ConvertOptions) : Object
| 名称 | 参数类型 | 必填 | 说明 |
| 名称 | 参数类型 | 必填 | 说明 |
| ----------------- | -------- | ---- | ----------------------------------------------------------- |
| ----------------- | -------- | ---- | ----------------------------------------------------------- |
| trim | boolean |
否
| 是否修剪位于文本前后的空白字符,默认false。 |
| trim | boolean |
是
| 是否修剪位于文本前后的空白字符,默认false。 |
| ignoreDeclaration | boolean | 否 | 是否忽略xml写入声明指示,默认false。 |
| ignoreDeclaration | boolean | 否 | 是否忽略xml写入声明指示,默认false。 |
| ignoreInstruction | boolean | 否 | 是否忽略xml的写入处理指令,默认false。 |
| ignoreInstruction | boolean | 否 | 是否忽略xml的写入处理指令,默认false。 |
| ignoreAttributes | boolean | 否 | 是否跨多行打印属性并缩进属性,默认false。 |
| ignoreAttributes | boolean | 否 | 是否跨多行打印属性并缩进属性,默认false。 |
...
@@ -65,14 +70,14 @@ convert(xml: string, options?: ConvertOptions) : Object
...
@@ -65,14 +70,14 @@ convert(xml: string, options?: ConvertOptions) : Object
| 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。 |
| instructionKey | string | 否 | 用于输出对象中instruction的属性键的名称,默认_instruction。 |
| instructionKey | string | 是 | 用于输出对象中instruction的属性键的名称,默认_instruction。 |
| attributesKey | string | 否 | 用于输出对象中attributes的属性键的名称,默认_attributes。 |
| attributesKey | string | 是 | 用于输出对象中attributes的属性键的名称,默认_attributes。 |
| textKey | string | 否 | 用于输出对象中text的属性键的名称,默认_text。 |
| textKey | string | 是 | 用于输出对象中text的属性键的名称,默认_text。 |
| cdataKey | string | 否 | 用于输出对象中cdata的属性键的名称,默认_cdata。 |
| cdataKey | string | 是 | 用于输出对象中cdata的属性键的名称,默认_cdata。 |
| doctypeKey | string | 否 | 用于输出对象中doctype的属性键的名称,默认_doctype。 |
| doctypeKey | string | 是 | 用于输出对象中doctype的属性键的名称,默认_doctype。 |
| commentKey | string | 否 | 用于输出对象中comment的属性键的名称,默认_comment。 |
| commentKey | string | 是 | 用于输出对象中comment的属性键的名称,默认_comment。 |
| parentKey | string | 否 | 用于输出对象中parent的属性键的名称,默认_parent。 |
| parentKey | string | 是 | 用于输出对象中parent的属性键的名称,默认_parent。 |
| typeKey | string | 否 | 用于输出对象中type的属性键的名称,默认_type。 |
| typeKey | string | 是 | 用于输出对象中type的属性键的名称,默认_type。 |
| nameKey | string | 否 | 用于输出对象中name的属性键的名称,默认_name。 |
| nameKey | string | 是 | 用于输出对象中name的属性键的名称,默认_name。 |
| elementsKey | string | 否 | 用于输出对象中elements的属性键的名称,默认_elements。 |
| elementsKey | string | 是 | 用于输出对象中elements的属性键的名称,默认_elements。 |
\ No newline at end of file
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录