提交 2d019435 编写于 作者: G Gloria

Update docs against 8302+8786+9246+9345+9687+9651

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 11a50470
...@@ -64,8 +64,8 @@ This is a system API and cannot be called by third-party applications. ...@@ -64,8 +64,8 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
```js ```js
var child = process.runCmd('ls'); let child = process.runCmd('ls');
var result = child.wait(); let result = child.wait();
result.then(val=>{ result.then(val=>{
console.log("result = " + val); console.log("result = " + val);
}) })
...@@ -91,8 +91,8 @@ This is a system API and cannot be called by third-party applications. ...@@ -91,8 +91,8 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
```js ```js
var child = process.runCmd('ls'); let child = process.runCmd('ls');
var result = child.wait(); let result = child.wait();
child.getOutput().then(val=>{ child.getOutput().then(val=>{
console.log("child.getOutput = " + val); console.log("child.getOutput = " + val);
}) })
...@@ -118,8 +118,8 @@ This is a system API and cannot be called by third-party applications. ...@@ -118,8 +118,8 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
```js ```js
var child = process.runCmd('madir test.text'); let child = process.runCmd('madir test.text');
var result = child.wait(); let result = child.wait();
child.getErrorOutput().then(val=>{ child.getErrorOutput().then(val=>{
console.log("child.getErrorOutput= " + val); console.log("child.getErrorOutput= " + val);
}) })
...@@ -139,7 +139,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -139,7 +139,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
```js ```js
var child = process.runCmd('sleep 5; ls'); let child = process.runCmd('sleep 5; ls');
child.close(); child.close();
``` ```
...@@ -163,7 +163,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -163,7 +163,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
```js ```js
var child = process.runCmd('sleep 5; ls'); let child = process.runCmd('sleep 5; ls');
child.kill(9); child.kill(9);
``` ```
...@@ -185,7 +185,7 @@ Checks whether this process is isolated. ...@@ -185,7 +185,7 @@ Checks whether this process is isolated.
**Example** **Example**
```js ```js
var result = process.isIsolatedProcess(); let result = process.isIsolatedProcess();
``` ```
...@@ -212,7 +212,7 @@ Checks whether a UID belongs to this app. ...@@ -212,7 +212,7 @@ Checks whether a UID belongs to this app.
**Example** **Example**
```js ```js
var result = process.isAppUid(688); let result = process.isAppUid(688);
``` ```
...@@ -233,7 +233,7 @@ Checks whether this process is running in a 64-bit environment. ...@@ -233,7 +233,7 @@ Checks whether this process is running in a 64-bit environment.
**Example** **Example**
```js ```js
var result = process.is64Bit(); let result = process.is64Bit();
``` ```
...@@ -260,7 +260,7 @@ Obtains the process UID based on the process name. ...@@ -260,7 +260,7 @@ Obtains the process UID based on the process name.
**Example** **Example**
```js ```js
var pres = process.getUidForName("tool") let pres = process.getUidForName("tool")
``` ```
...@@ -287,8 +287,8 @@ Obtains the thread priority based on the specified TID. ...@@ -287,8 +287,8 @@ Obtains the thread priority based on the specified TID.
**Example** **Example**
```js ```js
var tid = process.tid; let tid = process.tid;
var pres = process.getThreadPriority(tid); let pres = process.getThreadPriority(tid);
``` ```
...@@ -309,7 +309,7 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti ...@@ -309,7 +309,7 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti
**Example** **Example**
```js ```js
var realtime = process.getStartRealtime(); let realtime = process.getStartRealtime();
``` ```
## process.getPastCpuTime<sup>8+</sup> ## process.getPastCpuTime<sup>8+</sup>
...@@ -329,7 +329,7 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c ...@@ -329,7 +329,7 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c
**Example** **Example**
```js ```js
var result = process.getPastCpuTime() ; let result = process.getPastCpuTime() ;
``` ```
...@@ -356,8 +356,8 @@ Obtains the system configuration. ...@@ -356,8 +356,8 @@ Obtains the system configuration.
**Example** **Example**
```js ```js
var _SC_ARG_MAX = 0 let _SC_ARG_MAX = 0
var pres = process.getSystemConfig(_SC_ARG_MAX) let pres = process.getSystemConfig(_SC_ARG_MAX)
``` ```
...@@ -384,7 +384,7 @@ Obtains the value of an environment variable. ...@@ -384,7 +384,7 @@ Obtains the value of an environment variable.
**Example** **Example**
```js ```js
var pres = process.getEnvironmentVar("PATH") let pres = process.getEnvironmentVar("PATH")
``` ```
...@@ -422,8 +422,8 @@ This is a system API and cannot be called by third-party applications. ...@@ -422,8 +422,8 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
```js ```js
var child = process.runCmd('ls', { maxBuffer : 2 }); let child = process.runCmd('ls', { maxBuffer : 2 });
var result = child.wait(); let result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
console.log("child.getOutput = " + val); console.log("child.getOutput = " + val);
}) })
...@@ -505,7 +505,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -505,7 +505,7 @@ This is a system API and cannot be called by third-party applications.
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
var result = process.off("data"); let result = process.off("data");
``` ```
...@@ -545,7 +545,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -545,7 +545,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
```js ```js
var path = process.cwd(); let path = process.cwd();
``` ```
...@@ -589,7 +589,7 @@ Obtains the running time of this process. ...@@ -589,7 +589,7 @@ Obtains the running time of this process.
**Example** **Example**
```js ```js
var time = process.uptime(); let time = process.uptime();
``` ```
...@@ -617,6 +617,6 @@ Sends a signal to the specified process to terminate it. ...@@ -617,6 +617,6 @@ Sends a signal to the specified process to terminate it.
**Example** **Example**
```js ```js
var pres = process.pid let pres = process.pid
var result = process.kill(28, pres) let result = process.kill(28, pres)
``` ```
...@@ -47,7 +47,7 @@ A constructor used to create a URI instance. ...@@ -47,7 +47,7 @@ A constructor used to create a URI instance.
**Example** **Example**
```js ```js
var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; let mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
``` ```
```js ```js
......
...@@ -26,16 +26,16 @@ Creates a **URLSearchParams** instance. ...@@ -26,16 +26,16 @@ Creates a **URLSearchParams** instance.
| 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[][] \| Record&lt;string, string&gt; \| string \| URLSearchParams | No| Input parameter objects, which include the following:<br>- **string[][]**: two-dimensional string array<br>- **Record&lt;string, string&gt;**: list of objects<br>- **string**: string<br>- **URLSearchParams**: object|
**Example** **Example**
```js ```js
var objectParams = new Url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); let objectParams = new Url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
var objectParams1 = new Url.URLSearchParams({"fod" : '1' , "bard" : '2'}); let objectParams1 = new Url.URLSearchParams({"fod" : '1' , "bard" : '2'});
var objectParams2 = new Url.URLSearchParams('?fod=1&bard=2'); let objectParams2 = new Url.URLSearchParams('?fod=1&bard=2');
var urlObject = new Url.URL('https://developer.mozilla.org/?fod=1&bard=2'); let urlObject = new Url.URL('https://developer.mozilla.org/?fod=1&bard=2');
var params = new Url.URLSearchParams(urlObject.search); let params = new Url.URLSearchParams(urlObject.search);
``` ```
...@@ -133,7 +133,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -133,7 +133,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Example** **Example**
```js ```js
var searchParamsObject = new Url.URLSearchParams("keyName1=valueName1&keyName2=valueName2"); let searchParamsObject = new Url.URLSearchParams("keyName1=valueName1&keyName2=valueName2");
for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs
console.log(pair[0]+ ', '+ pair[1]); console.log(pair[0]+ ', '+ pair[1]);
} }
...@@ -197,9 +197,9 @@ Obtains the value of the first key-value pair based on the specified key. ...@@ -197,9 +197,9 @@ Obtains the value of the first key-value pair based on the specified key.
**Example** **Example**
```js ```js
var paramsOject = new Url.URLSearchParams('name=Jonathan&age=18'); let paramsOject = new Url.URLSearchParams('name=Jonathan&age=18');
var name = paramsOject.get("name"); // is the string "Jonathan" let name = paramsOject.get("name"); // is the string "Jonathan"
var age = parseInt(paramsOject.get("age"), 10); // is the number 18 let age = parseInt(paramsOject.get("age"), 10); // is the number 18
``` ```
...@@ -267,7 +267,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi ...@@ -267,7 +267,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi
**Example** **Example**
```js ```js
var searchParamsObject = new Url.URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object let searchParamsObject = new Url.URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object
searchParamsObject.sort(); // Sort the key/value pairs searchParamsObject.sort(); // Sort the key/value pairs
console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4 console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4
``` ```
...@@ -290,7 +290,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs. ...@@ -290,7 +290,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs.
**Example** **Example**
```js ```js
var searchParamsObject = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing let searchParamsObject = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var key of searchParamsObject .keys()) { // Output key-value pairs for (var key of searchParamsObject .keys()) { // Output key-value pairs
console.log(key); console.log(key);
} }
...@@ -314,8 +314,8 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs. ...@@ -314,8 +314,8 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs.
**Example** **Example**
```js ```js
var searchParams = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing let searchParams = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var value of searchParams.values()) { for (var value of searchParams.values()) {
console.log(value); console.log(value);
} }
``` ```
...@@ -339,7 +339,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -339,7 +339,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
```js ```js
const paramsObject = new Url.URLSearchParams('fod=bay&edg=bap'); const paramsObject = new Url.URLSearchParams('fod=bay&edg=bap');
for (const [name, value] of paramsObject) { for (const [name, value] of paramsObject) {
console.log(name, value); console.log(name, value);
} }
``` ```
...@@ -409,11 +409,11 @@ Creates a URL. ...@@ -409,11 +409,11 @@ Creates a URL.
**Example** **Example**
```js ```js
var mm = 'http://username:password@host:8080'; let mm = 'http://username:password@host:8080';
var a = new Url.URL("/", mm); // Output 'http://username:password@host:8080/'; let a = new Url.URL("/", mm); // Output 'http://username:password@host:8080/';
var b = new Url.URL(mm); // Output 'http://username:password@host:8080/'; let b = new Url.URL(mm); // Output 'http://username:password@host:8080/';
new Url.URL('path/path1', b); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('path/path1', b); // Output 'http://username:password@host:8080/path/path1';
var c = new Url.URL('/path/path1', b); // Output 'http://username:password@host:8080/path/path1'; let c = new Url.URL('/path/path1', b); // Output 'http://username:password@host:8080/path/path1';
new Url.URL('/path/path1', c); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('/path/path1', c); // Output 'http://username:password@host:8080/path/path1';
new Url.URL('/path/path1', a); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('/path/path1', a); // Output 'http://username:password@host:8080/path/path1';
new Url.URL('/path/path1', "https://www.exampleUrl/fr-FR/toto"); // Output https://www.exampleUrl/path/path1 new Url.URL('/path/path1', "https://www.exampleUrl/fr-FR/toto"); // Output https://www.exampleUrl/path/path1
......
...@@ -32,9 +32,9 @@ A constructor used to create an **XmlSerializer** instance. ...@@ -32,9 +32,9 @@ A constructor used to create an **XmlSerializer** instance.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); let bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); let thatSer = new xml.XmlSerializer(bufView);
``` ```
...@@ -56,9 +56,9 @@ Sets an attribute. ...@@ -56,9 +56,9 @@ Sets an attribute.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); let bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); let thatSer = new xml.XmlSerializer(bufView);
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
``` ```
...@@ -80,9 +80,9 @@ Adds an empty element. ...@@ -80,9 +80,9 @@ Adds an empty element.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); let bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); let thatSer = new xml.XmlSerializer(bufView);
thatSer.addEmptyElement("b"); // => <b/> thatSer.addEmptyElement("b"); // => <b/>
``` ```
...@@ -98,9 +98,9 @@ Sets a declaration. ...@@ -98,9 +98,9 @@ Sets a declaration.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); let bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); let thatSer = new xml.XmlSerializer(bufView);
thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>; thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>;
``` ```
...@@ -122,8 +122,8 @@ Writes the start tag based on the given element name. ...@@ -122,8 +122,8 @@ Writes the start tag based on the given element name.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); let thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("notel"); thatSer.startElement("notel");
thatSer.endElement();// => '<notel/>'; thatSer.endElement();// => '<notel/>';
``` ```
...@@ -140,9 +140,9 @@ Writes the end tag of the element. ...@@ -140,9 +140,9 @@ Writes the end tag of the element.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); let bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); let thatSer = new xml.XmlSerializer(bufView);
thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.setNamespace("h", "http://www.w3.org/TR/html4/");
thatSer.startElement("table"); thatSer.startElement("table");
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
...@@ -169,8 +169,8 @@ Sets the namespace for an element tag. ...@@ -169,8 +169,8 @@ Sets the namespace for an element tag.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); let thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDeclaration(); thatSer.setDeclaration();
thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.setNamespace("h", "http://www.w3.org/TR/html4/");
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -194,8 +194,8 @@ Sets the comment. ...@@ -194,8 +194,8 @@ Sets the comment.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); let thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
thatSer.setComment("Hi!"); thatSer.setComment("Hi!");
thatSer.endElement(); // => '<note>\r\n <!--Hi!-->\r\n</note>'; thatSer.endElement(); // => '<note>\r\n <!--Hi!-->\r\n</note>';
...@@ -219,8 +219,8 @@ Sets CDATA attributes. ...@@ -219,8 +219,8 @@ Sets CDATA attributes.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1028); let arrayBuffer = new ArrayBuffer(1028);
var thatSer = new xml.XmlSerializer(arrayBuffer); let thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>'; thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>';
``` ```
...@@ -242,8 +242,8 @@ Sets **Text**. ...@@ -242,8 +242,8 @@ Sets **Text**.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); let thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
thatSer.setText("Happy1"); thatSer.setText("Happy1");
...@@ -268,8 +268,8 @@ Sets **DocType**. ...@@ -268,8 +268,8 @@ Sets **DocType**.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); let thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>'; thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>';
``` ```
...@@ -295,20 +295,20 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa ...@@ -295,20 +295,20 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa
**Example** **Example**
```js ```js
var strXml = let strXml =
'<?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 arrayBuffer = new ArrayBuffer(strXml.length*2); let arrayBuffer = new ArrayBuffer(strXml.length);
var bufView = new Uint8Array(arrayBuffer); let bufView = new Uint8Array(arrayBuffer);
var strLen = strXml.length; let strLen = strXml.length;
for (var i = 0; i < strLen; ++i) { for (var i = 0; i < strLen; ++i) {
bufView[i] = strXml.charCodeAt(i);// Set the ArrayBuffer mode. bufView[i] = strXml.charCodeAt(i);// Set the ArrayBuffer mode.
} }
var that = new xml.XmlPullParser(arrayBuffer); let that = new xml.XmlPullParser(arrayBuffer);
``` ```
...@@ -329,30 +329,30 @@ Parses XML information. ...@@ -329,30 +329,30 @@ Parses XML information.
**Example** **Example**
```js ```js
var strXml = let strXml =
'<?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 arrayBuffer = new ArrayBuffer(strXml.length*2); let arrayBuffer = new ArrayBuffer(strXml.length);
var bufView = new Uint8Array(arrayBuffer); let bufView = new Uint8Array(arrayBuffer);
var strLen = strXml.length; let strLen = strXml.length;
for (var i = 0; i < strLen; ++i) { for (var i = 0; i < strLen; ++i) {
bufView[i] = strXml.charCodeAt(i); bufView[i] = strXml.charCodeAt(i);
} }
var that = new xml.XmlPullParser(arrayBuffer); let that = new xml.XmlPullParser(arrayBuffer);
var arrTag = {}; let arrTag = {};
var str = ""; let str = "";
var i = 0; let i = 0;
function func(key, value){ function func(key, value){
arrTag[i] = 'key:'+key+' value:'+ value.getDepth(); arrTag[i] = 'key:'+key+' value:'+ value.getDepth();
str += arrTag[i]; str += arrTag[i];
i++; i++;
return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. return true; // Determines whether to continuely parse, which is used to continue or terminate parsing.
} }
var options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func}
that.parse(options); that.parse(options);
console.log(str); console.log(str);
// Output: // Output:
...@@ -387,7 +387,7 @@ Provides APIs to manage the parsed XML information. ...@@ -387,7 +387,7 @@ Provides APIs to manage the parsed XML information.
getColumnNumber(): number getColumnNumber(): number
Obtains the column line number, which starts from 1. Obtains the column line number, starting from 1.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册