提交 52d88c79 编写于 作者: L lixingyang-li 提交者: lixingyang

Modify the sample code language tag type for language compilation runtime

Signed-off-by: Nlixingyang-li <lixingyang8@huawei.com>
https://gitee.com/openharmony/docs/issues/I550NM
上级 faa43270
...@@ -39,7 +39,7 @@ Converts an XML text into a JavaScript object. ...@@ -39,7 +39,7 @@ Converts an XML text into a JavaScript object.
- Example - Example
``` ```js
let 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">' +
......
...@@ -60,7 +60,7 @@ Waits until the child process ends. This method uses a promise to return the exi ...@@ -60,7 +60,7 @@ Waits until the child process ends. This method uses a promise to return the exi
**Example** **Example**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
result.then(val=>{ result.then(val=>{
...@@ -85,7 +85,7 @@ Obtains the standard output of the child process. ...@@ -85,7 +85,7 @@ Obtains the standard output of the child process.
**Example** **Example**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -110,7 +110,7 @@ Obtains the standard error output of the child process. ...@@ -110,7 +110,7 @@ Obtains the standard error output of the child process.
**Example** **Example**
``` ```js
var child = process.runCmd('madir test.text'); var child = process.runCmd('madir test.text');
var result = child.wait(); var result = child.wait();
child.getErrorOutput.then(val=>{ child.getErrorOutput.then(val=>{
...@@ -129,7 +129,7 @@ Closes the child process in running. ...@@ -129,7 +129,7 @@ Closes the child process in running.
**Example** **Example**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.close(); child.close();
``` ```
...@@ -151,7 +151,7 @@ Sends a signal to the specified child process to terminate it. ...@@ -151,7 +151,7 @@ Sends a signal to the specified child process to terminate it.
**Example** **Example**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.kill(9); child.kill(9);
``` ```
...@@ -173,7 +173,7 @@ Checks whether this process is isolated. ...@@ -173,7 +173,7 @@ Checks whether this process is isolated.
**Example** **Example**
``` ```js
var result = process.isIsolatedProcess(); var result = process.isIsolatedProcess();
``` ```
...@@ -200,7 +200,7 @@ Checks whether a UID belongs to this app. ...@@ -200,7 +200,7 @@ Checks whether a UID belongs to this app.
**Example** **Example**
``` ```js
var result = process.isAppUid(688); var result = process.isAppUid(688);
``` ```
...@@ -221,7 +221,7 @@ Checks whether this process is running in a 64-bit environment. ...@@ -221,7 +221,7 @@ Checks whether this process is running in a 64-bit environment.
**Example** **Example**
``` ```js
var ressult = process.is64Bit(); var ressult = process.is64Bit();
``` ```
...@@ -248,7 +248,7 @@ Obtains the process UID based on the process name. ...@@ -248,7 +248,7 @@ Obtains the process UID based on the process name.
**Example** **Example**
``` ```js
var pres = process.getUidForName("tool") var pres = process.getUidForName("tool")
``` ```
...@@ -275,7 +275,7 @@ Obtains the thread priority based on the specified TID. ...@@ -275,7 +275,7 @@ Obtains the thread priority based on the specified TID.
**Example** **Example**
``` ```js
var tid = process.getTid(); var tid = process.getTid();
var pres = process.getThreadPriority(tid); var pres = process.getThreadPriority(tid);
``` ```
...@@ -297,7 +297,7 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti ...@@ -297,7 +297,7 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti
**Example** **Example**
``` ```js
var realtime = process.getStartRealtime(); var realtime = process.getStartRealtime();
``` ```
...@@ -317,7 +317,7 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c ...@@ -317,7 +317,7 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c
**Example** **Example**
``` ```js
var result = process.getPastCpuTime() ; var result = process.getPastCpuTime() ;
``` ```
...@@ -344,7 +344,7 @@ Obtains the system configuration. ...@@ -344,7 +344,7 @@ Obtains the system configuration.
**Example** **Example**
``` ```js
var _SC_ARG_MAX = 0 var _SC_ARG_MAX = 0
var pres = process.getSystemConfig(_SC_ARG_MAX) var pres = process.getSystemConfig(_SC_ARG_MAX)
``` ```
...@@ -372,7 +372,7 @@ Obtains the value of an environment variable. ...@@ -372,7 +372,7 @@ Obtains the value of an environment variable.
**Example** **Example**
``` ```js
var pres = process.getEnvironmentVar("PATH") var pres = process.getEnvironmentVar("PATH")
``` ```
...@@ -408,7 +408,7 @@ Forks a new process to run a shell command and returns the **ChildProcess** obje ...@@ -408,7 +408,7 @@ Forks a new process to run a shell command and returns the **ChildProcess** obje
**Example** **Example**
``` ```js
var child = process.runCmd('ls', { maxBuffer : 2 }); var child = process.runCmd('ls', { maxBuffer : 2 });
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -427,7 +427,7 @@ Aborts a process and generates a core file. This method will cause a process to ...@@ -427,7 +427,7 @@ Aborts a process and generates a core file. This method will cause a process to
**Example** **Example**
``` ```js
process.abort(); process.abort();
``` ```
...@@ -455,7 +455,7 @@ Stores the events triggered by the user. ...@@ -455,7 +455,7 @@ Stores the events triggered by the user.
**Example** **Example**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -484,7 +484,7 @@ Deletes the event stored by the user. ...@@ -484,7 +484,7 @@ Deletes the event stored by the user.
**Example** **Example**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -510,7 +510,7 @@ Exercise caution when using this API. ...@@ -510,7 +510,7 @@ Exercise caution when using this API.
**Example** **Example**
``` ```js
process.exit(0); process.exit(0);
``` ```
...@@ -525,7 +525,7 @@ Obtains the working directory of this process. ...@@ -525,7 +525,7 @@ Obtains the working directory of this process.
**Example** **Example**
``` ```js
var path = process.cwd(); var path = process.cwd();
``` ```
...@@ -546,7 +546,7 @@ Changes the working directory of this process. ...@@ -546,7 +546,7 @@ Changes the working directory of this process.
**Example** **Example**
``` ```js
process.chdir('/system'); process.chdir('/system');
``` ```
...@@ -567,7 +567,7 @@ Obtains the running time of this process. ...@@ -567,7 +567,7 @@ Obtains the running time of this process.
**Example** **Example**
``` ```js
var time = process.uptime(); var time = process.uptime();
``` ```
...@@ -594,7 +594,7 @@ Sends a signal to the specified process to terminate it. ...@@ -594,7 +594,7 @@ Sends a signal to the specified process to terminate it.
| boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.| | boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.|
**Example** **Example**
``` ```js
var pres = process.pid var pres = process.pid
var result = that.kill(pres, 28) var result = that.kill(pres, 28)
``` ```
...@@ -46,11 +46,11 @@ A constructor used to create a URI instance. ...@@ -46,11 +46,11 @@ A constructor used to create a URI instance.
**Example** **Example**
``` ```js
var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; var 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
new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080'; new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080';
``` ```
...@@ -69,7 +69,7 @@ Obtains the query string applicable to this URL. ...@@ -69,7 +69,7 @@ Obtains the query string applicable to this URL.
**Example** **Example**
``` ```js
const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -95,7 +95,7 @@ Checks whether this URI is the same as another URI object. ...@@ -95,7 +95,7 @@ Checks whether this URI is the same as another URI object.
**Example** **Example**
``` ```js
const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment'); const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment');
uriInstance.equals(uriInstance1); uriInstance.equals(uriInstance1);
...@@ -115,7 +115,7 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi ...@@ -115,7 +115,7 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi
**Example** **Example**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp');
uriInstance.checkIsAbsolute(); uriInstance.checkIsAbsolute();
``` ```
...@@ -134,7 +134,7 @@ Normalizes the path of this URI. ...@@ -134,7 +134,7 @@ Normalizes the path of this URI.
| URI | URI with the normalized path.| | URI | URI with the normalized path.|
**Example** **Example**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp');
let uriInstance1 = uriInstance.normalize(); let uriInstance1 = uriInstance.normalize();
uriInstance1.path; uriInstance1.path;
......
...@@ -31,7 +31,7 @@ Creates a **URLSearchParams** instance. ...@@ -31,7 +31,7 @@ Creates a **URLSearchParams** instance.
**Example** **Example**
``` ```js
var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2}); var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2});
var objectParams2 = new URLSearchParams('?fod=1&bard=2'); var objectParams2 = new URLSearchParams('?fod=1&bard=2');
...@@ -55,7 +55,7 @@ Appends a key-value pair into the query string. ...@@ -55,7 +55,7 @@ Appends a key-value pair into the query string.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); paramsObject.append('fod', 3);
...@@ -76,7 +76,7 @@ Deletes key-value pairs of the specified key. ...@@ -76,7 +76,7 @@ Deletes key-value pairs of the specified key.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsobject = new URLSearchParams(urlObject.search.slice(1)); let paramsobject = new URLSearchParams(urlObject.search.slice(1));
paramsobject.delete('fod'); paramsobject.delete('fod');
...@@ -103,7 +103,7 @@ Obtains all the key-value pairs based on the specified key. ...@@ -103,7 +103,7 @@ Obtains all the key-value pairs based on the specified key.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); // Add a second value for the fod parameter. paramsObject.append('fod', 3); // Add a second value for the fod parameter.
...@@ -125,7 +125,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -125,7 +125,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Example** **Example**
``` ```js
var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2"); var searchParamsObject = new 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]);
...@@ -156,7 +156,7 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal ...@@ -156,7 +156,7 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal
**Example** **Example**
``` ```js
const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
myURLObject.searchParams.forEach((value, name, searchParams) => { myURLObject.searchParams.forEach((value, name, searchParams) => {
console.log(name, value, myURLObject.searchParams === searchParams); console.log(name, value, myURLObject.searchParams === searchParams);
...@@ -185,7 +185,7 @@ Obtains the value of the first key-value pair based on the specified key. ...@@ -185,7 +185,7 @@ Obtains the value of the first key-value pair based on the specified key.
**Example** **Example**
``` ```js
var paramsOject = new URLSearchParams(document.location.search.substring(1)); var paramsOject = new URLSearchParams(document.location.search.substring(1));
var name = paramsOject.get("name"); // is the string "Jonathan" var name = paramsOject.get("name"); // is the string "Jonathan"
var age = parseInt(paramsOject.get("age"), 10); // is the number 18 var age = parseInt(paramsOject.get("age"), 10); // is the number 18
...@@ -213,7 +213,7 @@ Checks whether a key has a value. ...@@ -213,7 +213,7 @@ Checks whether a key has a value.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.has('bard') === true; paramsObject.has('bard') === true;
...@@ -235,7 +235,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t ...@@ -235,7 +235,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.set('baz', 3); // Add a third parameter. paramsObject.set('baz', 3); // Add a third parameter.
...@@ -251,7 +251,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi ...@@ -251,7 +251,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi
**Example** **Example**
``` ```js
var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object var searchParamsObject = new 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
...@@ -273,7 +273,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs. ...@@ -273,7 +273,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs.
**Example** **Example**
``` ```js
var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParamsObject = new 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);
...@@ -295,7 +295,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs. ...@@ -295,7 +295,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs.
**Example** **Example**
``` ```js
var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParams = new 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);
...@@ -318,7 +318,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -318,7 +318,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Example** **Example**
``` ```js
const paramsObject = new URLSearchParams('fod=bay&edg=bap'); const paramsObject = new 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);
...@@ -341,7 +341,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per ...@@ -341,7 +341,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per
**Example** **Example**
``` ```js
let url = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let url = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new URLSearchParams(url.search.slice(1)); let params = new URLSearchParams(url.search.slice(1));
params.append('fod', 3); params.append('fod', 3);
...@@ -386,7 +386,7 @@ Creates a URL. ...@@ -386,7 +386,7 @@ Creates a URL.
**Example** **Example**
``` ```js
var mm = 'http://username:password@host:8080'; var mm = 'http://username:password@host:8080';
var a = new URL("/", mm); // Output 'http://username:password@host:8080/'; var a = new URL("/", mm); // Output 'http://username:password@host:8080/';
var b = new URL(mm); // Output 'http://username:password@host:8080/'; var b = new URL(mm); // Output 'http://username:password@host:8080/';
...@@ -416,7 +416,7 @@ Converts the parsed URL into a string. ...@@ -416,7 +416,7 @@ Converts the parsed URL into a string.
**Example** **Example**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -436,7 +436,7 @@ Converts the parsed URL into a JSON string. ...@@ -436,7 +436,7 @@ Converts the parsed URL into a JSON string.
| string | Website address in a serialized string.| | string | Website address in a serialized string.|
**Example** **Example**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toJSON() url.toJSON()
``` ```
...@@ -32,7 +32,7 @@ A constructor used to create an **XmlSerializer** instance. ...@@ -32,7 +32,7 @@ A constructor used to create an **XmlSerializer** instance.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); var bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
...@@ -54,7 +54,7 @@ Sets an attribute. ...@@ -54,7 +54,7 @@ Sets an attribute.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
``` ```
...@@ -74,8 +74,8 @@ Adds an empty element. ...@@ -74,8 +74,8 @@ Adds an empty element.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.addEmptyElement("b"); // => <b/> thatSer.addEmptyElement("b"); // => <b/>
``` ```
...@@ -88,7 +88,7 @@ Sets a declaration. ...@@ -88,7 +88,7 @@ Sets a declaration.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>; thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>;
``` ```
...@@ -108,7 +108,7 @@ Writes the start tag based on the given element name. ...@@ -108,7 +108,7 @@ Writes the start tag based on the given element name.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("notel"); thatSer.startElement("notel");
...@@ -124,7 +124,7 @@ Writes the end tag of the element. ...@@ -124,7 +124,7 @@ Writes the end tag of the element.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var 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");
...@@ -149,7 +149,7 @@ Sets the namespace for an element tag. ...@@ -149,7 +149,7 @@ Sets the namespace for an element tag.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDeclaration(); thatSer.setDeclaration();
...@@ -172,7 +172,7 @@ Sets the comment. ...@@ -172,7 +172,7 @@ Sets the comment.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -195,7 +195,7 @@ Sets CDATA attributes. ...@@ -195,7 +195,7 @@ Sets CDATA attributes.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1028); var arrayBuffer = new ArrayBuffer(1028);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>'; thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>';
...@@ -216,7 +216,7 @@ Sets **Text**. ...@@ -216,7 +216,7 @@ Sets **Text**.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -240,7 +240,7 @@ Sets **DocType**. ...@@ -240,7 +240,7 @@ Sets **DocType**.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>'; thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>';
...@@ -265,7 +265,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa ...@@ -265,7 +265,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa
**Example** **Example**
``` ```js
var strXml = var 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">' +
...@@ -297,7 +297,7 @@ Parses XML information. ...@@ -297,7 +297,7 @@ Parses XML information.
**Example** **Example**
``` ```js
var strXml = var 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">' +
......
...@@ -39,7 +39,7 @@ convert(xml: string, options?: ConvertOptions) : Object ...@@ -39,7 +39,7 @@ convert(xml: string, options?: ConvertOptions) : Object
- 示例: - 示例:
``` ```js
let 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">' +
......
...@@ -60,7 +60,7 @@ wait(): Promise&lt;number&gt; ...@@ -60,7 +60,7 @@ wait(): Promise&lt;number&gt;
**示例:** **示例:**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
result.then(val=>{ result.then(val=>{
...@@ -85,7 +85,7 @@ getOutput(): Promise&lt;Uint8Array&gt; ...@@ -85,7 +85,7 @@ getOutput(): Promise&lt;Uint8Array&gt;
**示例:** **示例:**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -110,7 +110,7 @@ getErrorOutput(): Promise&lt;Uint8Array&gt; ...@@ -110,7 +110,7 @@ getErrorOutput(): Promise&lt;Uint8Array&gt;
**示例:** **示例:**
``` ```js
var child = process.runCmd('madir test.text'); var child = process.runCmd('madir test.text');
var result = child.wait(); var result = child.wait();
child.getErrorOutput.then(val=>{ child.getErrorOutput.then(val=>{
...@@ -129,7 +129,7 @@ close(): void ...@@ -129,7 +129,7 @@ close(): void
**示例:** **示例:**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.close(); child.close();
``` ```
...@@ -151,7 +151,7 @@ kill(signal: number | string): void ...@@ -151,7 +151,7 @@ kill(signal: number | string): void
**示例:** **示例:**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.kill(9); child.kill(9);
``` ```
...@@ -173,7 +173,7 @@ isIsolatedProcess(): boolean ...@@ -173,7 +173,7 @@ isIsolatedProcess(): boolean
**示例:** **示例:**
``` ```js
var result = process.isIsolatedProcess(); var result = process.isIsolatedProcess();
``` ```
...@@ -200,7 +200,7 @@ isAppUid(v: number): boolean ...@@ -200,7 +200,7 @@ isAppUid(v: number): boolean
**示例:** **示例:**
``` ```js
var result = process.isAppUid(688); var result = process.isAppUid(688);
``` ```
...@@ -221,7 +221,7 @@ is64Bit(): boolean ...@@ -221,7 +221,7 @@ is64Bit(): boolean
**示例:** **示例:**
``` ```js
var ressult = process.is64Bit(); var ressult = process.is64Bit();
``` ```
...@@ -248,7 +248,7 @@ getUidForName(v: string): number ...@@ -248,7 +248,7 @@ getUidForName(v: string): number
**示例:** **示例:**
``` ```js
var pres = process.getUidForName("tool") var pres = process.getUidForName("tool")
``` ```
...@@ -275,7 +275,7 @@ getThreadPriority(v: number): number ...@@ -275,7 +275,7 @@ getThreadPriority(v: number): number
**示例:** **示例:**
``` ```js
var tid = process.getTid(); var tid = process.getTid();
var pres = process.getThreadPriority(tid); var pres = process.getThreadPriority(tid);
``` ```
...@@ -297,7 +297,7 @@ getStartRealtime(): number ...@@ -297,7 +297,7 @@ getStartRealtime(): number
**示例:** **示例:**
``` ```js
var realtime = process.getStartRealtime(); var realtime = process.getStartRealtime();
``` ```
...@@ -317,7 +317,7 @@ getPastCpuTime(): number ...@@ -317,7 +317,7 @@ getPastCpuTime(): number
**示例:** **示例:**
``` ```js
var result = process.getPastCpuTime() ; var result = process.getPastCpuTime() ;
``` ```
...@@ -344,7 +344,7 @@ getSystemConfig(name: number): number ...@@ -344,7 +344,7 @@ getSystemConfig(name: number): number
**示例:** **示例:**
``` ```js
var _SC_ARG_MAX = 0 var _SC_ARG_MAX = 0
var pres = process.getSystemConfig(_SC_ARG_MAX) var pres = process.getSystemConfig(_SC_ARG_MAX)
``` ```
...@@ -372,7 +372,7 @@ getEnvironmentVar(name: string): string ...@@ -372,7 +372,7 @@ getEnvironmentVar(name: string): string
**示例:** **示例:**
``` ```js
var pres = process.getEnvironmentVar("PATH") var pres = process.getEnvironmentVar("PATH")
``` ```
...@@ -408,7 +408,7 @@ runCmd(command: string, options?: { timeout : number, killSignal : number | stri ...@@ -408,7 +408,7 @@ runCmd(command: string, options?: { timeout : number, killSignal : number | stri
**示例:** **示例:**
``` ```js
var child = process.runCmd('ls', { maxBuffer : 2 }); var child = process.runCmd('ls', { maxBuffer : 2 });
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -427,7 +427,7 @@ abort(): void ...@@ -427,7 +427,7 @@ abort(): void
**示例:** **示例:**
``` ```js
process.abort(); process.abort();
``` ```
...@@ -455,7 +455,7 @@ on(type: string, listener: EventListener): void ...@@ -455,7 +455,7 @@ on(type: string, listener: EventListener): void
**示例:** **示例:**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -484,7 +484,7 @@ off(type: string): boolean ...@@ -484,7 +484,7 @@ off(type: string): boolean
**示例:** **示例:**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -510,7 +510,7 @@ exit(code: number): void ...@@ -510,7 +510,7 @@ exit(code: number): void
**示例:** **示例:**
``` ```js
process.exit(0); process.exit(0);
``` ```
...@@ -525,7 +525,7 @@ cwd(): string ...@@ -525,7 +525,7 @@ cwd(): string
**示例:** **示例:**
``` ```js
var path = process.cwd(); var path = process.cwd();
``` ```
...@@ -546,7 +546,7 @@ chdir(dir: string): void ...@@ -546,7 +546,7 @@ chdir(dir: string): void
**示例:** **示例:**
``` ```js
process.chdir('/system'); process.chdir('/system');
``` ```
...@@ -567,7 +567,7 @@ uptime(): number ...@@ -567,7 +567,7 @@ uptime(): number
**示例:** **示例:**
``` ```js
var time = process.uptime(); var time = process.uptime();
``` ```
...@@ -594,7 +594,8 @@ kill(signal: number, pid: number): boolean ...@@ -594,7 +594,8 @@ kill(signal: number, pid: number): boolean
| boolean | 信号是否发送成功。 | | boolean | 信号是否发送成功。 |
**示例:** **示例:**
```
```js
var pres = process.pid var pres = process.pid
var result = that.kill(pres, 28) var result = that.kill(pres, 28)
``` ```
...@@ -46,11 +46,11 @@ constructor是URI的构造函数。 ...@@ -46,11 +46,11 @@ constructor是URI的构造函数。
**示例:** **示例:**
``` ```js
var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; var 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
new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080'; new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080';
``` ```
...@@ -69,7 +69,7 @@ toString(): string ...@@ -69,7 +69,7 @@ toString(): string
**示例:** **示例:**
``` ```js
const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -95,7 +95,7 @@ equals(other: URI): boolean ...@@ -95,7 +95,7 @@ equals(other: URI): boolean
**示例:** **示例:**
``` ```js
const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment'); const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment');
uriInstance.equals(uriInstance1); uriInstance.equals(uriInstance1);
...@@ -115,7 +115,7 @@ checkIsAbsolute(): boolean ...@@ -115,7 +115,7 @@ checkIsAbsolute(): boolean
**示例:** **示例:**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp');
uriInstance.checkIsAbsolute(); uriInstance.checkIsAbsolute();
``` ```
...@@ -134,7 +134,7 @@ normalize(): URI ...@@ -134,7 +134,7 @@ normalize(): URI
| URI | 返回一个path被规范化后的URI对象。 | | URI | 返回一个path被规范化后的URI对象。 |
**示例:** **示例:**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp');
let uriInstance1 = uriInstance.normalize(); let uriInstance1 = uriInstance.normalize();
uriInstance1.path; uriInstance1.path;
......
...@@ -31,7 +31,7 @@ URLSearchParams的构造函数。 ...@@ -31,7 +31,7 @@ URLSearchParams的构造函数。
**示例:** **示例:**
``` ```js
var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2}); var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2});
var objectParams2 = new URLSearchParams('?fod=1&bard=2'); var objectParams2 = new URLSearchParams('?fod=1&bard=2');
...@@ -55,7 +55,7 @@ append(name: string, value: string): void ...@@ -55,7 +55,7 @@ append(name: string, value: string): void
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); paramsObject.append('fod', 3);
...@@ -76,7 +76,7 @@ delete(name: string): void ...@@ -76,7 +76,7 @@ delete(name: string): void
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsobject = new URLSearchParams(urlObject.search.slice(1)); let paramsobject = new URLSearchParams(urlObject.search.slice(1));
paramsobject.delete('fod'); paramsobject.delete('fod');
...@@ -103,7 +103,7 @@ getAll(name: string): string[] ...@@ -103,7 +103,7 @@ getAll(name: string): string[]
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); // Add a second value for the fod parameter. paramsObject.append('fod', 3); // Add a second value for the fod parameter.
...@@ -125,7 +125,7 @@ entries(): IterableIterator<[string, string]> ...@@ -125,7 +125,7 @@ entries(): IterableIterator<[string, string]>
**示例:** **示例:**
``` ```js
var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2"); var searchParamsObject = new 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]);
...@@ -156,7 +156,7 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th ...@@ -156,7 +156,7 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
**示例:** **示例:**
``` ```js
const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
myURLObject.searchParams.forEach((value, name, searchParams) => { myURLObject.searchParams.forEach((value, name, searchParams) => {
console.log(name, value, myURLObject.searchParams === searchParams); console.log(name, value, myURLObject.searchParams === searchParams);
...@@ -185,7 +185,7 @@ get(name: string): string | null ...@@ -185,7 +185,7 @@ get(name: string): string | null
**示例:** **示例:**
``` ```js
var paramsOject = new URLSearchParams(document.location.search.substring(1)); var paramsOject = new URLSearchParams(document.location.search.substring(1));
var name = paramsOject.get("name"); // is the string "Jonathan" var name = paramsOject.get("name"); // is the string "Jonathan"
var age = parseInt(paramsOject.get("age"), 10); // is the number 18 var age = parseInt(paramsOject.get("age"), 10); // is the number 18
...@@ -213,7 +213,7 @@ has(name: string): boolean ...@@ -213,7 +213,7 @@ has(name: string): boolean
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.has('bard') === true; paramsObject.has('bard') === true;
...@@ -235,7 +235,7 @@ set(name: string, value: string): void ...@@ -235,7 +235,7 @@ set(name: string, value: string): void
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.set('baz', 3); // Add a third parameter. paramsObject.set('baz', 3); // Add a third parameter.
...@@ -251,7 +251,7 @@ sort(): void ...@@ -251,7 +251,7 @@ sort(): void
**示例:** **示例:**
``` ```js
var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object var searchParamsObject = new 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
...@@ -273,7 +273,7 @@ keys(): IterableIterator&lt;string&gt; ...@@ -273,7 +273,7 @@ keys(): IterableIterator&lt;string&gt;
**示例:** **示例:**
``` ```js
var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParamsObject = new 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);
...@@ -295,7 +295,7 @@ values(): IterableIterator&lt;string&gt; ...@@ -295,7 +295,7 @@ values(): IterableIterator&lt;string&gt;
**示例:** **示例:**
``` ```js
var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParams = new 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);
...@@ -318,7 +318,7 @@ for (var value of searchParams.values()) { ...@@ -318,7 +318,7 @@ for (var value of searchParams.values()) {
**示例:** **示例:**
``` ```js
const paramsObject = new URLSearchParams('fod=bay&edg=bap'); const paramsObject = new 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);
...@@ -341,7 +341,7 @@ toString(): string ...@@ -341,7 +341,7 @@ toString(): string
**示例:** **示例:**
``` ```js
let url = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let url = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new URLSearchParams(url.search.slice(1)); let params = new URLSearchParams(url.search.slice(1));
params.append('fod', 3); params.append('fod', 3);
...@@ -386,7 +386,7 @@ URL的构造函数。 ...@@ -386,7 +386,7 @@ URL的构造函数。
**示例:** **示例:**
``` ```js
var mm = 'http://username:password@host:8080'; var mm = 'http://username:password@host:8080';
var a = new URL("/", mm); // Output 'http://username:password@host:8080/'; var a = new URL("/", mm); // Output 'http://username:password@host:8080/';
var b = new URL(mm); // Output 'http://username:password@host:8080/'; var b = new URL(mm); // Output 'http://username:password@host:8080/';
...@@ -416,7 +416,7 @@ toString(): string ...@@ -416,7 +416,7 @@ toString(): string
**示例:** **示例:**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -436,7 +436,7 @@ toJSON(): string ...@@ -436,7 +436,7 @@ toJSON(): string
| string | 用于返回网址的字符串序列化。 | | string | 用于返回网址的字符串序列化。 |
**示例:** **示例:**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toJSON() url.toJSON()
``` ```
...@@ -32,7 +32,7 @@ XmlSerializer的构造函数。 ...@@ -32,7 +32,7 @@ XmlSerializer的构造函数。
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); var bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
...@@ -54,7 +54,7 @@ setAttributes(name: string, value: string): void ...@@ -54,7 +54,7 @@ setAttributes(name: string, value: string): void
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
``` ```
...@@ -74,8 +74,8 @@ addEmptyElement(name: string): void ...@@ -74,8 +74,8 @@ addEmptyElement(name: string): void
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.addEmptyElement("b"); // => <b/> thatSer.addEmptyElement("b"); // => <b/>
``` ```
...@@ -88,7 +88,7 @@ setDeclaration(): void ...@@ -88,7 +88,7 @@ setDeclaration(): void
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>; thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>;
``` ```
...@@ -108,7 +108,7 @@ startElement(name: string): void ...@@ -108,7 +108,7 @@ startElement(name: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("notel"); thatSer.startElement("notel");
...@@ -124,7 +124,7 @@ endElement(): void ...@@ -124,7 +124,7 @@ endElement(): void
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var 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");
...@@ -149,7 +149,7 @@ setNamespace(prefix: string, namespace: string): void ...@@ -149,7 +149,7 @@ setNamespace(prefix: string, namespace: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDeclaration(); thatSer.setDeclaration();
...@@ -172,7 +172,7 @@ setComment(text: string): void ...@@ -172,7 +172,7 @@ setComment(text: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -195,7 +195,7 @@ setCDATA(text: string): void ...@@ -195,7 +195,7 @@ setCDATA(text: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1028); var arrayBuffer = new ArrayBuffer(1028);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>'; thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>';
...@@ -216,7 +216,7 @@ setText(text: string): void ...@@ -216,7 +216,7 @@ setText(text: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -240,7 +240,7 @@ setDocType(text: string): void ...@@ -240,7 +240,7 @@ setDocType(text: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>'; thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>';
...@@ -265,7 +265,7 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string) ...@@ -265,7 +265,7 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
**示例:** **示例:**
``` ```js
var strXml = var 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">' +
...@@ -297,7 +297,7 @@ parse(option: ParseOptions): void ...@@ -297,7 +297,7 @@ parse(option: ParseOptions): void
**示例:** **示例:**
``` ```js
var strXml = var 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">' +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册