Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
DomUtils.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/* DomUtils.h (C) 2000-2025 */
9/* */
10/* Various utility functions concerning the DOM. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_DOMUTILS_H
13#define ARCANE_CORE_DOMUTILS_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/Dom.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22/*
23 * The methods in this file are internal to Arcane and should not
24 * be used elsewhere.
25 */
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30namespace Arcane::domutils
31{
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35
36// If the node is an element, returns the concatenation of its text children,
37// otherwise, returns nodeValue().
38// Use textContext() instead
39extern "C++" ARCANE_DEPRECATED_260 ARCANE_CORE_EXPORT String
40textValue(const dom::Node& node);
41
42// Use textContext() instead
43extern "C++" ARCANE_DEPRECATED_260 ARCANE_CORE_EXPORT void
44textValue(dom::Node& node, const String& new_value);
45
46extern "C++" ARCANE_CORE_EXPORT String
47textContent(const dom::Node& node);
48
49extern "C++" ARCANE_CORE_EXPORT void
50textContent(dom::Node& node, const String& new_value);
51
52extern "C++" ARCANE_CORE_EXPORT dom::Element
53createElement(const dom::Node& parent, const String& name, const String& value);
54
55extern "C++" ARCANE_CORE_EXPORT String
56attrValue(const dom::Node& node, const String& attr_name);
57
58extern "C++" ARCANE_CORE_EXPORT void
59setAttr(const dom::Element& node, const String& name, const String& value);
60
61extern "C++" ARCANE_CORE_EXPORT dom::Node
62childNode(const dom::Node& parent, const String& child_name);
63
64extern "C++" ARCANE_CORE_EXPORT dom::Node
65nodeFromXPath(const dom::Node& context_node, const String& xpath_expr);
66
67extern "C++" ARCANE_DEPRECATED_260 ARCANE_CORE_EXPORT bool
68saveDocument(std::ostream& istr, const dom::Document&, int indent_level = -1);
69
70extern "C++" ARCANE_CORE_EXPORT bool
71saveDocument(ByteArray& bytes, const dom::Document&, int indent_level = -1);
72
73extern "C++" ARCANE_CORE_EXPORT IXmlDocumentHolder*
74createXmlDocument();
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
78
83class ARCANE_CORE_EXPORT NameIterator
84{
85 public:
86
87 NameIterator(const dom::Node& from, const String& ref_name);
88 //NameIterator(const dom::Node& from,const char* ref_name);
89 bool operator()() const { return !m_current._null(); }
90 void operator++() { _findNextValid(false); }
91 const dom::Node& operator*() const { return m_current; }
92 const dom::Node* operator->() const { return &m_current; }
93
94 private:
95
96 dom::Node m_parent;
97 dom::Node m_current;
98 dom::DOMString m_ref_name;
99
100 private:
101
102 void _findNextValid(bool is_init);
103};
104
105/*---------------------------------------------------------------------------*/
106/*---------------------------------------------------------------------------*/
107
108} // namespace Arcane::domutils
109
110/*---------------------------------------------------------------------------*/
111/*---------------------------------------------------------------------------*/
112
113#endif
Array< Byte > ByteArray
Dynamic one-dimensional array of characters.
Definition UtilsTypes.h:121