Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Dom.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* Dom.h (C) 2000-2025 */
9/* */
10/* Implementation of DOM1+DOM2+DOM3(core). */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_DOM_H
13#define ARCANE_CORE_DOM_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/DomDeclaration.h"
18#include "arcane/utils/String.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25class IStringImpl;
27} // namespace Arcane
28
29namespace Arcane::dom
30{
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
38extern NodePrv* toNodePrv(const Node& node);
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
43typedef String DOMString;
44
45/*---------------------------------------------------------------------------*/
46/*---------------------------------------------------------------------------*/
47
48/*! @name ExceptionCode
49 An integer indicating the type of error generated.
50 \note Other numeric codes are reserved for W3C for possible future
51 use.
52 \relate DOMException
53*/
54//@{
55/*! If index or size is negative, or greater than the allowed value */
56const UShort INDEX_SIZE_ERR = 1;
57/*! If the specified range of text does not fit into a DOMString */
58const UShort DOMSTRING_SIZE_ERR = 2;
59//! If any node is inserted somewhere it doesn't belong
60const UShort HIERARCHY_REQUEST_ERR = 3;
61/*! If a node is used in a different document than the one that
62 created it (that doesn't support it) */
63const UShort WRONG_DOCUMENT_ERR = 4;
64/*! If an invalid or illegal character is specified, such as in a
65 name. See production 2 in the XML specification for the definition of
66 a legal character, and production 5 for the definition of a legal name
67 character. */
68const UShort INVALID_CHARACTER_ERR = 5;
69//! If data is specified for a node which does not support data
70const UShort NO_DATA_ALLOWED_ERR = 6;
71/*! If an attempt is made to modify an object where modifications are
72 not allowed */
73const UShort NO_MODIFICATION_ALLOWED_ERR = 7;
74/*! If an attempt is made to reference a node in a context where it
75 does not exist */
76const UShort NOT_FOUND_ERR = 8;
77/*! If the implementation does not support the requested type of
78 object or operation */
79const UShort NOT_SUPPORTED_ERR = 9;
80/*! If an attempt is made to add an attribute that is already in use
81 elsewhere */
82const UShort INUSE_ATTRIBUTE_ERR = 10;
83/*! If an attempt is made to use an object that is not, or is no
84 longer, usable */
85const UShort INVALID_STATE_ERR = 11;
86/*! If an invalid or illegal string is specified */
87const UShort SYNTAX_ERR = 12;
88/*! If an attempt is made to modify the type of the underlying object */
89const UShort INVALID_MODIFICATION_ERR = 13;
90/*! If an attempt is made to create or change an object in a way which
91 is incorrect with regard to namespaces */
92const UShort NAMESPACE_ERR = 14;
93/*! If a parameter or an operation is not supported by the underlying
94 object */
95const UShort INVALID_ACCESS_ERR = 15;
96//@}
97
98const UShort NOT_IMPLEMENTED_ERR = 2500;
99
100/*---------------------------------------------------------------------------*/
101/*---------------------------------------------------------------------------*/
102
103class ARCANE_CORE_EXPORT DOMException
104{
105 public:
106
107 DOMException(UShort _code)
108 : code(_code)
109 {}
110
111 public:
112
113 UShort code; //!< The code of the exception
114};
115
116/*---------------------------------------------------------------------------*/
117/*---------------------------------------------------------------------------*/
118
119class ARCANE_CORE_EXPORT DOMWriter
120{
121 public:
122
123 /*! @name Constructors and Destructors */
124 //@{
125 DOMWriter();
126 DOMWriter(DOMWriterPrv*);
127 DOMWriter(const DOMWriter& dw);
128 ~DOMWriter();
129 //@}
130 const DOMWriter& operator=(const DOMWriter& from);
131
132 public:
133
134 ByteUniqueArray writeNode(const Node& node) const;
135 void encoding(const String& encoding);
136 String encoding() const;
137
138 private:
139
140 DOMWriterPrv* m_p;
141 DOMWriterPrv* _impl() const;
142 bool _null() const;
143 void _checkValid() const;
144};
145
146/*---------------------------------------------------------------------------*/
147/*---------------------------------------------------------------------------*/
148
149class ARCANE_CORE_EXPORT DOMImplementation
150{
151 public:
152
153 /*! @name DOM Level 1 operations */
154 //@{
155 bool hasFeature(const DOMString& feature, const DOMString& version) const;
156 //@}
157
158 /*! @name DOM Level 2 operations */
159 //@{
160 DocumentType createDocumentType(const DOMString& qualified_name, const DOMString& public_id,
161 const DOMString& system_id) const;
162
163 private:
164
165 Document createDocument(const DOMString& namespace_uri, const DOMString& qualified_name,
166 const DocumentType& doctype) const;
167
168 public:
169
170 //@}
171
172 /*! @name DOM Level 3 operations */
173 //@{
174 DOMImplementation getInterface(const DOMString& feature) const;
175 //@}
176
177 DOMWriter createDOMWriter() const;
178
179 public:
180
181 /*! @name Constructors and Destructors */
182 //@{
183 DOMImplementation();
184 DOMImplementation(ImplementationPrv*);
185 ~DOMImplementation();
186 //@}
187
188 public:
189
190 //! The following methods are internal to Arcane.
191 //@{
193 IXmlDocumentHolder* _load(const String& fname, ITraceMng* msg, const String& schemaname);
194 IXmlDocumentHolder* _load(const String& fname, ITraceMng* msg, const String& schemaname, ByteConstArrayView schema_data);
195 IXmlDocumentHolder* _load(ByteConstSpan buffer, const String& name, ITraceMng* trace);
196 void _save(ByteArray& bytes, const Document& document, int indent_level);
197 String _implementationName() const;
198 //@}
199 public:
200
201 static void initialize();
202 static void terminate();
203
204 private:
205
206 ImplementationPrv* m_p;
207 ImplementationPrv* _impl() const;
208 void _checkValid() const;
209};
210
211/*---------------------------------------------------------------------------*/
212/*---------------------------------------------------------------------------*/
213
214ARCANE_CORE_EXPORT bool operator==(const Node& n1, const Node& n2);
215ARCANE_CORE_EXPORT bool operator!=(const Node& n1, const Node& n2);
216//class NodePrv;
217
218/*!
219 * \internal
220 * \ingroup Xml
221 */
222class ARCANE_CORE_EXPORT Node
223{
224 public:
225
226 /*! @name NodeType
227 An integer indicating which type of node this is.
228 \note Numeric codes up to 200 are reserved to W3C for possible future use.
229 */
230 //@{
231 //! The node is an Element
232 static const UShort ELEMENT_NODE = 1;
233 //! The node is an Attr
234 static const UShort ATTRIBUTE_NODE = 2;
235 //! The node is a Text node
236 static const UShort TEXT_NODE = 3;
237 //! The node is a CDATASection
238 static const UShort CDATA_SECTION_NODE = 4;
239 //! The node is an EntityReference
240 static const UShort ENTITY_REFERENCE_NODE = 5;
241 //! The node is an Entity
242 static const UShort ENTITY_NODE = 6;
243 //! The node is a ProcessingInstruction
244 static const UShort PROCESSING_INSTRUCTION_NODE = 7;
245 //! The node is a Comment
246 static const UShort COMMENT_NODE = 8;
247 //! The node is a Document
248 static const UShort DOCUMENT_NODE = 9;
249 //! The node is a DocumentType
250 static const UShort DOCUMENT_TYPE_NODE = 10;
251 //! The node is a DocumentFragment
252 static const UShort DOCUMENT_FRAGMENT_NODE = 11;
253 //! The node is a Notation
254 static const UShort NOTATION_NODE = 12;
255 //@}
256
257 public:
258
259 /*! @name Attribute nodeName (DOM Level 1) */
260 //@{
261 DOMString nodeName() const;
262 //@}
263
264 /*! @name Attribute nodeValue (DOM Level 1) */
265 //@{
266 DOMString nodeValue() const;
267 void nodeValue(const DOMString& value) const;
268 //@}
269
270 /*! @name Attribute nodeType (DOM Level 1) */
271 //@{
272 UShort nodeType() const;
273 //@}
274
275 /*! @name Attribute parentNode (DOM Level 1) */
276 //@{
277 Node parentNode() const;
278 //@}
279
280 /*! @name Attribute childNodes (DOM Level 1) */
281 //@{
282 NodeList childNodes() const;
283 //@}
284
285 /*! @name Attribute firstChild() (DOM Level 1) */
286 //@{
287 Node firstChild() const;
288 //@}
289
290 /*! @name Attribute lastChild() (DOM Level 1) */
291 //@{
292 Node lastChild() const;
293 //@}
294
295 /*! @name Attribute previousSibling() (DOM Level 1) */
296 //@{
297 Node previousSibling() const;
298 //@}
299
300 /*! @name Attribute nextSibling() (DOM Level 1) */
301 //@{
302 Node nextSibling() const;
303 //@}
304
305 /*! @name Attribute attributes() (DOM Level 1) */
306 //@{
307 NamedNodeMap attributes() const;
308 //@}
309
310 /*! @name Attribute ownerDocument() (DOM Level 2) */
311 //@{
312 Document ownerDocument() const;
313 //@}
314
315 /*! @name DOM Level 1 operations */
316 //@{
317 Node insertBefore(const Node& new_child, const Node& ref_child) const;
318 Node replaceChild(const Node& new_child, const Node& old_child) const;
319 Node removeChild(const Node& old_child) const;
320 Node appendChild(const Node& new_child) const;
321 bool hasChildNodes() const;
322 Node cloneNode(bool deep) const;
323 //@}
324
325 /*! @name Attribute prefix() (DOM Level 2). */
326 //@{
327 DOMString prefix() const;
328 void prefix(const DOMString& new_prefix) const;
329 //@}
330
331 /*! @name DOM Level 2 operations */
332 //@{
333 void normalize() const;
334 bool isSupported(const DOMString& feature, const DOMString& version) const;
335 DOMString namespaceURI() const;
336
337 DOMString localName() const;
338 //@}
339
340 /*! @name TreePosition
341 A bitmask indicating the relative tree position of a node with
342 respect to another node.
343
344 Issue TreePosition-1:
345 Should we use fewer bits?
346
347 Issue TreePosition-2:
348 How does a node compare to itself?
349 */
350 //@{
351 //! The node precedes the reference node
352 static const UShort TREE_POSITION_PRECEDING = 0x01;
353 //! The node follows the reference node
354 static const UShort TREE_POSITION_FOLLOWING = 0x02;
355 //! The node is an ancestor of the reference node
356 static const UShort TREE_POSITION_ANCESTOR = 0x04;
357 //! The node is a descendant of the reference node
358 static const UShort TREE_POSITION_DESCENDANT = 0x08;
359 /*! The two nodes have the same position. This is the case of two
360 attributes that have the same ownerElement() */
361 static const UShort TREE_POSITION_SAME = 0x10;
362 /*! The two nodes have the exact same position. This is never the
363 case of two attributes, even when they have the same
364 ownerElement. Two nodes that have the exact same position have the
365 same position, though the reverse may not be true.
366 */
367 static const UShort TREE_POSITION_EXACT_SAME = 0x20;
368 //! The two nodes are disconnected, they do not have any common ancestor
369 static const UShort TREE_POSITION_DISCONNECTED = 0x00;
370 //@}
371
372 /*! @name Attribute textContent() (DOM Level 3) */
373 //@{
374 DOMString textContent() const;
375 void textContent(const DOMString& value) const;
376 //@}
377
378 /*! @name Attribute baseURI() (DOM Level 3) */
379 //@{
380 DOMString baseURI() const;
381 //@}
382
383 /*! @name DOM Level 3 operations */
384 //@{
385 bool isSameNode(const Node& node) const;
386 UShort compareTreePosition(const Node& other) const;
387 bool isEqualNode(const Node& other) const;
388 Node getInterface(const DOMString& feature) const;
389 DOMString lookupNamespacePrefix(const DOMString& namespace_uri, bool use_default) const;
390 bool isDefaultNamespace(const DOMString& namespace_uri) const;
391 DOMString lookupNamespaceURI(const DOMString& prefix) const;
392 //void normalizeNS() const;
393 DOMObject setUserData(const DOMString& key, const DOMObject& data,
394 const UserDataHandler& handler) const;
395 DOMObject getUserData(const DOMString& key) const;
396 //@}
397
398 /*!
399 * \brief Destroys the node.
400 *
401 * The node must not belong to a document.
402 *
403 * The node must no longer be used afterwards.
404 *
405 * This method is not part of the DOM but is necessary for
406 * certain implementations to delete the memory associated with a node.
407 */
408 void releaseNode();
409
410 public:
411
412 bool _null() const;
413
414 public:
415
416 friend class IDOM_Node;
417 friend class IDOM_Document;
418 friend class Attr;
419 friend class Element;
420 friend class Document;
421 friend class DOMImplementation;
422 friend class NamedNodeMap;
423 friend class CharacterData;
424 friend class Text;
425 friend class DOMWriter;
426 friend bool ARCANE_CORE_EXPORT operator==(const Node& n1, const Node& n2);
427
428 protected:
429
430 NodePrv* m_p; //!< Class implementation.
431 //void* m_p;
432 void _assign(const Node&);
433
434 public:
435
436 Node();
437 Node(const Node&);
438 virtual ~Node();
439 const Node& operator=(const Node& from);
440
441 public:
442
443 Node(NodePrv*);
444
445 protected:
446
447 void _checkValid() const;
448
449 protected:
450
451 NodePrv* _impl() const;
452 friend NodePrv* toNodePrv(const Node& node);
453};
454
455/*---------------------------------------------------------------------------*/
456/*---------------------------------------------------------------------------*/
457
458/*!
459 * \internal
460 * \ingroup Xml
461 */
462class ARCANE_CORE_EXPORT Document
463: public Node
464{
465 public:
466
467 /*! @name Attribute doctype() (DOM Level 1) */
468 //@{
469 DocumentType doctype() const;
470 //@}
471
472 /*! @name Attribute implementation() (DOM Level 1) */
473 //@{
474 DOMImplementation implementation() const;
475 //@}
476
477 /*! @name Attribute documentElement() (DOM Level 1) */
478 //@{
479 Element documentElement() const;
480 //@}
481
482 //! @name DOM Level 1 operations
483 //@{
484 Element createElement(const DOMString& tag_name) const;
485 DocumentFragment createDocumentFragment() const;
486 Text createTextNode(const DOMString& data) const;
487 Comment createComment(const DOMString& data) const;
488 CDATASection createCDATASection(const DOMString& data) const;
489 ProcessingInstruction createProcessingInstruction(const DOMString& target,
490 const DOMString& data) const;
491 Attr createAttribute(const DOMString& name) const;
492 EntityReference createEntityReference(const DOMString& name) const;
493 NodeList getElementsByTagName(const DOMString& tagname) const;
494 //@}
495
496 //! @name DOM Level 2 operations
497 //@{
498 Node importNode(const Node& imported_node, bool deep) const;
499 Element createElementNS(const DOMString& namespace_uri, const DOMString& qualified_name) const;
500 Attr createAttributeNS(const DOMString& namespace_uri, const DOMString& qualified_name) const;
501 NodeList getElementsByTagNameNS(const DOMString& namespace_uri, const DOMString& local_name) const;
502 Element getElementById(const DOMString& element_id) const;
503 //@}
504
505 /*! @name Attribute actualEncoding() (DOM Level 3) */
506 //@{
507 DOMString actualEncoding() const;
508 void actualEncoding(const DOMString&) const;
509 //@}
510
511 /*! @name Attribute encoding() (DOM Level 3) */
512 //@{
513 DOMString encoding() const;
514 void encoding(const DOMString&) const;
515 //@}
516
517 /*! @name Attribute standalone() (DOM Level 3) */
518 //@{
519 bool standalone() const;
520 void standalone(bool) const;
521 //@}
522
523 /*! @name Attribute strictErrorChecking() (DOM Level 3) */
524 //@{
525 bool strictErrorChecking() const;
526 void strictErrorChecking(bool) const;
527 //@}
528
529 /*! @name version() (DOM Level 3) */
530 //@{
531 DOMString version() const;
532 void version(const DOMString&) const;
533 //@}
534
535 /*! @name Attribute errorHandler() (DOM Level 3) */
536 //@{
537 DOMErrorHandler errorHandler() const;
538 void errorHandler(const DOMErrorHandler&) const;
539 //@}
540
541 /*! @name Attribute documentURI() (DOM Level 3) */
542 //@{
543 DOMString documentURI() const;
544 void documentURI(const DOMString&) const;
545 //@}
546
547 //! @name DOM Level 3 operations
548 //@{
549 Node adoptNode(const Node& source) const;
550 void normalizeDocument();
551 /*
552 void setNormalizationFeature(const DOMString& name,bool state);
553 bool getNormalizationFeature(const DOMString& name) const;
554 */
555 Node renameNode(const Node& node, const DOMString& namespace_uri,
556 const DOMString& name);
557 //@}
558
559 public:
560
561 friend class IDOM_Document;
562 friend class DOMImplementation;
563
564 public:
565
566 Document();
567 Document(const Node&);
568 Document(DocumentPrv*);
569
570 private:
571
572 DocumentPrv* _impl() const;
573};
574
575class ARCANE_CORE_EXPORT DocumentFragment
576: public Node
577{
578 public:
579
580 DocumentFragment();
581 DocumentFragment(DocumentFragmentPrv*);
582};
583
584/*---------------------------------------------------------------------------*/
585/*---------------------------------------------------------------------------*/
586
587/*!
588 * \internal
589 * \ingroup Xml
590 */
591class ARCANE_CORE_EXPORT NodeList
592{
593 public:
594
595 //! @name DOM Level 1 operations
596 //@{
597 Node item(ULong index) const;
598 ULong length() const;
599 //@}
600 public:
601
602 NodeList();
603 NodeList(NodeListPrv*);
604
605 private:
606
607 NodeListPrv* _impl() const;
608 NodeListPrv* m_p;
609 void _checkValid() const;
610};
611
612/*---------------------------------------------------------------------------*/
613/*---------------------------------------------------------------------------*/
614
615/*!
616 * \internal
617 * \ingroup Xml
618 */
619class ARCANE_CORE_EXPORT CharacterData
620: public Node
621{
622 public:
623
624 /*! @name Attribute data (DOM Level 1) */
625 //@{
626 DOMString data() const;
627 void data(const DOMString&) const;
628 //@}
629
630 /*! @name Attribute length (DOM Level 1) */
631 //@{
632 ULong length() const;
633 //@}
634
635 //! @name DOM Level 1 operations
636 //@{
637 DOMString substringData(ULong offset, ULong count) const;
638 void appendData(const DOMString& arg) const;
639 void insertData(ULong offset, const DOMString& arg) const;
640 void deleteData(ULong offset, ULong count) const;
641 void replaceData(ULong offset, ULong count, const DOMString& arg) const;
642 //@}
643 protected:
644
645 CharacterData();
646 CharacterData(const Node& from);
647 CharacterData(const CharacterData& from);
648 CharacterData(CharacterDataPrv*);
649 CharacterDataPrv* _impl() const;
650};
651
652class ARCANE_CORE_EXPORT Attr
653: public Node
654{
655 public:
656
657 /*! @name Attribute name (DOM Level 1) */
658 //@{
659 DOMString name() const;
660 //@}
661
662 /*! @name Attribute specified (DOM Level 1) */
663 //@{
664 bool specified() const;
665 //@}
666
667 /*! @name Attribute value (DOM Level 1) */
668 //@{
669 DOMString value() const;
670 void value(const DOMString& str) const;
671 //@}
672
673 /*! @name Attribute ownerElement (DOM Level 2) */
674 //@{
675 Element ownerElement() const;
676 //@}
677
678 public:
679
680 friend class IDOM_Attr;
681 friend class IDOM_Node;
682 friend class Element;
683
684 public:
685
686 Attr() = default;
687 Attr(const Node&);
688 Attr(AttrPrv*);
689
690 private:
691
692 AttrPrv* _impl() const;
693};
694
695/*---------------------------------------------------------------------------*/
696/*---------------------------------------------------------------------------*/
697
698class ARCANE_CORE_EXPORT Element
699: public Node
700{
701 public:
702
703 /*! @name Attribut tagName (DOM Level 1) */
704 //@{
705 DOMString tagName() const;
706 //@}
707
708 /*! @name DOM Level 1 operations */
709 //@{
710 DOMString getAttribute(const DOMString& name) const;
711 void setAttribute(const DOMString& name, const DOMString& value) const;
712 void removeAttribute(const DOMString& name) const;
713 Attr getAttributeNode(const DOMString& name) const;
714 Attr setAttributeNode(const Attr& new_attr) const;
715 Attr removeAttributeNode(const Attr& old_attr) const;
716 NodeList getElementsByTagName(const DOMString& name) const;
717 //@}
718 //@{ @name DOM Level 2 operations
719 DOMString getAttributeNS(const DOMString& namespace_uri, const DOMString& local_name) const;
720 void setAttributeNS(const DOMString& namespace_uri, const DOMString& qualified_name,
721 const DOMString& value) const;
722 void removeAttributeNS(const DOMString& namespace_uri, const DOMString& local_name) const;
723 Attr getAttributeNodeNS(const DOMString& namespace_uri, const DOMString& local_name) const;
724 Attr setAttributeNodeNS(const Attr& new_attr) const;
725 NodeList getElementsByTagNameNS(const DOMString& namespace_uri, const DOMString& local_name) const;
726 bool hasAttribute(const DOMString& name) const;
727 bool hasAttributeNS(const DOMString& namespace_uri, const DOMString& local_name) const;
728 //@}
729 public:
730
731 Element();
732 Element(const Element&);
733 Element(const Node&);
734
735 private:
736
737 Element(ElementPrv*);
738 friend class IDOM_Element;
739 friend class Attr;
740 friend class Document;
741 ElementPrv* _impl() const;
742};
743
744/*---------------------------------------------------------------------------*/
745/*---------------------------------------------------------------------------*/
746
747class ARCANE_CORE_EXPORT Text
748: public CharacterData
749{
750 public:
751
752 /*! @name DOM Level 1 operations */
753 //@{
754 Text splitText(ULong offset) const;
755 //@}
756 /*! @name Attribute isWhiteSpaceInElementContent (DOM Level 3) */
757 //@{
758 bool isWhiteSpaceInElementContent() const;
759 //@}
760 /*! @name Attribute wholeText() (DOM Level 3) */
761 //@{
762 DOMString wholeText() const;
763 //@}
764 /*! @name DOM Level 3 operations */
765 //@{
766 Text replaceWholeText(const DOMString& content) const;
767 //@}
768 public:
769
770 Text();
771 Text(const Text&);
772 Text(const Node&);
773 Text(TextPrv*);
774 TextPrv* _impl() const;
775 friend class Document;
776};
777
778/*---------------------------------------------------------------------------*/
779/*---------------------------------------------------------------------------*/
780
781class ARCANE_CORE_EXPORT Comment
782: public CharacterData
783{
784 public:
785
786 Comment();
787 Comment(CommentPrv*);
788
789 private:
790
791 CommentPrv* _impl() const;
792};
793
794class ARCANE_CORE_EXPORT CDATASection
795: public Text
796{
797 public:
798
799 CDATASection();
800 CDATASection(CDATASectionPrv*);
801
802 private:
803
804 CDATASectionPrv* _impl() const;
805};
806
807class DocumentType
808: public Node
809{
810 public:
811
812 /*! @name Attribute name() (DOM Level 1) */
813 //@{
814 DOMString name() const;
815 //@}
816
817 /*! @name Attribute entities() (DOM Level 1) */
818 //@{
819 NamedNodeMap entities() const;
820 //@}
821
822 /*! @name Attribute notations() (DOM Level 1) */
823 //@{
824 NamedNodeMap notations() const;
825 //@}
826 /*! @name Attribute publicId() (DOM Level 2) */
827 //@{
828 DOMString publicId() const;
829 //@}
830
831 /*! @name Attribute systemId() (DOM Level 2) */
832 //@{
833 DOMString systemId() const;
834 //@}
835
836 /*! @name Attribute internalSubset() (DOM Level 2) */
837 //@{
838 DOMString internalSubset() const;
839 //@}
840 public:
841
842 DocumentType(DocumentTypePrv*);
843 DocumentType();
844
845 private:
846
848 DocumentTypePrv* _impl() const;
849};
850
851/*---------------------------------------------------------------------------*/
852/*---------------------------------------------------------------------------*/
853
854class ARCANE_CORE_EXPORT Notation
855: public Node
856{
857 public:
858
859 /*! @name Attribute publicId() (DOM Level 1) */
860 //@{
861 DOMString publicId() const;
862 //@}
863
864 /*! @name Attribute systemId() (DOM Level 1) */
865 //@{
866 DOMString systemId() const;
867 //@}
868 private:
869
870 NotationPrv* _impl() const;
871};
872
873/*---------------------------------------------------------------------------*/
874/*---------------------------------------------------------------------------*/
875
876class ARCANE_CORE_EXPORT Entity
877: public Node
878{
879 public:
880
881 /*! @name Attribute publicId() (DOM Level 1) */
882 //@{
883 DOMString publicId() const;
884 //@}
885
886 /*! @name Attribute systemId() (DOM Level 1) */
887 //@{
888 DOMString systemId() const;
889 //@}
890
891 /*! @name Attribute notationName() (DOM Level 1) */
892 //@{
893 DOMString notationName() const;
894 //@}
895 /*! @name Attribute actualEncoding() (DOM Level 3) */
896 //@{
897 DOMString actualEncoding() const;
898 void actualEncoding(const DOMString&) const;
899 //@}
900
901 /*! @name Attribute encoding() (DOM Level 3) */
902 //@{
903 DOMString encoding() const;
904 void encoding(const DOMString&) const;
905 //@}
906
907 /*! @name Attribute version() (DOM Level 3) */
908 //@{
909 DOMString version() const;
910 void version(const DOMString&) const;
911 //@}
912 private:
913
914 EntityPrv* _impl() const;
915};
916
917/*---------------------------------------------------------------------------*/
918/*---------------------------------------------------------------------------*/
919
920class EntityReference
921: public Node
922{
923 public:
924
925 EntityReference();
926 EntityReference(EntityReferencePrv*);
927
928 private:
929
930 EntityReferencePrv* _impl() const;
931};
932
933/*---------------------------------------------------------------------------*/
934/*---------------------------------------------------------------------------*/
935
936class ARCANE_CORE_EXPORT ProcessingInstruction
937: public Node
938{
939 public:
940
941 /*! @name Attribute target() (DOM Level 1) */
942 //@{
943 DOMString target() const;
944 //@}
945
946 /*! @name Attribute data() (DOM Level 1) */
947 //@{
948 DOMString data() const;
949 void data(const DOMString& value) const;
950 //@}
951 public:
952
953 ProcessingInstruction();
954 ProcessingInstruction(ProcessingInstructionPrv*);
955
956 private:
957
958 ProcessingInstructionPrv* _impl() const;
959};
960
961/*---------------------------------------------------------------------------*/
962/*---------------------------------------------------------------------------*/
963
964class ARCANE_CORE_EXPORT NamedNodeMap
965{
966 public:
967
968 /*! @name Attribute length (DOM Level 1)*/
969 //@{
970 ULong length() const;
971 //@}
972 /*! @name DOM Level 1 operations */
973 //@{
974 Node getNamedItem(const DOMString& name) const;
975 Node setNamedItem(const Node& arg) const;
976 Node removeNamedItem(const DOMString& name) const;
977 Node item(ULong index) const;
978 //@}
979 /*! @name DOM Level 2 operations */
980 //@{
981 Node getNamedItemNS(const DOMString& namespace_uri, const DOMString& local_name) const;
982 Node setNamedItemNS(const Node& arg) const;
983 Node removeNamedItemNS(const DOMString& namespace_uri, const DOMString& local_name) const;
984 //@}
985 public:
986
987 bool _null() const;
988
989 public:
990
991 friend class IDOM_Node;
992 friend class IDOM_Element;
993 NamedNodeMap();
994 NamedNodeMap(NamedNodeMapPrv*);
995 ~NamedNodeMap();
996 NamedNodeMap(const NamedNodeMap& from);
997 const NamedNodeMap& operator=(const NamedNodeMap& from);
998
999 private:
1000
1001 //AutoRefT<NamedNodeMapPrv> m_p;
1002 NamedNodeMapPrv* m_p;
1003 NamedNodeMapPrv* _impl() const;
1004};
1005
1006/*---------------------------------------------------------------------------*/
1007/*---------------------------------------------------------------------------*/
1008
1010{
1011 public:
1012
1013 DOMImplementation getDOMImplementation(const DOMString& features) const;
1014};
1015
1016/*---------------------------------------------------------------------------*/
1017/*---------------------------------------------------------------------------*/
1018
1020{
1021 public:
1022
1023 //! @name OperationType
1024 //@{
1025 //! The node is cloned.
1026 static const UShort CLONED = 1;
1027 //! The node is imported.
1028 static const UShort IMPORTED = 2;
1029 //! The node is deleted.
1030 static const UShort DELETED = 3;
1031 //@}
1032
1033 void handle(UShort operation, const DOMString& key, const DOMObject& data,
1034 const Node& src, const Node& dest) const;
1035};
1036
1037/*---------------------------------------------------------------------------*/
1038/*---------------------------------------------------------------------------*/
1039
1040class DOMError
1041{
1042 public:
1043
1044 //! @name ErrorType
1045 //@{
1046 //! The severity of the error described by the DOMError is warning
1047 static const UShort SEVERITY_WARNING = 0;
1048 //! The severity of the error described by the DOMError is error
1049 static const UShort SEVERITY_ERROR = 1;
1050 //! The severity of the error described by the DOMError is fatal error
1051 static const UShort SEVERITY_FATAL_ERROR = 2;
1052 //@}
1053
1054 /*! @name Attribute severity (DOM Level 3) */
1055 //@{
1056 UShort severity() const;
1057 //@}
1058
1059 /*! @name Attribute message (DOM Level 3) */
1060 //@{
1061 DOMString message() const;
1062 //@}
1063
1064 /*! @name Attribute exception (DOM Level 3) */
1065 //@{
1066 DOMObject relatedException() const;
1067 //@}
1068
1069 /*! @name Attribute location (DOM Level 3) */
1070 //@{
1071 DOMLocator location() const;
1072 //@}
1073 public:
1074
1075 DOMError();
1076 DOMError(DOMErrorPrv*);
1077 ~DOMError();
1078 DOMError(const DOMError& from);
1079 const DOMError& operator=(const DOMError& from);
1080
1081 private:
1082
1083 DOMErrorPrv* m_p;
1084 DOMErrorPrv* _impl() const;
1085 bool _null() const;
1086 void _checkValid() const;
1087};
1088
1089/*---------------------------------------------------------------------------*/
1090/*---------------------------------------------------------------------------*/
1091
1093{
1094 public:
1095
1096 /*! @name DOM Level 3 operations */
1097 //@{
1098 bool handleError(const DOMError& error) const;
1099 //@}
1100};
1101
1102/*---------------------------------------------------------------------------*/
1103/*---------------------------------------------------------------------------*/
1104
1105class DOMLocator
1106{
1107 public:
1108
1109 /*! @name Attribute lineNumber (DOM Level 3) */
1110 //@{
1111 long lineNumber() const;
1112 //@}
1113 /*! @name Attribute columnNumber (DOM Level 3) */
1114 //@{
1115 long columnNumber() const;
1116 //@}
1117 /*! @name Attribute offset (DOM Level 3) */
1118 //@{
1119 long offset() const;
1120 //@}
1121 /*! @name Attribute errorNode (DOM Level 3) */
1122 //@{
1123 Node errorNode() const;
1124 //@}
1125 /*! @name Attribute uri (DOM Level 3) */
1126 //@{
1127 DOMString uri() const;
1128 //@}
1129 public:
1130
1131 friend class DOMError;
1132 DOMLocator();
1133 DOMLocator(DOMLocatorPrv*);
1134 ~DOMLocator();
1135 DOMLocator(const DOMLocator& from);
1136 const DOMLocator& operator=(const DOMLocator& from);
1137
1138 private:
1139
1140 DOMLocatorPrv* m_p;
1141 DOMLocatorPrv* _impl() const;
1142 bool _null() const;
1143 void _checkValid() const;
1144};
1145
1146/*---------------------------------------------------------------------------*/
1147/*---------------------------------------------------------------------------*/
1148
1149//! @name XPathExceptionCode
1150//@{
1151/*!
1152 If the expression is not a legal expression according to the rules
1153 of the specific XPathEvaluator or contains namespace prefixes which
1154 are not in scope according to the specified XPathNSResolver. If the
1155 XPathEvaluator was obtained by casting the document, the expression
1156 must be XPath 1.0 with no special extension functions.
1157*/
1158const unsigned short INVALID_EXPRESSION_ERR = 1;
1159/*!
1160 If the expression cannot be converted to return the specified type.
1161 Interface XPathEvaluator
1162*/
1163const unsigned short TYPE_ERR = 2;
1164//@}
1165
1166/*---------------------------------------------------------------------------*/
1167/*---------------------------------------------------------------------------*/
1168
1170{
1171 public:
1172
1173 unsigned short code;
1174};
1175
1176/*---------------------------------------------------------------------------*/
1177/*---------------------------------------------------------------------------*/
1178
1180{
1181 public:
1182
1183 XPathExpression createExpression(const DOMString& expression,
1184 const XPathNSResolver& resolver) const;
1185 XPathResult createResult() const;
1186 XPathNSResolver createNSResolver(const Node& node_resolver) const;
1187 XPathResult evaluate(const DOMString& expression,
1188 const Node& context_node,
1189 const XPathNSResolver& resolver,
1190 UShort type,
1191 const XPathResult& result) const;
1192
1193 XPathResult evaluateExpression(const XPathExpression& expression,
1194 const Node& context_node,
1195 UShort type,
1196 const XPathResult& result) const;
1197};
1198
1199/*---------------------------------------------------------------------------*/
1200/*---------------------------------------------------------------------------*/
1201
1203{
1204};
1205
1206/*---------------------------------------------------------------------------*/
1207/*---------------------------------------------------------------------------*/
1208
1210{
1211 public:
1212
1213 DOMString lookupNamespaceURI(const DOMString& prefix) const;
1214};
1215
1216/*---------------------------------------------------------------------------*/
1217/*---------------------------------------------------------------------------*/
1218
1220{
1221 public:
1222
1223 //! @name XPathResultType
1224 //@{
1225 /*!
1226 This code does not represent a specific type. An evaluation of an
1227 XPath expression will never produce this type. If this type is
1228 requested, then the evaluation must return whatever type Integerly
1229 results from evaluation of the expression.
1230 */
1231 static const UShort ANY_TYPE = 0;
1232 //! The result is a number as defined by XPath 1.0.
1233 static const UShort NUMBER_TYPE = 1;
1234 //! The result is a string as defined by XPath 1.0.
1235 static const UShort STRING_TYPE = 2;
1236 //! The result is a boolean as defined by XPath 1.0.
1237 static const UShort BOOLEAN_TYPE = 3;
1238 //! The result is a node set as defined by XPath 1.0.
1239 static const UShort NODE_SET_TYPE = 4;
1240 /*!
1241 The result is a single node, which may be any node of the node set
1242 defined by XPath 1.0, or null if the node set is empty. This is a
1243 convenience that permits optimization where the caller knows that
1244 no more than one such node exists because evaluation can stop
1245 after finding the one node of an expression that would otherwise
1246 return a node set (of type NODE_SET_TYPE).
1247
1248 Where it is possible that multiple nodes may exist and the first
1249 node in document order is required, a NODE_SET_TYPE should be
1250 processed using an ordered iterator, because there is no order
1251 guarantee for a single node.
1252 */
1253 static const UShort SINGLE_NODE_TYPE = 5;
1254 //@}
1255
1256 /*! @name Attribute resultType (DOM Level 3) */
1257 //@{
1258 UShort resultType() const;
1259 //@}
1260
1261 /*! @name Attribute numberValue (DOM Level 3) */
1262 //@{
1263 double numberValue() const;
1264 //@}
1265
1266 /*! @name AttributestringValue (DOM Level 3) */
1267 //@{
1268 DOMString stringValue() const;
1269 //@}
1270
1271 /*! @name Attribute booleanValue (DOM Level 3) */
1272 //@{
1273 bool booleanValue() const;
1274 //@}
1275
1276 /*! @name Attribute singleNodeValue (DOM Level 3) */
1277 //@{
1278 Node singleNodeValue() const;
1279 //@}
1280
1281 /*! @name DOM Level 3 operations */
1282 //@{
1283 XPathSetIterator getSetIterator(bool ordered) const;
1284 XPathSetSnapshot getSetSnapshot(bool ordered) const;
1285 //@}
1286};
1287
1288/*---------------------------------------------------------------------------*/
1289/*---------------------------------------------------------------------------*/
1290
1292{
1293 public:
1294
1295 Node nextNode() const;
1296};
1297
1299{
1300 public:
1301
1302 /*! @name Attribute length (DOM Level 3) */
1303 //@{
1304 ULong length() const;
1305 //@}
1306
1307 /*! @name DOM Level 3 operations */
1308 //@{
1309 Node item(ULong index) const;
1310 //@}
1311};
1312
1313/*---------------------------------------------------------------------------*/
1314/*---------------------------------------------------------------------------*/
1315
1317: public Node
1318{
1319 public:
1320
1321 //! @name XPathNodeType
1322 //@{
1323 //! The node is a Namespace.
1324 static const UShort XPATH_NAMESPACE_NODE = 13;
1325 //@}
1326
1327 /*! @name Attribute ownerElement (DOM Level 3) */
1328 //@{
1329 Element ownerElement() const;
1330 //@}
1331};
1332
1333/*---------------------------------------------------------------------------*/
1334/*---------------------------------------------------------------------------*/
1335
1336} // namespace Arcane::dom
1337
1338/*---------------------------------------------------------------------------*/
1339/*---------------------------------------------------------------------------*/
1340
1341#endif
Manager of a DOM document.
static const UShort SEVERITY_ERROR
The severity of the error described by the DOMError is error.
Definition Dom.h:1049
static const UShort SEVERITY_WARNING
The severity of the error described by the DOMError is warning.
Definition Dom.h:1047
static const UShort SEVERITY_FATAL_ERROR
The severity of the error described by the DOMError is fatal error.
Definition Dom.h:1051
UShort code
The code of the exception.
Definition Dom.h:113
IXmlDocumentHolder * _load(const String &fname, ITraceMng *msg, const String &schemaname)
IXmlDocumentHolder * _newDocument()
The following methods are internal to Arcane.
NodePrv * m_p
Class implementation.
Definition Dom.h:430
static const UShort DOCUMENT_FRAGMENT_NODE
The node is a DocumentFragment.
Definition Dom.h:252
static const UShort TREE_POSITION_PRECEDING
The node precedes the reference node.
Definition Dom.h:352
static const UShort TREE_POSITION_ANCESTOR
The node is an ancestor of the reference node.
Definition Dom.h:356
static const UShort ATTRIBUTE_NODE
The node is an Attr.
Definition Dom.h:234
static const UShort ENTITY_REFERENCE_NODE
The node is an EntityReference.
Definition Dom.h:240
static const UShort COMMENT_NODE
The node is a Comment.
Definition Dom.h:246
static const UShort TREE_POSITION_SAME
Definition Dom.h:361
void releaseNode()
Destroys the node.
static const UShort TREE_POSITION_DISCONNECTED
The two nodes are disconnected, they do not have any common ancestor.
Definition Dom.h:369
static const UShort TREE_POSITION_DESCENDANT
The node is a descendant of the reference node.
Definition Dom.h:358
static const UShort DOCUMENT_TYPE_NODE
The node is a DocumentType.
Definition Dom.h:250
static const UShort TREE_POSITION_FOLLOWING
The node follows the reference node.
Definition Dom.h:354
static const UShort ENTITY_NODE
The node is an Entity.
Definition Dom.h:242
static const UShort DOCUMENT_NODE
The node is a Document.
Definition Dom.h:248
static const UShort CDATA_SECTION_NODE
The node is a CDATASection.
Definition Dom.h:238
static const UShort TREE_POSITION_EXACT_SAME
Definition Dom.h:367
static const UShort PROCESSING_INSTRUCTION_NODE
The node is a ProcessingInstruction.
Definition Dom.h:244
static const UShort ELEMENT_NODE
The node is an Element.
Definition Dom.h:232
static const UShort TEXT_NODE
The node is a Text node.
Definition Dom.h:236
static const UShort NOTATION_NODE
The node is a Notation.
Definition Dom.h:254
static const UShort IMPORTED
The node is imported.
Definition Dom.h:1028
static const UShort CLONED
The node is cloned.
Definition Dom.h:1026
static const UShort DELETED
The node is deleted.
Definition Dom.h:1030
static const UShort XPATH_NAMESPACE_NODE
The node is a Namespace.
Definition Dom.h:1324
static const UShort NUMBER_TYPE
The result is a number as defined by XPath 1.0.
Definition Dom.h:1233
static const UShort SINGLE_NODE_TYPE
Definition Dom.h:1253
static const UShort STRING_TYPE
The result is a string as defined by XPath 1.0.
Definition Dom.h:1235
static const UShort ANY_TYPE
Definition Dom.h:1231
static const UShort BOOLEAN_TYPE
The result is a boolean as defined by XPath 1.0.
Definition Dom.h:1237
static const UShort NODE_SET_TYPE
The result is a node set as defined by XPath 1.0.
Definition Dom.h:1239
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Array< Byte > ByteArray
Dynamic one-dimensional array of characters.
Definition UtilsTypes.h:121
UniqueArray< Byte > ByteUniqueArray
Dynamic 1D array of characters.
Definition UtilsTypes.h:335
Span< const std::byte > ByteConstSpan
Read-only view of a 1D array of characters.
Definition UtilsTypes.h:548
ConstArrayView< Byte > ByteConstArrayView
C equivalent of a 1D array of characters.
Definition UtilsTypes.h:476