1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkTS 19 */ 20 21/** 22 * The xml module provides utilities for converting XML text to Javascript object, XML generation and parsing. 23 * 24 * @namespace xml 25 * @syscap SystemCapability.Utils.Lang 26 * @since 8 27 */ 28/** 29 * The xml module provides utilities for converting XML text to Javascript object, XML generation and parsing. 30 * 31 * @namespace xml 32 * @syscap SystemCapability.Utils.Lang 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * The xml module provides utilities for converting XML text to Javascript object, XML generation and parsing. 38 * 39 * @namespace xml 40 * @syscap SystemCapability.Utils.Lang 41 * @crossplatform 42 * @atomicservice 43 * @since arkts {'1.1':'11', '1.2':'20'} 44 * @arkts 1.1&1.2 45 */ 46declare namespace xml { 47 /** 48 * The XmlDynamicSerializer interface is used to dynamically generate an xml file. 49 * 50 * @syscap SystemCapability.Utils.Lang 51 * @crossplatform 52 * @atomicservice 53 * @since arkts {'1.1':'20', '1.2':'20'} 54 * @arkts 1.1&1.2 55 * @name XmlDynamicSerializer 56 */ 57 class XmlDynamicSerializer { 58 /** 59 * A parameterized constructor used to create a new XmlDynamicSerializer instance. 60 * The input parameter is an encoding format of string type. 61 * 62 * @param { string } [encoding] - [encoding='utf8'] this is its encoding, only support utf-8. 63 * @throws { BusinessError } 10200066 - Incorrect encoding format, only support utf-8. 64 * @syscap SystemCapability.Utils.Lang 65 * @crossplatform 66 * @atomicservice 67 * @since arkts {'1.1':'20', '1.2':'20'} 68 * @arkts 1.1&1.2 69 */ 70 constructor(encoding?: string); 71 72 /** 73 * Write an attribute to xml element. 74 * 75 * @param { string } name - Key name of the attribute. Cannot be an empty string. 76 * @param { string } value - Values of attribute. 77 * @throws { BusinessError } 10200062 - The cumulative length of xml has exceeded the upper limit 100000. 78 * @throws { BusinessError } 10200063 - Illegal position for xml. 79 * @throws { BusinessError } 10200064 - Cannot be an empty string. 80 * @syscap SystemCapability.Utils.Lang 81 * @crossplatform 82 * @atomicservice 83 * @since arkts {'1.1':'20', '1.2':'20'} 84 * @arkts 1.1&1.2 85 */ 86 setAttributes(name: string, value: string): void; 87 88 /** 89 * Add an empty element. 90 * 91 * @param { string } name - Name of the element. 92 * @throws { BusinessError } 10200062 - The cumulative length of xml has exceeded the upper limit 100000. 93 * @throws { BusinessError } 10200064 - Cannot be an empty string. 94 * @syscap SystemCapability.Utils.Lang 95 * @crossplatform 96 * @atomicservice 97 * @since arkts {'1.1':'20', '1.2':'20'} 98 * @arkts 1.1&1.2 99 */ 100 addEmptyElement(name: string): void; 101 102 /** 103 * Writes xml declaration with encoding. For example: <?xml version="1.0" encoding="utf-8"?>. 104 * @throws { BusinessError } 10200062 - The cumulative length of xml has exceeded the upper limit 100000. 105 * @throws { BusinessError } 10200063 - Illegal position for xml. 106 * @syscap SystemCapability.Utils.Lang 107 * @crossplatform 108 * @atomicservice 109 * @since arkts {'1.1':'20', '1.2':'20'} 110 * @arkts 1.1&1.2 111 */ 112 setDeclaration(): void; 113 114 /** 115 * Writes a element start tag with the given name. 116 * 117 * @param { string } name - Name of the element. 118 * @throws { BusinessError } 10200062 - The cumulative length of xml has exceeded the upper limit 100000. 119 * @throws { BusinessError } 10200064 - Cannot be an empty string. 120 * @syscap SystemCapability.Utils.Lang 121 * @crossplatform 122 * @atomicservice 123 * @since arkts {'1.1':'20', '1.2':'20'} 124 * @arkts 1.1&1.2 125 */ 126 startElement(name: string): void; 127 128 /** 129 * Writes end tag of the element. 130 * 131 * @throws { BusinessError } 10200062 - The cumulative length of xml has exceeded the upper limit 100000. 132 * @throws { BusinessError } 10200065 - There is no match between the startElement and the endElement. 133 * @syscap SystemCapability.Utils.Lang 134 * @crossplatform 135 * @atomicservice 136 * @since arkts {'1.1':'20', '1.2':'20'} 137 * @arkts 1.1&1.2 138 */ 139 endElement(): void; 140 141 /** 142 * Writes the namespace of the current element tag. 143 * 144 * @param { string } prefix - Values name of the prefix. Cannot be an empty string. 145 * @param { string } namespace - Values of namespace. Cannot be an empty string. 146 * @throws { BusinessError } 10200062 - The cumulative length of xml has exceeded the upper limit 100000. 147 * @throws { BusinessError } 10200064 - Cannot be an empty string. 148 * @syscap SystemCapability.Utils.Lang 149 * @crossplatform 150 * @atomicservice 151 * @since arkts {'1.1':'20', '1.2':'20'} 152 * @arkts 1.1&1.2 153 */ 154 setNamespace(prefix: string, namespace: string): void; 155 156 /** 157 * Writes the comment to xml. 158 * 159 * @param { string } text - Values of comment. Cannot be an empty string. 160 * @throws { BusinessError } 10200062 - The cumulative length of xml has exceeded the upper limit 100000. 161 * @throws { BusinessError } 10200064 - Cannot be an empty string. 162 * @syscap SystemCapability.Utils.Lang 163 * @crossplatform 164 * @atomicservice 165 * @since arkts {'1.1':'20', '1.2':'20'} 166 * @arkts 1.1&1.2 167 */ 168 setComment(text: string): void; 169 170 /** 171 * Writes the CDATA. 172 * 173 * @param { string } text - Values of CDATA. Cannot be an empty string. 174 * @throws { BusinessError } 10200062 - The cumulative length of xml has exceeded the upper limit 100000. 175 * @throws { BusinessError } 10200064 - Cannot be an empty string. 176 * @syscap SystemCapability.Utils.Lang 177 * @crossplatform 178 * @atomicservice 179 * @since arkts {'1.1':'20', '1.2':'20'} 180 * @arkts 1.1&1.2 181 */ 182 setCdata(text: string): void; 183 184 /** 185 * Writes the text to xml element. 186 * 187 * @param { string } text - Values of text. Cannot be an empty string. 188 * @throws { BusinessError } 10200062 - The cumulative length of xml has exceeded the upper limit 100000. 189 * @throws { BusinessError } 10200064 - Cannot be an empty string. 190 * @syscap SystemCapability.Utils.Lang 191 * @crossplatform 192 * @atomicservice 193 * @since arkts {'1.1':'20', '1.2':'20'} 194 * @arkts 1.1&1.2 195 */ 196 setText(text: string): void; 197 198 /** 199 * Writes the DOCTYPE. 200 * 201 * @param { string } text - Values of docType. Cannot be an empty string. 202 * @throws { BusinessError } 10200062 - The cumulative length of xml has exceeded the upper limit 100000. 203 * @throws { BusinessError } 10200064 - Cannot be an empty string. 204 * @syscap SystemCapability.Utils.Lang 205 * @crossplatform 206 * @atomicservice 207 * @since arkts {'1.1':'20', '1.2':'20'} 208 * @arkts 1.1&1.2 209 */ 210 setDocType(text: string): void; 211 212 /** 213 * Get an ArrayBuffer from a XmlDynamicSerializer instance. 214 * 215 * @returns { ArrayBuffer } - Returns ArrayBuffer result from a XmlDynamicSerializer instance. 216 * @syscap SystemCapability.Utils.Lang 217 * @crossplatform 218 * @atomicservice 219 * @since arkts {'1.1':'20', '1.2':'20'} 220 * @arkts 1.1&1.2 221 */ 222 getOutput(): ArrayBuffer; 223 } 224 /** 225 * The XmlSerializer interface is used to generate an xml file. 226 * 227 * @syscap SystemCapability.Utils.Lang 228 * @since 8 229 * @name XmlSerializer 230 */ 231 /** 232 * The XmlSerializer interface is used to generate an xml file. 233 * 234 * @syscap SystemCapability.Utils.Lang 235 * @crossplatform 236 * @since 10 237 * @name XmlSerializer 238 */ 239 /** 240 * The XmlSerializer interface is used to generate an xml file. 241 * 242 * @syscap SystemCapability.Utils.Lang 243 * @crossplatform 244 * @atomicservice 245 * @since arkts {'1.1':'11', '1.2':'20'} 246 * @arkts 1.1&1.2 247 * @name XmlSerializer 248 */ 249 class XmlSerializer { 250 /** 251 * A parameterized constructor used to create a new XmlSerializer instance. 252 * As the input parameter of the constructor function, init supports three types. 253 * The input parameter is an Arrarybuffer. 254 * The input parameter is a DataView. 255 * The input parameter is an encoding format of string type. 256 * 257 * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with. 258 * @param { string } [encoding] - [encoding='utf8'] this is its encoding. 259 * @throws { BusinessError } 401 - Parameter error. Possible causes: 260 * 1.Mandatory parameters are left unspecified; 261 * 2.Incorrect parameter types; 262 * 3.Parameter verification failed. 263 * @syscap SystemCapability.Utils.Lang 264 * @since 8 265 */ 266 /** 267 * A parameterized constructor used to create a new XmlSerializer instance. 268 * As the input parameter of the constructor function, init supports three types. 269 * The input parameter is an Arrarybuffer. 270 * The input parameter is a DataView. 271 * The input parameter is an encoding format of string type. 272 * 273 * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with. 274 * @param { string } [encoding] - [encoding='utf8'] this is its encoding. 275 * @throws { BusinessError } 401 - Parameter error. Possible causes: 276 * 1.Mandatory parameters are left unspecified; 277 * 2.Incorrect parameter types; 278 * 3.Parameter verification failed. 279 * @syscap SystemCapability.Utils.Lang 280 * @crossplatform 281 * @since 10 282 */ 283 /** 284 * A constructor used to create an XmlSerializer instance. 285 * 286 * @param { ArrayBuffer | DataView } buffer - ArrayBuffer or DataView for storing the XML information to set. 287 * @param { string } [encoding] - Encoding format. The default value is 'utf-8' (the only format currently supported). 288 * @throws { BusinessError } 401 - Parameter error. Possible causes: 289 * 1.Mandatory parameters are left unspecified; 290 * 2.Incorrect parameter types; 291 * 3.Parameter verification failed. 292 * @syscap SystemCapability.Utils.Lang 293 * @crossplatform 294 * @atomicservice 295 * @since arkts {'1.1':'11', '1.2':'20'} 296 * @arkts 1.1&1.2 297 */ 298 constructor(buffer: ArrayBuffer | DataView, encoding?: string); 299 300 /** 301 * Write an attribute. 302 * 303 * @param { string } name - Key name of the attribute. 304 * @param { string } value - Values of attribute. 305 * @throws { BusinessError } 401 - Parameter error. Possible causes: 306 * 1.Mandatory parameters are left unspecified; 307 * 2.Incorrect parameter types; 308 * 3.Parameter verification failed. 309 * @syscap SystemCapability.Utils.Lang 310 * @since 8 311 */ 312 /** 313 * Write an attribute. 314 * 315 * @param { string } name - Key name of the attribute. 316 * @param { string } value - Values of attribute. 317 * @throws { BusinessError } 401 - Parameter error. Possible causes: 318 * 1.Mandatory parameters are left unspecified; 319 * 2.Incorrect parameter types; 320 * 3.Parameter verification failed. 321 * @syscap SystemCapability.Utils.Lang 322 * @crossplatform 323 * @since 10 324 */ 325 /** 326 * Sets an attribute. 327 * 328 * @param { string } name - Key of the attribute. 329 * @param { string } value - Value of the attribute. 330 * @throws { BusinessError } 401 - Parameter error. Possible causes: 331 * 1.Mandatory parameters are left unspecified; 332 * 2.Incorrect parameter types; 3.Parameter verification failed. 333 * @syscap SystemCapability.Utils.Lang 334 * @crossplatform 335 * @atomicservice 336 * @since arkts {'1.1':'11', '1.2':'20'} 337 * @arkts 1.1&1.2 338 */ 339 setAttributes(name: string, value: string): void; 340 341 /** 342 * Add an empty element. 343 * 344 * @param { string } name - Key name of the attribute. 345 * @throws { BusinessError } 401 - Parameter error. Possible causes: 346 * 1.Mandatory parameters are left unspecified; 347 * 2.Incorrect parameter types; 348 * 3.Parameter verification failed. 349 * @syscap SystemCapability.Utils.Lang 350 * @since 8 351 */ 352 /** 353 * Add an empty element. 354 * 355 * @param { string } name - Key name of the attribute. 356 * @throws { BusinessError } 401 - Parameter error. Possible causes: 357 * 1.Mandatory parameters are left unspecified; 358 * 2.Incorrect parameter types; 359 * 3.Parameter verification failed. 360 * @syscap SystemCapability.Utils.Lang 361 * @crossplatform 362 * @since 10 363 */ 364 /** 365 * Adds an empty element. 366 * 367 * @param { string } name - Name of the empty element to add. 368 * @throws { BusinessError } 401 - Parameter error. Possible causes: 369 * 1.Mandatory parameters are left unspecified; 370 * 2.Incorrect parameter types; 371 * 3.Parameter verification failed. 372 * @syscap SystemCapability.Utils.Lang 373 * @crossplatform 374 * @atomicservice 375 * @since arkts {'1.1':'11', '1.2':'20'} 376 * @arkts 1.1&1.2 377 */ 378 addEmptyElement(name: string): void; 379 380 /** 381 * Writes xml declaration with encoding. For example: <?xml version="1.0" encoding="utf-8"?>. 382 * 383 * @syscap SystemCapability.Utils.Lang 384 * @since 8 385 */ 386 /** 387 * Writes xml declaration with encoding. For example: <?xml version="1.0" encoding="utf-8"?>. 388 * 389 * @syscap SystemCapability.Utils.Lang 390 * @crossplatform 391 * @since 10 392 */ 393 /** 394 * Sets a file declaration with encoding. 395 * 396 * @syscap SystemCapability.Utils.Lang 397 * @crossplatform 398 * @atomicservice 399 * @since arkts {'1.1':'11', '1.2':'20'} 400 * @arkts 1.1&1.2 401 */ 402 setDeclaration(): void; 403 404 /** 405 * Writes a element start tag with the given name. 406 * 407 * @param { string } name - Name of the element. 408 * @throws { BusinessError } 401 - Parameter error. Possible causes: 409 * 1.Mandatory parameters are left unspecified; 410 * 2.Incorrect parameter types; 411 * 3.Parameter verification failed. 412 * @syscap SystemCapability.Utils.Lang 413 * @since 8 414 */ 415 /** 416 * Writes a element start tag with the given name. 417 * 418 * @param { string } name - Name of the element. 419 * @throws { BusinessError } 401 - Parameter error. Possible causes: 420 * 1.Mandatory parameters are left unspecified; 421 * 2.Incorrect parameter types; 422 * 3.Parameter verification failed. 423 * @syscap SystemCapability.Utils.Lang 424 * @crossplatform 425 * @since 10 426 */ 427 /** 428 * Writes the start tag based on the given element name. 429 * 430 * @param { string } name - Name of the element. 431 * @throws { BusinessError } 401 - Parameter error. Possible causes: 432 * 1.Mandatory parameters are left unspecified; 433 * 2.Incorrect parameter types; 434 * 3.Parameter verification failed. 435 * @syscap SystemCapability.Utils.Lang 436 * @crossplatform 437 * @atomicservice 438 * @since arkts {'1.1':'11', '1.2':'20'} 439 * @arkts 1.1&1.2 440 */ 441 startElement(name: string): void; 442 443 /** 444 * Writes end tag of the element. 445 * 446 * @syscap SystemCapability.Utils.Lang 447 * @since 8 448 */ 449 /** 450 * Writes end tag of the element. 451 * 452 * @syscap SystemCapability.Utils.Lang 453 * @crossplatform 454 * @since 10 455 */ 456 /** 457 * Writes the end tag of the element. 458 * 459 * @syscap SystemCapability.Utils.Lang 460 * @crossplatform 461 * @atomicservice 462 * @since arkts {'1.1':'11', '1.2':'20'} 463 * @arkts 1.1&1.2 464 */ 465 endElement(): void; 466 467 /** 468 * Writes the namespace of the current element tag. 469 * 470 * @param { string } prefix - Values name of the prefix. 471 * @param { string } namespace - Values of namespace. 472 * @throws { BusinessError } 401 - Parameter error. Possible causes: 473 * 1.Mandatory parameters are left unspecified; 474 * 2.Incorrect parameter types; 475 * 3.Parameter verification failed. 476 * @syscap SystemCapability.Utils.Lang 477 * @since 8 478 */ 479 /** 480 * Writes the namespace of the current element tag. 481 * 482 * @param { string } prefix - Values name of the prefix. 483 * @param { string } namespace - Values of namespace. 484 * @throws { BusinessError } 401 - Parameter error. Possible causes: 485 * 1.Mandatory parameters are left unspecified; 486 * 2.Incorrect parameter types; 487 * 3.Parameter verification failed. 488 * @syscap SystemCapability.Utils.Lang 489 * @crossplatform 490 * @since 10 491 */ 492 /** 493 * Sets the namespace for an element tag. 494 * 495 * @param { string } prefix - Prefix of the element and its child elements. 496 * @param { string } namespace - Namespace to set. 497 * @throws { BusinessError } 401 - Parameter error. Possible causes: 498 * 1.Mandatory parameters are left unspecified; 499 * 2.Incorrect parameter types; 500 * 3.Parameter verification failed. 501 * @syscap SystemCapability.Utils.Lang 502 * @crossplatform 503 * @atomicservice 504 * @since arkts {'1.1':'11', '1.2':'20'} 505 * @arkts 1.1&1.2 506 */ 507 setNamespace(prefix: string, namespace: string): void; 508 509 /** 510 * Writes the comment. 511 * 512 * @param { string } text - Values of comment. 513 * @throws { BusinessError } 401 - Parameter error. Possible causes: 514 * 1.Mandatory parameters are left unspecified; 515 * 2.Incorrect parameter types; 516 * 3.Parameter verification failed. 517 * @syscap SystemCapability.Utils.Lang 518 * @since 8 519 */ 520 /** 521 * Writes the comment. 522 * 523 * @param { string } text - Values of comment. 524 * @throws { BusinessError } 401 - Parameter error. Possible causes: 525 * 1.Mandatory parameters are left unspecified; 526 * 2.Incorrect parameter types; 527 * 3.Parameter verification failed. 528 * @syscap SystemCapability.Utils.Lang 529 * @crossplatform 530 * @since 10 531 */ 532 /** 533 * Sets a comment. 534 * 535 * @param { string } text - Comment to set. 536 * @throws { BusinessError } 401 - Parameter error. Possible causes: 537 * 1.Mandatory parameters are left unspecified; 538 * 2.Incorrect parameter types; 539 * 3.Parameter verification failed. 540 * @syscap SystemCapability.Utils.Lang 541 * @crossplatform 542 * @atomicservice 543 * @since arkts {'1.1':'11', '1.2':'20'} 544 * @arkts 1.1&1.2 545 */ 546 setComment(text: string): void; 547 548 /** 549 * Writes the CDATA. 550 * 551 * @param { string } text - Values of CDATA. 552 * @throws { BusinessError } 401 - Parameter error. Possible causes: 553 * 1.Mandatory parameters are left unspecified; 554 * 2.Incorrect parameter types; 555 * 3.Parameter verification failed. 556 * @syscap SystemCapability.Utils.Lang 557 * @since 8 558 */ 559 /** 560 * Writes the CDATA. 561 * 562 * @param { string } text - Values of CDATA. 563 * @throws { BusinessError } 401 - Parameter error. Possible causes: 564 * 1.Mandatory parameters are left unspecified; 565 * 2.Incorrect parameter types; 566 * 3.Parameter verification failed. 567 * @syscap SystemCapability.Utils.Lang 568 * @crossplatform 569 * @since 10 570 */ 571 /** 572 * Adds data to the CDATA tag. The structure of the generated CDATA tag is "<! <![CDATA["+ Data added + "]]>". 573 * 574 * @param { string } text - CDATA data to set. 575 * @throws { BusinessError } 401 - Parameter error. Possible causes: 576 * 1.Mandatory parameters are left unspecified; 577 * 2.Incorrect parameter types; 578 * 3.Parameter verification failed. 579 * @syscap SystemCapability.Utils.Lang 580 * @crossplatform 581 * @atomicservice 582 * @since arkts {'1.1':'11', '1.2':'20'} 583 * @arkts 1.1&1.2 584 */ 585 setCDATA(text: string): void; 586 587 /** 588 * Writes the text. 589 * 590 * @param { string } text - Values of text. 591 * @throws { BusinessError } 401 - Parameter error. Possible causes: 592 * 1.Mandatory parameters are left unspecified; 593 * 2.Incorrect parameter types; 594 * 3.Parameter verification failed. 595 * @syscap SystemCapability.Utils.Lang 596 * @since 8 597 */ 598 /** 599 * Writes the text. 600 * 601 * @param { string } text - Values of text. 602 * @throws { BusinessError } 401 - Parameter error. Possible causes: 603 * 1.Mandatory parameters are left unspecified; 604 * 2.Incorrect parameter types; 605 * 3.Parameter verification failed. 606 * @syscap SystemCapability.Utils.Lang 607 * @crossplatform 608 * @since 10 609 */ 610 /** 611 * Sets a tag value. 612 * 613 * @param { string } text - Tag value to set, which is the content of the text attribute. 614 * @throws { BusinessError } 401 - Parameter error. Possible causes: 615 * 1.Mandatory parameters are left unspecified; 616 * 2.Incorrect parameter types; 617 * 3.Parameter verification failed. 618 * @syscap SystemCapability.Utils.Lang 619 * @crossplatform 620 * @atomicservice 621 * @since arkts {'1.1':'11', '1.2':'20'} 622 * @arkts 1.1&1.2 623 */ 624 setText(text: string): void; 625 626 /** 627 * Writes the DOCTYPE. 628 * 629 * @param { string } text - Values of docType. 630 * @throws { BusinessError } 401 - Parameter error. Possible causes: 631 * 1.Mandatory parameters are left unspecified; 632 * 2.Incorrect parameter types; 633 * 3.Parameter verification failed. 634 * @syscap SystemCapability.Utils.Lang 635 * @since 8 636 */ 637 /** 638 * Writes the DOCTYPE. 639 * 640 * @param { string } text - Values of docType. 641 * @throws { BusinessError } 401 - Parameter error. Possible causes: 642 * 1.Mandatory parameters are left unspecified; 643 * 2.Incorrect parameter types; 644 * 3.Parameter verification failed. 645 * @syscap SystemCapability.Utils.Lang 646 * @crossplatform 647 * @since 10 648 */ 649 /** 650 * Sets a document type. 651 * 652 * @param { string } text - Content of DocType to set. 653 * @throws { BusinessError } 401 - Parameter error. Possible causes: 654 * 1.Mandatory parameters are left unspecified; 655 * 2.Incorrect parameter types; 656 * 3.Parameter verification failed. 657 * @syscap SystemCapability.Utils.Lang 658 * @crossplatform 659 * @atomicservice 660 * @since arkts {'1.1':'11', '1.2':'20'} 661 * @arkts 1.1&1.2 662 */ 663 setDocType(text: string): void; 664 } 665 666 /** 667 * The event types represented by XML elements. 668 * 669 * @enum { number } 670 * @syscap SystemCapability.Utils.Lang 671 * @since 8 672 */ 673 /** 674 * The event types represented by XML elements. 675 * 676 * @enum { number } 677 * @syscap SystemCapability.Utils.Lang 678 * @crossplatform 679 * @since 10 680 */ 681 /** 682 * The event types represented by XML elements. 683 * 684 * @enum { number } 685 * @syscap SystemCapability.Utils.Lang 686 * @crossplatform 687 * @atomicservice 688 * @since arkts {'1.1':'11', '1.2':'20'} 689 * @arkts 1.1&1.2 690 */ 691 enum EventType { 692 /** 693 * Start a document. 694 * 695 * @syscap SystemCapability.Utils.Lang 696 * @since 8 697 */ 698 /** 699 * Start a document. 700 * 701 * @syscap SystemCapability.Utils.Lang 702 * @crossplatform 703 * @since 10 704 */ 705 /** 706 * Start a document. 707 * 708 * @syscap SystemCapability.Utils.Lang 709 * @crossplatform 710 * @atomicservice 711 * @since arkts {'1.1':'11', '1.2':'20'} 712 * @arkts 1.1&1.2 713 */ 714 START_DOCUMENT, 715 /** 716 * End a document. 717 * 718 * @syscap SystemCapability.Utils.Lang 719 * @since 8 720 */ 721 /** 722 * End a document. 723 * 724 * @syscap SystemCapability.Utils.Lang 725 * @crossplatform 726 * @since 10 727 */ 728 /** 729 * End a document. 730 * 731 * @syscap SystemCapability.Utils.Lang 732 * @crossplatform 733 * @atomicservice 734 * @since arkts {'1.1':'11', '1.2':'20'} 735 * @arkts 1.1&1.2 736 */ 737 END_DOCUMENT, 738 /** 739 * Start a tag. 740 * 741 * @syscap SystemCapability.Utils.Lang 742 * @since 8 743 */ 744 /** 745 * Start a tag. 746 * 747 * @syscap SystemCapability.Utils.Lang 748 * @crossplatform 749 * @since 10 750 */ 751 /** 752 * Start a tag. 753 * 754 * @syscap SystemCapability.Utils.Lang 755 * @crossplatform 756 * @atomicservice 757 * @since arkts {'1.1':'11', '1.2':'20'} 758 * @arkts 1.1&1.2 759 */ 760 START_TAG, 761 /** 762 * End a tag. 763 * 764 * @syscap SystemCapability.Utils.Lang 765 * @since 8 766 */ 767 /** 768 * End a tag. 769 * 770 * @syscap SystemCapability.Utils.Lang 771 * @crossplatform 772 * @since 10 773 */ 774 /** 775 * End a tag. 776 * 777 * @syscap SystemCapability.Utils.Lang 778 * @crossplatform 779 * @atomicservice 780 * @since arkts {'1.1':'11', '1.2':'20'} 781 * @arkts 1.1&1.2 782 */ 783 END_TAG, 784 /** 785 * Character data. 786 * 787 * @syscap SystemCapability.Utils.Lang 788 * @since 8 789 */ 790 /** 791 * Character data. 792 * 793 * @syscap SystemCapability.Utils.Lang 794 * @crossplatform 795 * @since 10 796 */ 797 /** 798 * Character data. 799 * 800 * @syscap SystemCapability.Utils.Lang 801 * @crossplatform 802 * @atomicservice 803 * @since arkts {'1.1':'11', '1.2':'20'} 804 * @arkts 1.1&1.2 805 */ 806 TEXT, 807 /** 808 * A CDATA sections. 809 * 810 * @syscap SystemCapability.Utils.Lang 811 * @since 8 812 */ 813 /** 814 * A CDATA sections. 815 * 816 * @syscap SystemCapability.Utils.Lang 817 * @crossplatform 818 * @since 10 819 */ 820 /** 821 * A CDATA sections. 822 * 823 * @syscap SystemCapability.Utils.Lang 824 * @crossplatform 825 * @atomicservice 826 * @since arkts {'1.1':'11', '1.2':'20'} 827 * @arkts 1.1&1.2 828 */ 829 CDSECT, 830 /** 831 * An XML comment. 832 * 833 * @syscap SystemCapability.Utils.Lang 834 * @since 8 835 */ 836 /** 837 * An XML comment. 838 * 839 * @syscap SystemCapability.Utils.Lang 840 * @crossplatform 841 * @since 10 842 */ 843 /** 844 * An XML comment. 845 * 846 * @syscap SystemCapability.Utils.Lang 847 * @crossplatform 848 * @atomicservice 849 * @since arkts {'1.1':'11', '1.2':'20'} 850 * @arkts 1.1&1.2 851 */ 852 COMMENT, 853 /** 854 * An XML document type declaration. 855 * 856 * @syscap SystemCapability.Utils.Lang 857 * @since 8 858 */ 859 /** 860 * An XML document type declaration. 861 * 862 * @syscap SystemCapability.Utils.Lang 863 * @crossplatform 864 * @since 10 865 */ 866 /** 867 * An XML document type declaration. 868 * 869 * @syscap SystemCapability.Utils.Lang 870 * @crossplatform 871 * @atomicservice 872 * @since arkts {'1.1':'11', '1.2':'20'} 873 * @arkts 1.1&1.2 874 */ 875 DOCDECL, 876 /** 877 * An XML processing instruction declaration. 878 * 879 * @syscap SystemCapability.Utils.Lang 880 * @since 8 881 */ 882 /** 883 * An XML processing instruction declaration. 884 * 885 * @syscap SystemCapability.Utils.Lang 886 * @crossplatform 887 * @since 10 888 */ 889 /** 890 * An XML processing instruction declaration. 891 * 892 * @syscap SystemCapability.Utils.Lang 893 * @crossplatform 894 * @atomicservice 895 * @since arkts {'1.1':'11', '1.2':'20'} 896 * @arkts 1.1&1.2 897 */ 898 INSTRUCTION, 899 /** 900 * An entity reference. 901 * 902 * @syscap SystemCapability.Utils.Lang 903 * @since 8 904 */ 905 /** 906 * An entity reference. 907 * 908 * @syscap SystemCapability.Utils.Lang 909 * @crossplatform 910 * @since 10 911 */ 912 /** 913 * An entity reference. 914 * 915 * @syscap SystemCapability.Utils.Lang 916 * @crossplatform 917 * @atomicservice 918 * @since arkts {'1.1':'11', '1.2':'20'} 919 * @arkts 1.1&1.2 920 */ 921 ENTITY_REFERENCE, 922 /** 923 * A whitespace. 924 * 925 * @syscap SystemCapability.Utils.Lang 926 * @since 8 927 */ 928 /** 929 * A whitespace. 930 * 931 * @syscap SystemCapability.Utils.Lang 932 * @crossplatform 933 * @since 10 934 */ 935 /** 936 * A whitespace. 937 * 938 * @syscap SystemCapability.Utils.Lang 939 * @crossplatform 940 * @atomicservice 941 * @since arkts {'1.1':'11', '1.2':'20'} 942 * @arkts 1.1&1.2 943 */ 944 WHITESPACE 945 } 946 947 /** 948 * The current parse info. 949 * 950 * @typedef ParseInfo 951 * @syscap SystemCapability.Utils.Lang 952 * @since 8 953 */ 954 /** 955 * The current parse info. 956 * 957 * @typedef ParseInfo 958 * @syscap SystemCapability.Utils.Lang 959 * @crossplatform 960 * @since 10 961 */ 962 /** 963 * The current parse info. 964 * 965 * @typedef ParseInfo 966 * @syscap SystemCapability.Utils.Lang 967 * @crossplatform 968 * @atomicservice 969 * @since arkts {'1.1':'11', '1.2':'20'} 970 * @arkts 1.1&1.2 971 */ 972 interface ParseInfo { 973 /** 974 * The current column number, starting from 1. 975 * 976 * @returns { number } 977 * @syscap SystemCapability.Utils.Lang 978 * @since 8 979 */ 980 /** 981 * The current column number, starting from 1. 982 * 983 * @returns { number } 984 * @syscap SystemCapability.Utils.Lang 985 * @crossplatform 986 * @since 10 987 */ 988 /** 989 * Obtains the current column number, starting from 1. 990 * 991 * @returns { number } 992 * @syscap SystemCapability.Utils.Lang 993 * @crossplatform 994 * @atomicservice 995 * @since arkts {'1.1':'11', '1.2':'20'} 996 * @arkts 1.1&1.2 997 */ 998 getColumnNumber(): number; 999 /** 1000 * The current depth of the element. 1001 * 1002 * @returns { number } 1003 * @syscap SystemCapability.Utils.Lang 1004 * @since 8 1005 */ 1006 /** 1007 * The current depth of the element. 1008 * 1009 * @returns { number } 1010 * @syscap SystemCapability.Utils.Lang 1011 * @crossplatform 1012 * @since 10 1013 */ 1014 /** 1015 * Obtains the depth of this element. 1016 * 1017 * @returns { number } 1018 * @syscap SystemCapability.Utils.Lang 1019 * @crossplatform 1020 * @atomicservice 1021 * @since arkts {'1.1':'11', '1.2':'20'} 1022 * @arkts 1.1&1.2 1023 */ 1024 getDepth(): number; 1025 /** 1026 * The current line number, starting from 1. 1027 * 1028 * @returns { number } 1029 * @syscap SystemCapability.Utils.Lang 1030 * @since 8 1031 */ 1032 /** 1033 * The current line number, starting from 1. 1034 * 1035 * @returns { number } 1036 * @syscap SystemCapability.Utils.Lang 1037 * @crossplatform 1038 * @since 10 1039 */ 1040 /** 1041 * Obtains the current line number, starting from 1. 1042 * 1043 * @returns { number } 1044 * @syscap SystemCapability.Utils.Lang 1045 * @crossplatform 1046 * @atomicservice 1047 * @since arkts {'1.1':'11', '1.2':'20'} 1048 * @arkts 1.1&1.2 1049 */ 1050 getLineNumber(): number; 1051 /** 1052 * The current element's name. 1053 * 1054 * @returns { string } 1055 * @syscap SystemCapability.Utils.Lang 1056 * @since 8 1057 */ 1058 /** 1059 * The current element's name. 1060 * 1061 * @returns { string } 1062 * @syscap SystemCapability.Utils.Lang 1063 * @crossplatform 1064 * @since 10 1065 */ 1066 /** 1067 * Obtains the name of this element. 1068 * 1069 * @returns { string } 1070 * @syscap SystemCapability.Utils.Lang 1071 * @crossplatform 1072 * @atomicservice 1073 * @since arkts {'1.1':'11', '1.2':'20'} 1074 * @arkts 1.1&1.2 1075 */ 1076 getName(): string; 1077 /** 1078 * The current element's namespace. 1079 * 1080 * @returns { string } 1081 * @syscap SystemCapability.Utils.Lang 1082 * @since 8 1083 */ 1084 /** 1085 * The current element's namespace. 1086 * 1087 * @returns { string } 1088 * @syscap SystemCapability.Utils.Lang 1089 * @crossplatform 1090 * @since 10 1091 */ 1092 /** 1093 * Obtains the namespace of this element. 1094 * 1095 * @returns { string } 1096 * @syscap SystemCapability.Utils.Lang 1097 * @crossplatform 1098 * @atomicservice 1099 * @since arkts {'1.1':'11', '1.2':'20'} 1100 * @arkts 1.1&1.2 1101 */ 1102 getNamespace(): string; 1103 /** 1104 * The current element's prefix. 1105 * 1106 * @returns { string } 1107 * @syscap SystemCapability.Utils.Lang 1108 * @since 8 1109 */ 1110 /** 1111 * The current element's prefix. 1112 * 1113 * @returns { string } 1114 * @syscap SystemCapability.Utils.Lang 1115 * @crossplatform 1116 * @since 10 1117 */ 1118 /** 1119 * Obtains the prefix of this element. 1120 * 1121 * @returns { string } 1122 * @syscap SystemCapability.Utils.Lang 1123 * @crossplatform 1124 * @atomicservice 1125 * @since arkts {'1.1':'11', '1.2':'20'} 1126 * @arkts 1.1&1.2 1127 */ 1128 getPrefix(): string; 1129 /** 1130 * The text content of the current event as String. 1131 * 1132 * @returns { string } 1133 * @syscap SystemCapability.Utils.Lang 1134 * @since 8 1135 */ 1136 /** 1137 * The text content of the current event as String. 1138 * 1139 * @returns { string } 1140 * @syscap SystemCapability.Utils.Lang 1141 * @crossplatform 1142 * @since 10 1143 */ 1144 /** 1145 * Obtains the text of the current event. 1146 * 1147 * @returns { string } 1148 * @syscap SystemCapability.Utils.Lang 1149 * @crossplatform 1150 * @atomicservice 1151 * @since arkts {'1.1':'11', '1.2':'20'} 1152 * @arkts 1.1&1.2 1153 */ 1154 getText(): string; 1155 /** 1156 * Returns true if the current element is empty. 1157 * 1158 * @returns { boolean } 1159 * @syscap SystemCapability.Utils.Lang 1160 * @since 8 1161 */ 1162 /** 1163 * Returns true if the current element is empty. 1164 * 1165 * @returns { boolean } 1166 * @syscap SystemCapability.Utils.Lang 1167 * @crossplatform 1168 * @since 10 1169 */ 1170 /** 1171 * Checks whether the current element is empty. 1172 * 1173 * @returns { boolean } 1174 * @syscap SystemCapability.Utils.Lang 1175 * @crossplatform 1176 * @atomicservice 1177 * @since arkts {'1.1':'11', '1.2':'20'} 1178 * @arkts 1.1&1.2 1179 */ 1180 isEmptyElementTag(): boolean; 1181 /** 1182 * Checks whether the current TEXT event contains only whitespace characters. 1183 * 1184 * @returns { boolean } 1185 * @syscap SystemCapability.Utils.Lang 1186 * @since 8 1187 */ 1188 /** 1189 * Checks whether the current TEXT event contains only whitespace characters. 1190 * 1191 * @returns { boolean } 1192 * @syscap SystemCapability.Utils.Lang 1193 * @crossplatform 1194 * @since 10 1195 */ 1196 /** 1197 * Checks whether the current event contains only whitespace characters. 1198 * 1199 * @returns { boolean } 1200 * @syscap SystemCapability.Utils.Lang 1201 * @crossplatform 1202 * @atomicservice 1203 * @since arkts {'1.1':'11', '1.2':'20'} 1204 * @arkts 1.1&1.2 1205 */ 1206 isWhitespace(): boolean; 1207 /** 1208 * Returns the number of attributes of the current start tag. 1209 * 1210 * @returns { number } 1211 * @syscap SystemCapability.Utils.Lang 1212 * @since 8 1213 */ 1214 /** 1215 * Returns the number of attributes of the current start tag. 1216 * 1217 * @returns { number } 1218 * @syscap SystemCapability.Utils.Lang 1219 * @crossplatform 1220 * @since 10 1221 */ 1222 /** 1223 * Obtains the number of attributes for the current start tag. 1224 * 1225 * @returns { number } 1226 * @syscap SystemCapability.Utils.Lang 1227 * @crossplatform 1228 * @atomicservice 1229 * @since arkts {'1.1':'11', '1.2':'20'} 1230 * @arkts 1.1&1.2 1231 */ 1232 getAttributeCount(): number; 1233 } 1234 1235 /** 1236 * Parse options for XmlPullParser. 1237 * 1238 * @typedef ParseOptions 1239 * @syscap SystemCapability.Utils.Lang 1240 * @since 8 1241 */ 1242 /** 1243 * Parse options for XmlPullParser. 1244 * 1245 * @typedef ParseOptions 1246 * @syscap SystemCapability.Utils.Lang 1247 * @crossplatform 1248 * @since 10 1249 */ 1250 /** 1251 * Parse options for XmlPullParser. 1252 * 1253 * @typedef ParseOptions 1254 * @syscap SystemCapability.Utils.Lang 1255 * @crossplatform 1256 * @atomicservice 1257 * @since arkts {'1.1':'11', '1.2':'20'} 1258 * @arkts 1.1&1.2 1259 */ 1260 interface ParseOptions { 1261 /** 1262 * Whether to parsing Doctype of the elements. 1263 * 1264 * @type { ?boolean } 1265 * @syscap SystemCapability.Utils.Lang 1266 * @since 8 1267 */ 1268 /** 1269 * Whether to parsing Doctype of the elements. 1270 * 1271 * @type { ?boolean } 1272 * @syscap SystemCapability.Utils.Lang 1273 * @crossplatform 1274 * @since 10 1275 */ 1276 /** 1277 * Whether to parsing Doctype of the elements. 1278 * 1279 * @type { ?boolean } 1280 * @syscap SystemCapability.Utils.Lang 1281 * @crossplatform 1282 * @atomicservice 1283 * @since arkts {'1.1':'11', '1.2':'20'} 1284 * @arkts 1.1&1.2 1285 */ 1286 supportDoctype?: boolean; 1287 1288 /** 1289 * Whether to ignore parsing texts of the elements. 1290 * 1291 * @type { ?boolean } 1292 * @syscap SystemCapability.Utils.Lang 1293 * @since 8 1294 */ 1295 /** 1296 * Whether to ignore parsing texts of the elements. 1297 * 1298 * @type { ?boolean } 1299 * @syscap SystemCapability.Utils.Lang 1300 * @crossplatform 1301 * @since 10 1302 */ 1303 /** 1304 * Whether to ignore parsing texts of the elements. 1305 * 1306 * @type { ?boolean } 1307 * @syscap SystemCapability.Utils.Lang 1308 * @crossplatform 1309 * @atomicservice 1310 * @since arkts {'1.1':'11', '1.2':'20'} 1311 * @arkts 1.1&1.2 1312 */ 1313 ignoreNameSpace?: boolean; 1314 1315 /** 1316 * Tag value callback function. 1317 * 1318 * @type { ?function } 1319 * @syscap SystemCapability.Utils.Lang 1320 * @since 8 1321 */ 1322 /** 1323 * Tag value callback function. 1324 * 1325 * @type { ?function } 1326 * @syscap SystemCapability.Utils.Lang 1327 * @crossplatform 1328 * @since 10 1329 */ 1330 /** 1331 * Tag value callback function. 1332 * 1333 * @type { ?function } 1334 * @syscap SystemCapability.Utils.Lang 1335 * @crossplatform 1336 * @atomicservice 1337 * @since arkts {'1.1':'11', '1.2':'20'} 1338 * @arkts 1.1&1.2 1339 */ 1340 tagValueCallbackFunction?: (name: string, value: string) => boolean; 1341 1342 /** 1343 * Attribute value callback function. 1344 * 1345 * @type { ?function } 1346 * @syscap SystemCapability.Utils.Lang 1347 * @since 8 1348 */ 1349 /** 1350 * Attribute value callback function. 1351 * 1352 * @type { ?function } 1353 * @syscap SystemCapability.Utils.Lang 1354 * @crossplatform 1355 * @since 10 1356 */ 1357 /** 1358 * Attribute value callback function. 1359 * 1360 * @type { ?function } 1361 * @syscap SystemCapability.Utils.Lang 1362 * @crossplatform 1363 * @atomicservice 1364 * @since arkts {'1.1':'11', '1.2':'20'} 1365 * @arkts 1.1&1.2 1366 */ 1367 attributeValueCallbackFunction?: (name: string, value: string) => boolean; 1368 1369 /** 1370 * Token value callback function. 1371 * 1372 * @type { ?function } 1373 * @syscap SystemCapability.Utils.Lang 1374 * @since 8 1375 */ 1376 /** 1377 * Token value callback function. 1378 * 1379 * @type { ?function } 1380 * @syscap SystemCapability.Utils.Lang 1381 * @crossplatform 1382 * @since 10 1383 */ 1384 /** 1385 * Token value callback function. 1386 * 1387 * @type { ?function } 1388 * @syscap SystemCapability.Utils.Lang 1389 * @crossplatform 1390 * @atomicservice 1391 * @since arkts {'1.1':'11', '1.2':'20'} 1392 * @arkts 1.1&1.2 1393 */ 1394 tokenValueCallbackFunction?: (eventType: EventType, value: ParseInfo) => boolean; 1395 1396 /** 1397 * Attribute value and tag callback function. 1398 * 1399 * @type { ?AttributeWithTagCb } 1400 * @syscap SystemCapability.Utils.Lang 1401 * @crossplatform 1402 * @atomicservice 1403 * @since 20 1404 */ 1405 attributeWithTagCallbackFunction?: AttributeWithTagCb; 1406 } 1407 1408 /** 1409 * The type of ParseOptions attributeWithTagCallbackFunction. 1410 * 1411 * @typedef { function } AttributeWithTagCb 1412 * @param { string } tagName - The tag in xml parse node 1413 * @param { string } key - The key in xml parse node 1414 * @param { string } value - The value in xml parse node 1415 * @returns { boolean } - whether continue to parse xml data 1416 * @syscap SystemCapability.Utils.Lang 1417 * @atomicservice 1418 * @since 20 1419 */ 1420 type AttributeWithTagCb = (tagName: string, key: string, value: string) => boolean; 1421 1422 /** 1423 * The XmlPullParser interface is used to parse the existing xml file. 1424 * 1425 * @syscap SystemCapability.Utils.Lang 1426 * @since 8 1427 * @name XmlPullParser 1428 */ 1429 /** 1430 * The XmlPullParser interface is used to parse the existing xml file. 1431 * 1432 * @syscap SystemCapability.Utils.Lang 1433 * @crossplatform 1434 * @since 10 1435 * @name XmlPullParser 1436 */ 1437 /** 1438 * The XmlPullParser interface is used to parse the existing xml file. 1439 * 1440 * @syscap SystemCapability.Utils.Lang 1441 * @crossplatform 1442 * @atomicservice 1443 * @since arkts {'1.1':'11', '1.2':'20'} 1444 * @arkts 1.1&1.2 1445 * @name XmlPullParser 1446 */ 1447 class XmlPullParser { 1448 /** 1449 * A constructor used to create a new XmlPullParser instance. 1450 * 1451 * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with. 1452 * @param { string } [encoding] - [encoding='utf8'] this is its encoding. 1453 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1454 * 1.Mandatory parameters are left unspecified; 1455 * 2.Incorrect parameter types; 1456 * 3.Parameter verification failed. 1457 * @syscap SystemCapability.Utils.Lang 1458 * @since 8 1459 */ 1460 /** 1461 * A constructor used to create a new XmlPullParser instance. 1462 * 1463 * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with. 1464 * @param { string } [encoding] - [encoding='utf8'] this is its encoding. 1465 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1466 * 1.Mandatory parameters are left unspecified; 1467 * 2.Incorrect parameter types; 1468 * 3.Parameter verification failed. 1469 * @syscap SystemCapability.Utils.Lang 1470 * @crossplatform 1471 * @since 10 1472 */ 1473 /** 1474 * Creates and returns an XmlPullParser object. 1475 * 1476 * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with. 1477 * @param { string } [encoding] - [encoding='utf8'] this is its encoding. 1478 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1479 * 1.Mandatory parameters are left unspecified; 1480 * 2.Incorrect parameter types; 1481 * 3.Parameter verification failed. 1482 * @syscap SystemCapability.Utils.Lang 1483 * @crossplatform 1484 * @atomicservice 1485 * @since arkts {'1.1':'11', '1.2':'20'} 1486 * @arkts 1.1&1.2 1487 */ 1488 constructor(buffer: ArrayBuffer | DataView, encoding?: string); 1489 1490 /** 1491 * Starts parsing the XML file. 1492 * 1493 * @param { ParseOptions } option - Parse options for XmlPullParser, the interface including 1494 * two Boolean variables and three callback functions. 1495 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1496 * 1.Mandatory parameters are left unspecified; 1497 * 2.Incorrect parameter types. 1498 * @syscap SystemCapability.Utils.Lang 1499 * @since 8 1500 */ 1501 /** 1502 * Starts parsing the XML file. 1503 * 1504 * @param { ParseOptions } option - Parse options for XmlPullParser, the interface including 1505 * two Boolean variables and three callback functions. 1506 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1507 * 1.Mandatory parameters are left unspecified; 1508 * 2.Incorrect parameter types. 1509 * @syscap SystemCapability.Utils.Lang 1510 * @crossplatform 1511 * @since 10 1512 */ 1513 /** 1514 * Starts parsing the XML file. 1515 * 1516 * @param { ParseOptions } option - Parse options for XmlPullParser, the interface including 1517 * two Boolean variables and three callback functions. 1518 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1519 * 1.Mandatory parameters are left unspecified; 1520 * 2.Incorrect parameter types. 1521 * @syscap SystemCapability.Utils.Lang 1522 * @crossplatform 1523 * @atomicservice 1524 * @since 11 1525 */ 1526 /** 1527 * Starts parsing the XML file. 1528 * 1529 * @param { ParseOptions } option - Parse options for XmlPullParser, the interface including 1530 * two Boolean variables and three callback functions. 1531 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1532 * 1.Mandatory parameters are left unspecified; 1533 * 2.Incorrect parameter types. 1534 * @syscap SystemCapability.Utils.Lang 1535 * @crossplatform 1536 * @atomicservice 1537 * @since 11 1538 * @deprecated since 14 1539 * @useinstead ohos.xml.XmlPullParser.parseXml 1540 */ 1541 parse(option: ParseOptions): void; 1542 1543 /** 1544 * Parses XML information. 1545 * 1546 * @param { ParseOptions } option - XML parsing options. 1547 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1548 * 1.Mandatory parameters are left unspecified; 1549 * 2.Incorrect parameter types. 1550 * @syscap SystemCapability.Utils.Lang 1551 * @crossplatform 1552 * @atomicservice 1553 * @since arkts {'1.1':'14', '1.2':'20'} 1554 * @arkts 1.1&1.2 1555 */ 1556 parseXml(option: ParseOptions): void; 1557 } 1558} 1559export default xml; 1560