xref: /interface/sdk-js/api/@ohos.xml.d.ts (revision 61847f8e)
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 11
44 */
45declare namespace xml {
46  /**
47   * The XmlSerializer interface is used to generate an xml file.
48   *
49   * @syscap SystemCapability.Utils.Lang
50   * @since 8
51   * @name XmlSerializer
52   */
53  /**
54   * The XmlSerializer interface is used to generate an xml file.
55   *
56   * @syscap SystemCapability.Utils.Lang
57   * @crossplatform
58   * @since 10
59   * @name XmlSerializer
60   */
61  /**
62   * The XmlSerializer interface is used to generate an xml file.
63   *
64   * @syscap SystemCapability.Utils.Lang
65   * @crossplatform
66   * @atomicservice
67   * @since 11
68   * @name XmlSerializer
69   */
70  class XmlSerializer {
71    /**
72     * A parameterized constructor used to create a new XmlSerializer instance.
73     * As the input parameter of the constructor function, init supports three types.
74     * The input parameter is an Arrarybuffer.
75     * The input parameter is a DataView.
76     * The input parameter is an encoding format of string type.
77     *
78     * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with.
79     * @param { string } [encoding] - [encoding='utf8']  this is its encoding.
80     * @throws { BusinessError } 401 - Parameter error. Possible causes:
81     * 1.Mandatory parameters are left unspecified;
82     * 2.Incorrect parameter types;
83     * 3.Parameter verification failed.
84     * @syscap SystemCapability.Utils.Lang
85     * @since 8
86     */
87    /**
88     * A parameterized constructor used to create a new XmlSerializer instance.
89     * As the input parameter of the constructor function, init supports three types.
90     * The input parameter is an Arrarybuffer.
91     * The input parameter is a DataView.
92     * The input parameter is an encoding format of string type.
93     *
94     * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with.
95     * @param { string } [encoding] - [encoding='utf8']  this is its encoding.
96     * @throws { BusinessError } 401 - Parameter error. Possible causes:
97     * 1.Mandatory parameters are left unspecified;
98     * 2.Incorrect parameter types;
99     * 3.Parameter verification failed.
100     * @syscap SystemCapability.Utils.Lang
101     * @crossplatform
102     * @since 10
103     */
104    /**
105     * A parameterized constructor used to create a new XmlSerializer instance.
106     * As the input parameter of the constructor function, init supports three types.
107     * The input parameter is an Arrarybuffer.
108     * The input parameter is a DataView.
109     * The input parameter is an encoding format of string type.
110     *
111     * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with.
112     * @param { string } [encoding] - [encoding='utf8']  this is its encoding.
113     * @throws { BusinessError } 401 - Parameter error. Possible causes:
114     * 1.Mandatory parameters are left unspecified;
115     * 2.Incorrect parameter types;
116     * 3.Parameter verification failed.
117     * @syscap SystemCapability.Utils.Lang
118     * @crossplatform
119     * @atomicservice
120     * @since 11
121     */
122    constructor(buffer: ArrayBuffer | DataView, encoding?: string);
123
124    /**
125     * Write an attribute.
126     *
127     * @param { string } name - Key name of the attribute.
128     * @param { string } value - Values of attribute.
129     * @throws { BusinessError } 401 - Parameter error. Possible causes:
130     * 1.Mandatory parameters are left unspecified;
131     * 2.Incorrect parameter types;
132     * 3.Parameter verification failed.
133     * @syscap SystemCapability.Utils.Lang
134     * @since 8
135     */
136    /**
137     * Write an attribute.
138     *
139     * @param { string } name - Key name of the attribute.
140     * @param { string } value - Values of attribute.
141     * @throws { BusinessError } 401 - Parameter error. Possible causes:
142     * 1.Mandatory parameters are left unspecified;
143     * 2.Incorrect parameter types;
144     * 3.Parameter verification failed.
145     * @syscap SystemCapability.Utils.Lang
146     * @crossplatform
147     * @since 10
148     */
149    /**
150     * Write an attribute.
151     *
152     * @param { string } name - Key name of the attribute.
153     * @param { string } value - Values of attribute.
154     * @throws { BusinessError } 401 - Parameter error. Possible causes:
155     * 1.Mandatory parameters are left unspecified;
156     * 2.Incorrect parameter types; 3.Parameter verification failed.
157     * @syscap SystemCapability.Utils.Lang
158     * @crossplatform
159     * @atomicservice
160     * @since 11
161     */
162    setAttributes(name: string, value: string): void;
163
164    /**
165     * Add an empty element.
166     *
167     * @param { string } name - Key name of the attribute.
168     * @throws { BusinessError } 401 - Parameter error. Possible causes:
169     * 1.Mandatory parameters are left unspecified;
170     * 2.Incorrect parameter types;
171     * 3.Parameter verification failed.
172     * @syscap SystemCapability.Utils.Lang
173     * @since 8
174     */
175    /**
176     * Add an empty element.
177     *
178     * @param { string } name - Key name of the attribute.
179     * @throws { BusinessError } 401 - Parameter error. Possible causes:
180     * 1.Mandatory parameters are left unspecified;
181     * 2.Incorrect parameter types;
182     * 3.Parameter verification failed.
183     * @syscap SystemCapability.Utils.Lang
184     * @crossplatform
185     * @since 10
186     */
187    /**
188     * Add an empty element.
189     *
190     * @param { string } name - Key name of the attribute.
191     * @throws { BusinessError } 401 - Parameter error. Possible causes:
192     * 1.Mandatory parameters are left unspecified;
193     * 2.Incorrect parameter types;
194     * 3.Parameter verification failed.
195     * @syscap SystemCapability.Utils.Lang
196     * @crossplatform
197     * @atomicservice
198     * @since 11
199     */
200    addEmptyElement(name: string): void;
201
202    /**
203     * Writes xml declaration with encoding. For example: <?xml version="1.0" encoding="utf-8"?>.
204     *
205     * @syscap SystemCapability.Utils.Lang
206     * @since 8
207     */
208    /**
209     * Writes xml declaration with encoding. For example: <?xml version="1.0" encoding="utf-8"?>.
210     *
211     * @syscap SystemCapability.Utils.Lang
212     * @crossplatform
213     * @since 10
214     */
215    /**
216     * Writes xml declaration with encoding. For example: <?xml version="1.0" encoding="utf-8"?>.
217     *
218     * @syscap SystemCapability.Utils.Lang
219     * @crossplatform
220     * @atomicservice
221     * @since 11
222     */
223    setDeclaration(): void;
224
225    /**
226     * Writes a element start tag with the given name.
227     *
228     * @param { string } name - Name of the element.
229     * @throws { BusinessError } 401 - Parameter error. Possible causes:
230     * 1.Mandatory parameters are left unspecified;
231     * 2.Incorrect parameter types;
232     * 3.Parameter verification failed.
233     * @syscap SystemCapability.Utils.Lang
234     * @since 8
235     */
236    /**
237     * Writes a element start tag with the given name.
238     *
239     * @param { string } name - Name of the element.
240     * @throws { BusinessError } 401 - Parameter error. Possible causes:
241     * 1.Mandatory parameters are left unspecified;
242     * 2.Incorrect parameter types;
243     * 3.Parameter verification failed.
244     * @syscap SystemCapability.Utils.Lang
245     * @crossplatform
246     * @since 10
247     */
248    /**
249     * Writes a element start tag with the given name.
250     *
251     * @param { string } name - Name of the element.
252     * @throws { BusinessError } 401 - Parameter error. Possible causes:
253     * 1.Mandatory parameters are left unspecified;
254     * 2.Incorrect parameter types;
255     * 3.Parameter verification failed.
256     * @syscap SystemCapability.Utils.Lang
257     * @crossplatform
258     * @atomicservice
259     * @since 11
260     */
261    startElement(name: string): void;
262
263    /**
264     * Writes end tag of the element.
265     *
266     * @syscap SystemCapability.Utils.Lang
267     * @since 8
268     */
269    /**
270     * Writes end tag of the element.
271     *
272     * @syscap SystemCapability.Utils.Lang
273     * @crossplatform
274     * @since 10
275     */
276    /**
277     * Writes end tag of the element.
278     *
279     * @syscap SystemCapability.Utils.Lang
280     * @crossplatform
281     * @atomicservice
282     * @since 11
283     */
284    endElement(): void;
285
286    /**
287     * Writes the namespace of the current element tag.
288     *
289     * @param { string } prefix - Values name of the prefix.
290     * @param { string } namespace - Values of namespace.
291     * @throws { BusinessError } 401 - Parameter error. Possible causes:
292     * 1.Mandatory parameters are left unspecified;
293     * 2.Incorrect parameter types;
294     * 3.Parameter verification failed.
295     * @syscap SystemCapability.Utils.Lang
296     * @since 8
297     */
298    /**
299     * Writes the namespace of the current element tag.
300     *
301     * @param { string } prefix - Values name of the prefix.
302     * @param { string } namespace - Values of namespace.
303     * @throws { BusinessError } 401 - Parameter error. Possible causes:
304     * 1.Mandatory parameters are left unspecified;
305     * 2.Incorrect parameter types;
306     * 3.Parameter verification failed.
307     * @syscap SystemCapability.Utils.Lang
308     * @crossplatform
309     * @since 10
310     */
311    /**
312     * Writes the namespace of the current element tag.
313     *
314     * @param { string } prefix - Values name of the prefix.
315     * @param { string } namespace - Values of namespace.
316     * @throws { BusinessError } 401 - Parameter error. Possible causes:
317     * 1.Mandatory parameters are left unspecified;
318     * 2.Incorrect parameter types;
319     * 3.Parameter verification failed.
320     * @syscap SystemCapability.Utils.Lang
321     * @crossplatform
322     * @atomicservice
323     * @since 11
324     */
325    setNamespace(prefix: string, namespace: string): void;
326
327    /**
328     * Writes the comment.
329     *
330     * @param { string } text - Values of comment.
331     * @throws { BusinessError } 401 - Parameter error. Possible causes:
332     * 1.Mandatory parameters are left unspecified;
333     * 2.Incorrect parameter types;
334     * 3.Parameter verification failed.
335     * @syscap SystemCapability.Utils.Lang
336     * @since 8
337     */
338    /**
339     * Writes the comment.
340     *
341     * @param { string } text - Values of comment.
342     * @throws { BusinessError } 401 - Parameter error. Possible causes:
343     * 1.Mandatory parameters are left unspecified;
344     * 2.Incorrect parameter types;
345     * 3.Parameter verification failed.
346     * @syscap SystemCapability.Utils.Lang
347     * @crossplatform
348     * @since 10
349     */
350    /**
351     * Writes the comment.
352     *
353     * @param { string } text - Values of comment.
354     * @throws { BusinessError } 401 - Parameter error. Possible causes:
355     * 1.Mandatory parameters are left unspecified;
356     * 2.Incorrect parameter types;
357     * 3.Parameter verification failed.
358     * @syscap SystemCapability.Utils.Lang
359     * @crossplatform
360     * @atomicservice
361     * @since 11
362     */
363    setComment(text: string): void;
364
365    /**
366     * Writes the CDATA.
367     *
368     * @param { string } text -  Values of CDATA.
369     * @throws { BusinessError } 401 - Parameter error. Possible causes:
370     * 1.Mandatory parameters are left unspecified;
371     * 2.Incorrect parameter types;
372     * 3.Parameter verification failed.
373     * @syscap SystemCapability.Utils.Lang
374     * @since 8
375     */
376    /**
377     * Writes the CDATA.
378     *
379     * @param { string } text - Values of CDATA.
380     * @throws { BusinessError } 401 - Parameter error. Possible causes:
381     * 1.Mandatory parameters are left unspecified;
382     * 2.Incorrect parameter types;
383     * 3.Parameter verification failed.
384     * @syscap SystemCapability.Utils.Lang
385     * @crossplatform
386     * @since 10
387     */
388    /**
389     * Writes the CDATA.
390     *
391     * @param { string } text - Values of CDATA.
392     * @throws { BusinessError } 401 - Parameter error. Possible causes:
393     * 1.Mandatory parameters are left unspecified;
394     * 2.Incorrect parameter types;
395     * 3.Parameter verification failed.
396     * @syscap SystemCapability.Utils.Lang
397     * @crossplatform
398     * @atomicservice
399     * @since 11
400     */
401    setCDATA(text: string): void;
402
403    /**
404     * Writes the text.
405     *
406     * @param { string } text - Values of text.
407     * @throws { BusinessError } 401 - Parameter error. Possible causes:
408     * 1.Mandatory parameters are left unspecified;
409     * 2.Incorrect parameter types;
410     * 3.Parameter verification failed.
411     * @syscap SystemCapability.Utils.Lang
412     * @since 8
413     */
414    /**
415     * Writes the text.
416     *
417     * @param { string } text - Values of text.
418     * @throws { BusinessError } 401 - Parameter error. Possible causes:
419     * 1.Mandatory parameters are left unspecified;
420     * 2.Incorrect parameter types;
421     * 3.Parameter verification failed.
422     * @syscap SystemCapability.Utils.Lang
423     * @crossplatform
424     * @since 10
425     */
426    /**
427     * Writes the text.
428     *
429     * @param { string } text - Values of text.
430     * @throws { BusinessError } 401 - Parameter error. Possible causes:
431     * 1.Mandatory parameters are left unspecified;
432     * 2.Incorrect parameter types;
433     * 3.Parameter verification failed.
434     * @syscap SystemCapability.Utils.Lang
435     * @crossplatform
436     * @atomicservice
437     * @since 11
438     */
439    setText(text: string): void;
440
441    /**
442     * Writes the DOCTYPE.
443     *
444     * @param { string } text - Values of docType.
445     * @throws { BusinessError } 401 - Parameter error. Possible causes:
446     * 1.Mandatory parameters are left unspecified;
447     * 2.Incorrect parameter types;
448     * 3.Parameter verification failed.
449     * @syscap SystemCapability.Utils.Lang
450     * @since 8
451     */
452    /**
453     * Writes the DOCTYPE.
454     *
455     * @param { string } text - Values of docType.
456     * @throws { BusinessError } 401 - Parameter error. Possible causes:
457     * 1.Mandatory parameters are left unspecified;
458     * 2.Incorrect parameter types;
459     * 3.Parameter verification failed.
460     * @syscap SystemCapability.Utils.Lang
461     * @crossplatform
462     * @since 10
463     */
464    /**
465     * Writes the DOCTYPE.
466     *
467     * @param { string } text - Values of docType.
468     * @throws { BusinessError } 401 - Parameter error. Possible causes:
469     * 1.Mandatory parameters are left unspecified;
470     * 2.Incorrect parameter types;
471     * 3.Parameter verification failed.
472     * @syscap SystemCapability.Utils.Lang
473     * @crossplatform
474     * @atomicservice
475     * @since 11
476     */
477    setDocType(text: string): void;
478  }
479
480  /**
481   * The event types represented by XML elements.
482   *
483   * @enum { number }
484   * @syscap SystemCapability.Utils.Lang
485   * @since 8
486   */
487  /**
488   * The event types represented by XML elements.
489   *
490   * @enum { number }
491   * @syscap SystemCapability.Utils.Lang
492   * @crossplatform
493   * @since 10
494   */
495  /**
496   * The event types represented by XML elements.
497   *
498   * @enum { number }
499   * @syscap SystemCapability.Utils.Lang
500   * @crossplatform
501   * @atomicservice
502   * @since 11
503   */
504  enum EventType {
505    /**
506     * Start a document.
507     *
508     * @syscap SystemCapability.Utils.Lang
509     * @since 8
510     */
511    /**
512     * Start a document.
513     *
514     * @syscap SystemCapability.Utils.Lang
515     * @crossplatform
516     * @since 10
517     */
518    /**
519     * Start a document.
520     *
521     * @syscap SystemCapability.Utils.Lang
522     * @crossplatform
523     * @atomicservice
524     * @since 11
525     */
526    START_DOCUMENT,
527    /**
528     * End a document.
529     *
530     * @syscap SystemCapability.Utils.Lang
531     * @since 8
532     */
533    /**
534     * End a document.
535     *
536     * @syscap SystemCapability.Utils.Lang
537     * @crossplatform
538     * @since 10
539     */
540    /**
541     * End a document.
542     *
543     * @syscap SystemCapability.Utils.Lang
544     * @crossplatform
545     * @atomicservice
546     * @since 11
547     */
548    END_DOCUMENT,
549    /**
550     * Start a tag.
551     *
552     * @syscap SystemCapability.Utils.Lang
553     * @since 8
554     */
555    /**
556     * Start a tag.
557     *
558     * @syscap SystemCapability.Utils.Lang
559     * @crossplatform
560     * @since 10
561     */
562    /**
563     * Start a tag.
564     *
565     * @syscap SystemCapability.Utils.Lang
566     * @crossplatform
567     * @atomicservice
568     * @since 11
569     */
570    START_TAG,
571    /**
572     * End a tag.
573     *
574     * @syscap SystemCapability.Utils.Lang
575     * @since 8
576     */
577    /**
578     * End a tag.
579     *
580     * @syscap SystemCapability.Utils.Lang
581     * @crossplatform
582     * @since 10
583     */
584    /**
585     * End a tag.
586     *
587     * @syscap SystemCapability.Utils.Lang
588     * @crossplatform
589     * @atomicservice
590     * @since 11
591     */
592    END_TAG,
593    /**
594     * Character data.
595     *
596     * @syscap SystemCapability.Utils.Lang
597     * @since 8
598     */
599    /**
600     * Character data.
601     *
602     * @syscap SystemCapability.Utils.Lang
603     * @crossplatform
604     * @since 10
605     */
606    /**
607     * Character data.
608     *
609     * @syscap SystemCapability.Utils.Lang
610     * @crossplatform
611     * @atomicservice
612     * @since 11
613     */
614    TEXT,
615    /**
616     * A CDATA sections.
617     *
618     * @syscap SystemCapability.Utils.Lang
619     * @since 8
620     */
621    /**
622     * A CDATA sections.
623     *
624     * @syscap SystemCapability.Utils.Lang
625     * @crossplatform
626     * @since 10
627     */
628    /**
629     * A CDATA sections.
630     *
631     * @syscap SystemCapability.Utils.Lang
632     * @crossplatform
633     * @atomicservice
634     * @since 11
635     */
636    CDSECT,
637    /**
638     * An XML comment.
639     *
640     * @syscap SystemCapability.Utils.Lang
641     * @since 8
642     */
643    /**
644     * An XML comment.
645     *
646     * @syscap SystemCapability.Utils.Lang
647     * @crossplatform
648     * @since 10
649     */
650    /**
651     * An XML comment.
652     *
653     * @syscap SystemCapability.Utils.Lang
654     * @crossplatform
655     * @atomicservice
656     * @since 11
657     */
658    COMMENT,
659    /**
660     * An XML document type declaration.
661     *
662     * @syscap SystemCapability.Utils.Lang
663     * @since 8
664     */
665    /**
666     * An XML document type declaration.
667     *
668     * @syscap SystemCapability.Utils.Lang
669     * @crossplatform
670     * @since 10
671     */
672    /**
673     * An XML document type declaration.
674     *
675     * @syscap SystemCapability.Utils.Lang
676     * @crossplatform
677     * @atomicservice
678     * @since 11
679     */
680    DOCDECL,
681    /**
682     * An XML processing instruction declaration.
683     *
684     * @syscap SystemCapability.Utils.Lang
685     * @since 8
686     */
687    /**
688     * An XML processing instruction declaration.
689     *
690     * @syscap SystemCapability.Utils.Lang
691     * @crossplatform
692     * @since 10
693     */
694    /**
695     * An XML processing instruction declaration.
696     *
697     * @syscap SystemCapability.Utils.Lang
698     * @crossplatform
699     * @atomicservice
700     * @since 11
701     */
702    INSTRUCTION,
703    /**
704     * An entity reference.
705     *
706     * @syscap SystemCapability.Utils.Lang
707     * @since 8
708     */
709    /**
710     * An entity reference.
711     *
712     * @syscap SystemCapability.Utils.Lang
713     * @crossplatform
714     * @since 10
715     */
716    /**
717     * An entity reference.
718     *
719     * @syscap SystemCapability.Utils.Lang
720     * @crossplatform
721     * @atomicservice
722     * @since 11
723     */
724    ENTITY_REFERENCE,
725    /**
726     * A whitespace.
727     *
728     * @syscap SystemCapability.Utils.Lang
729     * @since 8
730     */
731    /**
732     * A whitespace.
733     *
734     * @syscap SystemCapability.Utils.Lang
735     * @crossplatform
736     * @since 10
737     */
738    /**
739     * A whitespace.
740     *
741     * @syscap SystemCapability.Utils.Lang
742     * @crossplatform
743     * @atomicservice
744     * @since 11
745     */
746    WHITESPACE
747  }
748
749  /**
750   * The current parse info.
751   *
752   * @typedef ParseInfo
753   * @syscap SystemCapability.Utils.Lang
754   * @since 8
755   */
756  /**
757   * The current parse info.
758   *
759   * @typedef ParseInfo
760   * @syscap SystemCapability.Utils.Lang
761   * @crossplatform
762   * @since 10
763   */
764  /**
765   * The current parse info.
766   *
767   * @typedef ParseInfo
768   * @syscap SystemCapability.Utils.Lang
769   * @crossplatform
770   * @atomicservice
771   * @since 11
772   */
773  interface ParseInfo {
774    /**
775     * The current column number, starting from 1.
776     *
777     * @returns { number }
778     * @syscap SystemCapability.Utils.Lang
779     * @since 8
780     */
781    /**
782     * The current column number, starting from 1.
783     *
784     * @returns { number }
785     * @syscap SystemCapability.Utils.Lang
786     * @crossplatform
787     * @since 10
788     */
789    /**
790     * The current column number, starting from 1.
791     *
792     * @returns { number }
793     * @syscap SystemCapability.Utils.Lang
794     * @crossplatform
795     * @atomicservice
796     * @since 11
797     */
798    getColumnNumber(): number;
799    /**
800     * The current depth of the element.
801     *
802     * @returns { number }
803     * @syscap SystemCapability.Utils.Lang
804     * @since 8
805     */
806    /**
807     * The current depth of the element.
808     *
809     * @returns { number }
810     * @syscap SystemCapability.Utils.Lang
811     * @crossplatform
812     * @since 10
813     */
814    /**
815     * The current depth of the element.
816     *
817     * @returns { number }
818     * @syscap SystemCapability.Utils.Lang
819     * @crossplatform
820     * @atomicservice
821     * @since 11
822     */
823    getDepth(): number;
824    /**
825     * The current line number, starting from 1.
826     *
827     * @returns { number }
828     * @syscap SystemCapability.Utils.Lang
829     * @since 8
830     */
831    /**
832     * The current line number, starting from 1.
833     *
834     * @returns { number }
835     * @syscap SystemCapability.Utils.Lang
836     * @crossplatform
837     * @since 10
838     */
839    /**
840     * The current line number, starting from 1.
841     *
842     * @returns { number }
843     * @syscap SystemCapability.Utils.Lang
844     * @crossplatform
845     * @atomicservice
846     * @since 11
847     */
848    getLineNumber(): number;
849    /**
850     * The current element's name.
851     *
852     * @returns { string }
853     * @syscap SystemCapability.Utils.Lang
854     * @since 8
855     */
856    /**
857     * The current element's name.
858     *
859     * @returns { string }
860     * @syscap SystemCapability.Utils.Lang
861     * @crossplatform
862     * @since 10
863     */
864    /**
865     * The current element's name.
866     *
867     * @returns { string }
868     * @syscap SystemCapability.Utils.Lang
869     * @crossplatform
870     * @atomicservice
871     * @since 11
872     */
873    getName(): string;
874    /**
875     * The current element's namespace.
876     *
877     * @returns { string }
878     * @syscap SystemCapability.Utils.Lang
879     * @since 8
880     */
881    /**
882     * The current element's namespace.
883     *
884     * @returns { string }
885     * @syscap SystemCapability.Utils.Lang
886     * @crossplatform
887     * @since 10
888     */
889    /**
890     * The current element's namespace.
891     *
892     * @returns { string }
893     * @syscap SystemCapability.Utils.Lang
894     * @crossplatform
895     * @atomicservice
896     * @since 11
897     */
898    getNamespace(): string;
899    /**
900     * The current element's prefix.
901     *
902     * @returns { string }
903     * @syscap SystemCapability.Utils.Lang
904     * @since 8
905     */
906    /**
907     * The current element's prefix.
908     *
909     * @returns { string }
910     * @syscap SystemCapability.Utils.Lang
911     * @crossplatform
912     * @since 10
913     */
914    /**
915     * The current element's prefix.
916     *
917     * @returns { string }
918     * @syscap SystemCapability.Utils.Lang
919     * @crossplatform
920     * @atomicservice
921     * @since 11
922     */
923    getPrefix(): string;
924    /**
925     * The text content of the current event as String.
926     *
927     * @returns { string }
928     * @syscap SystemCapability.Utils.Lang
929     * @since 8
930     */
931    /**
932     * The text content of the current event as String.
933     *
934     * @returns { string }
935     * @syscap SystemCapability.Utils.Lang
936     * @crossplatform
937     * @since 10
938     */
939    /**
940     * The text content of the current event as String.
941     *
942     * @returns { string }
943     * @syscap SystemCapability.Utils.Lang
944     * @crossplatform
945     * @atomicservice
946     * @since 11
947     */
948    getText(): string;
949    /**
950     * Returns true if the current element is empty.
951     *
952     * @returns { boolean }
953     * @syscap SystemCapability.Utils.Lang
954     * @since 8
955     */
956    /**
957     * Returns true if the current element is empty.
958     *
959     * @returns { boolean }
960     * @syscap SystemCapability.Utils.Lang
961     * @crossplatform
962     * @since 10
963     */
964    /**
965     * Returns true if the current element is empty.
966     *
967     * @returns { boolean }
968     * @syscap SystemCapability.Utils.Lang
969     * @crossplatform
970     * @atomicservice
971     * @since 11
972     */
973    isEmptyElementTag(): boolean;
974    /**
975     * Checks whether the current TEXT event contains only whitespace characters.
976     *
977     * @returns { boolean }
978     * @syscap SystemCapability.Utils.Lang
979     * @since 8
980     */
981    /**
982     * Checks whether the current TEXT event contains only whitespace characters.
983     *
984     * @returns { boolean }
985     * @syscap SystemCapability.Utils.Lang
986     * @crossplatform
987     * @since 10
988     */
989    /**
990     * Checks whether the current TEXT event contains only whitespace characters.
991     *
992     * @returns { boolean }
993     * @syscap SystemCapability.Utils.Lang
994     * @crossplatform
995     * @atomicservice
996     * @since 11
997     */
998    isWhitespace(): boolean;
999    /**
1000     * Returns the number of attributes of the current start tag.
1001     *
1002     * @returns { number }
1003     * @syscap SystemCapability.Utils.Lang
1004     * @since 8
1005     */
1006    /**
1007     * Returns the number of attributes of the current start tag.
1008     *
1009     * @returns { number }
1010     * @syscap SystemCapability.Utils.Lang
1011     * @crossplatform
1012     * @since 10
1013     */
1014    /**
1015     * Returns the number of attributes of the current start tag.
1016     *
1017     * @returns { number }
1018     * @syscap SystemCapability.Utils.Lang
1019     * @crossplatform
1020     * @atomicservice
1021     * @since 11
1022     */
1023    getAttributeCount(): number;
1024  }
1025
1026  /**
1027   * Parse options for XmlPullParser.
1028   *
1029   * @typedef ParseOptions
1030   * @syscap SystemCapability.Utils.Lang
1031   * @since 8
1032   */
1033  /**
1034   * Parse options for XmlPullParser.
1035   *
1036   * @typedef ParseOptions
1037   * @syscap SystemCapability.Utils.Lang
1038   * @crossplatform
1039   * @since 10
1040   */
1041  /**
1042   * Parse options for XmlPullParser.
1043   *
1044   * @typedef ParseOptions
1045   * @syscap SystemCapability.Utils.Lang
1046   * @crossplatform
1047   * @atomicservice
1048   * @since 11
1049   */
1050  interface ParseOptions {
1051    /**
1052     * Whether to parsing Doctype of the elements.
1053     *
1054     * @type { ?boolean }
1055     * @syscap SystemCapability.Utils.Lang
1056     * @since 8
1057     */
1058    /**
1059     * Whether to parsing Doctype of the elements.
1060     *
1061     * @type { ?boolean }
1062     * @syscap SystemCapability.Utils.Lang
1063     * @crossplatform
1064     * @since 10
1065     */
1066    /**
1067     * Whether to parsing Doctype of the elements.
1068     *
1069     * @type { ?boolean }
1070     * @syscap SystemCapability.Utils.Lang
1071     * @crossplatform
1072     * @atomicservice
1073     * @since 11
1074     */
1075    supportDoctype?: boolean;
1076
1077    /**
1078     * Whether to ignore parsing texts of the elements.
1079     *
1080     * @type { ?boolean }
1081     * @syscap SystemCapability.Utils.Lang
1082     * @since 8
1083     */
1084    /**
1085     * Whether to ignore parsing texts of the elements.
1086     *
1087     * @type { ?boolean }
1088     * @syscap SystemCapability.Utils.Lang
1089     * @crossplatform
1090     * @since 10
1091     */
1092    /**
1093     * Whether to ignore parsing texts of the elements.
1094     *
1095     * @type { ?boolean }
1096     * @syscap SystemCapability.Utils.Lang
1097     * @crossplatform
1098     * @atomicservice
1099     * @since 11
1100     */
1101    ignoreNameSpace?: boolean;
1102
1103    /**
1104     * Tag value callback function.
1105     *
1106     * @type { ?function }
1107     * @syscap SystemCapability.Utils.Lang
1108     * @since 8
1109     */
1110    /**
1111     * Tag value callback function.
1112     *
1113     * @type { ?function }
1114     * @syscap SystemCapability.Utils.Lang
1115     * @crossplatform
1116     * @since 10
1117     */
1118    /**
1119     * Tag value callback function.
1120     *
1121     * @type { ?function }
1122     * @syscap SystemCapability.Utils.Lang
1123     * @crossplatform
1124     * @atomicservice
1125     * @since 11
1126     */
1127    tagValueCallbackFunction?: (name: string, value: string) => boolean;
1128
1129    /**
1130     * Attribute value callback function.
1131     *
1132     * @type { ?function }
1133     * @syscap SystemCapability.Utils.Lang
1134     * @since 8
1135     */
1136    /**
1137     * Attribute value callback function.
1138     *
1139     * @type { ?function }
1140     * @syscap SystemCapability.Utils.Lang
1141     * @crossplatform
1142     * @since 10
1143     */
1144    /**
1145     * Attribute value callback function.
1146     *
1147     * @type { ?function }
1148     * @syscap SystemCapability.Utils.Lang
1149     * @crossplatform
1150     * @atomicservice
1151     * @since 11
1152     */
1153    attributeValueCallbackFunction?: (name: string, value: string) => boolean;
1154
1155    /**
1156     * Token value callback function.
1157     *
1158     * @type { ?function }
1159     * @syscap SystemCapability.Utils.Lang
1160     * @since 8
1161     */
1162    /**
1163     * Token value callback function.
1164     *
1165     * @type { ?function }
1166     * @syscap SystemCapability.Utils.Lang
1167     * @crossplatform
1168     * @since 10
1169     */
1170    /**
1171     * Token value callback function.
1172     *
1173     * @type { ?function }
1174     * @syscap SystemCapability.Utils.Lang
1175     * @crossplatform
1176     * @atomicservice
1177     * @since 11
1178     */
1179    tokenValueCallbackFunction?: (eventType: EventType, value: ParseInfo) => boolean;
1180  }
1181
1182  /**
1183   * The XmlPullParser interface is used to parse the existing xml file.
1184   *
1185   * @syscap SystemCapability.Utils.Lang
1186   * @since 8
1187   * @name XmlPullParser
1188   */
1189  /**
1190   * The XmlPullParser interface is used to parse the existing xml file.
1191   *
1192   * @syscap SystemCapability.Utils.Lang
1193   * @crossplatform
1194   * @since 10
1195   * @name XmlPullParser
1196   */
1197  /**
1198   * The XmlPullParser interface is used to parse the existing xml file.
1199   *
1200   * @syscap SystemCapability.Utils.Lang
1201   * @crossplatform
1202   * @atomicservice
1203   * @since 11
1204   * @name XmlPullParser
1205   */
1206  class XmlPullParser {
1207    /**
1208     * A constructor used to create a new XmlPullParser instance.
1209     *
1210     * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with.
1211     * @param { string } [encoding] - [encoding='utf8']  this is its encoding.
1212     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1213     * 1.Mandatory parameters are left unspecified;
1214     * 2.Incorrect parameter types;
1215     * 3.Parameter verification failed.
1216     * @syscap SystemCapability.Utils.Lang
1217     * @since 8
1218     */
1219    /**
1220     * A constructor used to create a new XmlPullParser instance.
1221     *
1222     * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with.
1223     * @param { string } [encoding] - [encoding='utf8']  this is its encoding.
1224     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1225     * 1.Mandatory parameters are left unspecified;
1226     * 2.Incorrect parameter types;
1227     * 3.Parameter verification failed.
1228     * @syscap SystemCapability.Utils.Lang
1229     * @crossplatform
1230     * @since 10
1231     */
1232    /**
1233     * A constructor used to create a new XmlPullParser instance.
1234     *
1235     * @param { ArrayBuffer | DataView } buffer - A instance, the new XmlPullParser with.
1236     * @param { string } [encoding] - [encoding='utf8']  this is its encoding.
1237     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1238     * 1.Mandatory parameters are left unspecified;
1239     * 2.Incorrect parameter types;
1240     * 3.Parameter verification failed.
1241     * @syscap SystemCapability.Utils.Lang
1242     * @crossplatform
1243     * @atomicservice
1244     * @since 11
1245     */
1246    constructor(buffer: ArrayBuffer | DataView, encoding?: string);
1247
1248    /**
1249     * Starts parsing the XML file.
1250     *
1251     * @param { ParseOptions } option - Parse options for XmlPullParser, the interface including
1252	   * two Boolean variables and three callback functions.
1253     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1254     * 1.Mandatory parameters are left unspecified;
1255     * 2.Incorrect parameter types.
1256     * @syscap SystemCapability.Utils.Lang
1257     * @since 8
1258     */
1259    /**
1260     * Starts parsing the XML file.
1261     *
1262     * @param { ParseOptions } option - Parse options for XmlPullParser, the interface including
1263	   * two Boolean variables and three callback functions.
1264     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1265     * 1.Mandatory parameters are left unspecified;
1266     * 2.Incorrect parameter types.
1267     * @syscap SystemCapability.Utils.Lang
1268     * @crossplatform
1269     * @since 10
1270     */
1271    /**
1272     * Starts parsing the XML file.
1273     *
1274     * @param { ParseOptions } option - Parse options for XmlPullParser, the interface including
1275	   * two Boolean variables and three callback functions.
1276     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1277     * 1.Mandatory parameters are left unspecified;
1278     * 2.Incorrect parameter types.
1279     * @syscap SystemCapability.Utils.Lang
1280     * @crossplatform
1281     * @atomicservice
1282     * @since 11
1283     */
1284    parse(option: ParseOptions): void;
1285  }
1286}
1287export default xml;
1288