14#include "arcane/utils/NotImplementedException.h"
15#include "arcane/utils/Array.h"
16#include "arcane/utils/Iostream.h"
17#include "arcane/utils/ScopedPtr.h"
18#include "arcane/utils/StdHeader.h"
19#include "arcane/utils/ITraceMng.h"
20#include "arcane/utils/OStringStream.h"
21#include "arcane/utils/TraceInfo.h"
22#include "arcane/utils/StringBuilder.h"
23#include "arcane/utils/CheckedConvert.h"
25#include "arcane/core/Dom.h"
26#include "arcane/core/DomUtils.h"
27#include "arcane/core/ISharedReference.h"
28#include "arcane/core/XmlNode.h"
29#include "arcane/core/IXmlDocumentHolder.h"
30#include "arcane/core/XmlException.h"
32#include <libxml/tree.h>
33#include <libxml/parser.h>
34#include <libxml/xmlsave.h>
35#include <libxml/parserInternals.h>
36#include <libxml/xinclude.h>
37#include <libxml/xmlschemas.h>
50class LibXml2_DOMImplementation;
74static xmlNodePtr impl(NodePrv* p) {
return (xmlNodePtr)p; }
75static xmlAttrPtr impl(AttrPrv* p) {
return (xmlAttrPtr)p; }
76static xmlElementPtr impl(ElementPrv* p) {
return (xmlElementPtr)p; }
77static xmlNamedNodeMapPtr impl(NamedNodeMapPrv* p) {
return (xmlNamedNodeMapPtr)p; }
78static xmlDocPtr impl(DocumentPrv* p) {
return (xmlDocPtr)p; }
79static xmlDocTypePtr impl(DocumentTypePrv* p) {
return (xmlDocTypePtr)p; }
80[[maybe_unused]]
static LibXml2_DOMImplementation* impl(ImplementationPrv* p) {
return (LibXml2_DOMImplementation*)p; }
81static xmlCharacterDataPtr impl(CharacterDataPrv* p) {
return (xmlCharacterDataPtr)p; }
82static xmlTextPtr impl(TextPrv* p) {
return (xmlTextPtr)p; }
83[[maybe_unused]]
static xmlNodeListPtr impl(NodeListPrv* p) {
return (xmlNodeListPtr)p; }
84static xmlDocumentFragmentPtr impl(DocumentFragmentPrv* p) {
return (xmlDocumentFragmentPtr)p; }
85static xmlCDATAPtr impl(CDATASectionPrv* p) {
return (xmlCDATAPtr)p; }
86static xmlProcessingInstructionPtr impl(ProcessingInstructionPrv* p) {
return (xmlProcessingInstructionPtr)p; }
87static xmlEntityReferencePtr impl(EntityReferencePrv* p) {
return (xmlEntityReferencePtr)p; }
88[[maybe_unused]]
static xmlEntityPtr impl(EntityPrv* p) {
return (xmlEntityPtr)p; }
89[[maybe_unused]]
static xmlNotationPtr impl(NotationPrv* p) {
return (xmlNotationPtr)p; }
93static NodePrv* cvt(xmlNodePtr p) {
return (NodePrv*)p; }
94static AttrPrv* cvt(xmlAttrPtr p) {
return (AttrPrv*)p; }
95static ElementPrv* cvt(xmlElementPtr p) {
return (ElementPrv*)p; }
96static NamedNodeMapPrv* cvt(xmlNamedNodeMapPtr p) {
return (NamedNodeMapPrv*)p; }
97static DocumentPrv* cvt(xmlDocPtr p) {
return (DocumentPrv*)p; }
98static DocumentTypePrv* cvt(xmlDocTypePtr p) {
return (DocumentTypePrv*)p; }
99static ImplementationPrv* cvt(LibXml2_DOMImplementation* p) {
return (ImplementationPrv*)p; }
100static CharacterDataPrv* cvt(xmlCharacterDataPtr p) {
return (CharacterDataPrv*)p; }
101static TextPrv* cvt(xmlTextPtr p) {
return (TextPrv*)p; }
102[[maybe_unused]]
static NodeListPrv* cvt(xmlNodeListPtr p) {
return (NodeListPrv*)p; }
103[[maybe_unused]]
static DocumentFragmentPrv* cvt(xmlDocumentFragmentPtr p) {
return (DocumentFragmentPrv*)p; }
104[[maybe_unused]]
static CommentPrv* cvt(xmlCommentPtr p) {
return (CommentPrv*)p; }
105[[maybe_unused]]
static CDATASectionPrv* cvt(xmlCDATAPtr p) {
return (CDATASectionPrv*)p; }
106static ProcessingInstructionPrv* cvt(xmlProcessingInstructionPtr p) {
return (ProcessingInstructionPrv*)p; }
107[[maybe_unused]]
static EntityReferencePrv* cvt(xmlEntityReferencePtr p) {
return (EntityReferencePrv*)p; }
108static EntityPrv* cvt(xmlEntityPtr p) {
return (EntityPrv*)p; }
109static NotationPrv* cvt(xmlNotationPtr p) {
return (NotationPrv*)p; }
117domStringToXmlChar(
const String& str)
119 const xmlChar* ch =
reinterpret_cast<const xmlChar*
>(str.utf8().data());
124toChar(
const String& value)
126 return domStringToXmlChar(value);
129String fromChar(
const xmlChar* value)
136 return DOMString(bytes);
139String fromCharAndFree(xmlChar* value)
143 String s(fromChar(value));
151NodePrv* toNodePrv(
const Node& node)
162#define TNIE throw NotImplementedException(A_FUNCINFO)
173 return &sDOMImplementation;
197 ::xmlSetStructuredErrorFunc(
nullptr,
nullptr);
203 static void XMLCDECL
handler(
void* user_data,T* e)
213 const String& errorMessage()
const {
return m_error_message; }
217 void addError(
const xmlError* e)
220 if (e->level==XML_ERR_WARNING)
222 else if (e->level==XML_ERR_ERROR)
224 else if (e->level==XML_ERR_FATAL)
245 m_error_message = m_error_message + sb.
toString();
252class ILibXml2_Reader;
263 : m_file_name(file_name), m_trace(trace), m_options(0)
280 const String& fileName()
const {
return m_file_name; }
281 int options()
const {
return m_options; }
300 : m_schema_file_name(schema_file_name),m_schema_parser_context(
nullptr),
301 m_schema_ptr(
nullptr), m_schema_valid_context(
nullptr)
321 String m_schema_file_name;
322 ::xmlSchemaParserCtxtPtr m_schema_parser_context;
323 ::xmlSchemaPtr m_schema_ptr;
324 ::xmlSchemaValidCtxtPtr m_schema_valid_context;
328 if (m_schema_parser_context){
329 ::xmlSchemaFreeParserCtxt(m_schema_parser_context);
330 m_schema_parser_context =
nullptr;
333 ::xmlSchemaFree(m_schema_ptr);
334 m_schema_ptr =
nullptr;
336 if (m_schema_valid_context){
337 ::xmlSchemaFreeValidCtxt(m_schema_valid_context);
338 m_schema_valid_context =
nullptr;
362 : m_buffer(buffer) {}
366 const char* encoding =
nullptr;
367 int options = parser.options();
368 const char* buf_base =
reinterpret_cast<const char*
>(m_buffer.data());
373 while (buf_size > 0 &&
static_cast<char>(m_buffer[buf_size - 1]) ==
'\0') {
376 const String& name = parser.fileName();
377 ::xmlParserCtxtPtr ctxt = ::xmlNewParserCtxt();
378 ::xmlDocPtr doc = ::xmlCtxtReadMemory(ctxt,buf_base,buf_size,
380 ::xmlFreeParserCtxt(ctxt);
395 : m_file_name(file_name) {}
399 const char* encoding =
nullptr;
400 int options = parser.options();
401 const char* file_name = m_file_name.
localstr();
402 ::xmlParserCtxtPtr ctxt = ::xmlNewParserCtxt();
403 ::xmlDocPtr doc = ::xmlCtxtReadFile(ctxt,file_name,encoding,options);
404 ::xmlFreeParserCtxt(ctxt);
419 : m_document(
nullptr), m_document_node(
nullptr)
424 ::xmlDocPtr doc = impl(m_document);
433 domimp._save(bytes,m_document,(-1));
440 String new_s = String::fromUtf8(bytes);
446 void assignDocument(DocumentPrv* doc)
449 m_document_node = (NodePrv*)doc;
451 DocumentPrv* _document()
const {
return m_document; }
453 DocumentPrv* m_document;
454 NodePrv* m_document_node;
464 m_p = cvt(LibXml2_DOMImplementation::getImplementation());
468DOMImplementation(ImplementationPrv* prv)
478void DOMImplementation::
485ImplementationPrv* DOMImplementation::
491bool DOMImplementation::
492hasFeature(
const DOMString& feature,
const DOMString& version)
const
494 ARCANE_UNUSED(feature);
495 ARCANE_UNUSED(version);
501DocumentType DOMImplementation::
502createDocumentType(
const DOMString& qualified_name,
const DOMString& public_id,
503 const DOMString& system_id)
const
505 ARCANE_UNUSED(qualified_name);
506 ARCANE_UNUSED(public_id);
507 ARCANE_UNUSED(system_id);
514DOMImplementation DOMImplementation::
515getInterface(
const DOMString& feature)
const
518 ARCANE_UNUSED(feature);
519 throw NotImplementedException(A_FUNCINFO);
522DOMWriter DOMImplementation::
523createDOMWriter()
const
526 throw NotImplementedException(A_FUNCINFO);
534Document DOMImplementation::
535createDocument(
const DOMString& namespace_uri,
const DOMString& qualified_name,
536 const DocumentType& doctype)
const
538 if (!namespace_uri.null())
539 ARCANE_THROW(NotImplementedException,
"non nul namespace-uri");
540 if (!qualified_name.null())
541 ARCANE_THROW(NotImplementedException,
"non nul qualified-name");
542 if (!doctype._null())
543 ARCANE_THROW(NotImplementedException,
"non nul doctype");
544 const xmlChar* xml_version =
nullptr;
545 xmlDocPtr doc = ::xmlNewDoc(xml_version);
552String DOMImplementation::
553_implementationName()
const
564 Document _doc = createDocument(DOMString(),DOMString(),DocumentType());
565 auto xml_doc =
new XmlDocumentHolderLibXml2();
566 xml_doc->assignDocument(_doc._impl());
574_load(
const String& fname,ITraceMng* msg,
const String& schemaname)
583_load(
const String& fname,ITraceMng* trace,
const String& schema_name,
587 LibXml2_FileReader reader(fname);
588 LibXml2_Parser parser(fname,trace);
589 auto doc_holder = parser.parse(&reader,schema_name,schema_data);
601 return new XmlDocumentHolderLibXml2();
603 LibXml2_MemoryReader reader(buffer);
604 LibXml2_Parser parser(name,trace);
612void DOMImplementation::
613_save(
ByteArray& bytes,
const Document& document,
int indent_level)
615 ARCANE_UNUSED(indent_level);
625 xmlDocPtr doc = impl(document._impl());
626 xmlBufferPtr buf = ::xmlBufferCreate();
629 if (indent_level > 0)
630 options = XML_SAVE_FORMAT;
631 xmlSaveCtxtPtr ctx = ::xmlSaveToBuffer(buf,
nullptr,options);
632 (void)::xmlSaveDoc(ctx,doc);
633 (void)::xmlSaveClose(ctx);
635 const xmlChar* content = ::xmlBufferContent(buf);
636 size_t content_len = ::xmlBufferLength(buf);
640 bytes.copy(buf_view);
642 ::xmlBufferFree(buf);
654 m_options |= XML_PARSE_DTDLOAD | XML_PARSE_NOENT | XML_PARSE_DTDATTR;
655 m_options |= XML_PARSE_XINCLUDE;
657 ::xmlDocPtr doc_ptr =
nullptr;
664 doc_ptr = reader->read(*
this);
668 err_handler.errorMessage());
671 xml_parser->assignDocument(cvt(doc_ptr));
675 int nb_xinclude = ::xmlXIncludeProcess(doc_ptr);
676 if (nb_xinclude==(-1))
678 err_handler.errorMessage());
682 String err_message = err_handler.errorMessage();
683 if (m_trace && !err_message.
null())
684 m_trace->
info() <<
"Info parsing document " << fileName() <<
" : " << err_message;
692 validator.
validate(doc_ptr,schema_data);
695 return xml_parser.release();
707 if (m_schema_file_name.
null() && schema_data.
empty())
711 if (!schema_data.
empty()){
712 auto base_ptr =
reinterpret_cast<const char*
>(schema_data.
data());
713 m_schema_parser_context = ::xmlSchemaNewMemParserCtxt(base_ptr,schema_data.
size());
716 m_schema_parser_context = ::xmlSchemaNewParserCtxt(m_schema_file_name.
localstr());
717 if (!m_schema_parser_context)
719 m_schema_ptr = xmlSchemaParse(m_schema_parser_context);
722 err_handler.errorMessage());
723 m_schema_valid_context = xmlSchemaNewValidCtxt(m_schema_ptr);
724 if (!m_schema_valid_context)
726 m_schema_file_name,err_handler.errorMessage());
727 xmlSchemaSetValidOptions(m_schema_valid_context, XML_SCHEMA_VAL_VC_I_CREATE);
728 int result = xmlSchemaValidateDoc(m_schema_valid_context, doc_ptr);
731 m_schema_file_name,err_handler.errorMessage());
750Node(
const Node& from)
755operator=(
const Node& from)
786 return (UShort)(impl(
m_p)->type);
792 ::xmlNodePtr first_children = impl(
m_p)->children;
793 return cvt(first_children);
803previousSibling()
const
813 xmlNodePtr next_node = impl(
m_p)->next;
814 return cvt(next_node);
820 return cvt(impl(
m_p)->parent);
835 return fromChar(impl(
m_p)->name);
841 ::xmlNodePtr xelement = impl(
m_p);
842 xmlAttrPtr p = xelement->properties;
843 return cvt((xmlNamedNodeMapPtr)(p));
849 ::xmlNodePtr node = impl(
m_p);
850 return cvt(node->doc);
856 xmlChar* content = ::xmlNodeGetContent(impl(
m_p));
857 return fromCharAndFree(content);
860nodeValue(
const DOMString& str)
const
868_assign(
const Node& node)
873insertBefore(
const Node& new_child,
const Node& ref_child)
const
875 ARCANE_UNUSED(new_child);
876 ARCANE_UNUSED(ref_child);
882replaceChild(
const Node& new_child,
const Node& old_child)
const
884 ARCANE_UNUSED(new_child);
885 ARCANE_UNUSED(old_child);
891removeChild(
const Node& old_child)
const
894 ::xmlNodePtr xchild = impl(old_child._impl());
897 ::xmlUnlinkNode(xchild);
901appendChild(
const Node& new_child)
const
904 return cvt(::xmlAddChild(impl(
m_p),impl(new_child._impl())));
914cloneNode(
bool deep)
const
929prefix(
const DOMString& new_prefix)
const
932 ARCANE_UNUSED(new_prefix);
944isSupported(
const DOMString& feature,
const DOMString& version)
const
946 ARCANE_UNUSED(feature);
947 ARCANE_UNUSED(version);
963 return fromChar(impl(
m_p)->name);
980textContent(
const DOMString& value)
const
983 ARCANE_UNUSED(value);
988isSameNode(
const Node& node)
const
996isEqualNode(
const Node& other)
const
999 ARCANE_UNUSED(other);
1004isDefaultNamespace(
const DOMString& namespace_uri)
const
1007 ARCANE_UNUSED(namespace_uri);
1012lookupNamespaceURI(
const DOMString& prefix)
const
1015 ARCANE_UNUSED(prefix);
1020setUserData(
const DOMString& key,
const DOMObject& data,
1021 const UserDataHandler& handler)
const
1025 ARCANE_UNUSED(data);
1026 ARCANE_UNUSED(handler);
1027 throw NotImplementedException(A_FUNCINFO);
1030getUserData(
const DOMString& key)
const
1040 ::xmlNodePtr xnode = impl(
m_p);
1042 ::xmlFreeNode(xnode);
1045operator==(
const Node& n1,
const Node& n2)
1047 return impl(n1.
m_p) == impl(n2.
m_p);
1050operator!=(
const Node& n1,
const Node& n2)
1052 return ! operator==(n1,n2);
1059CharacterData(CharacterDataPrv* v)
1060: Node(cvt((xmlNodePtr)impl(v)))
1069CharacterData(
const CharacterData& node)
1075CharacterData(
const Node& node)
1079 ARCANE_UNUSED(node);
1085CharacterDataPrv* CharacterData::
1097: CharacterData(cvt((xmlCharacterDataPtr)impl(v)))
1104Text(
const Text& node)
1105: CharacterData(node)
1109Text(
const Node& node)
1113 ARCANE_UNUSED(node);
1121 return cvt((xmlTextPtr)impl(
m_p));
1140Document(DocumentPrv* p)
1141: Node(cvt((xmlNodePtr)impl(p)))
1144Document(
const Node& node)
1147 NodePrv* ni= node._impl();
1148 if (ni && impl(ni)->type==XML_DOCUMENT_NODE)
1151DocumentPrv* Document::
1154 return cvt((xmlDocPtr)impl(
m_p));
1156DocumentType Document::
1163DOMImplementation Document::
1164implementation()
const
1171documentElement()
const
1174 xmlDocPtr xdoc = impl(_impl());
1175 xmlNodePtr xnode = ::xmlDocGetRootElement(xdoc);
1176 return cvt((xmlElementPtr)xnode);
1179createElement(
const DOMString& name)
const
1182 xmlDocPtr xdoc = impl(_impl());
1183 xmlNsPtr nspace =
nullptr;
1184 xmlChar* content =
nullptr;
1185 xmlNodePtr xnode = ::xmlNewDocNode(xdoc,nspace,toChar(name),content);
1186 return cvt((xmlElementPtr)xnode);
1188DocumentFragment Document::
1189createDocumentFragment()
const
1196createTextNode(
const DOMString& data)
const
1199 xmlDocPtr xdoc = impl(_impl());
1200 return cvt((xmlTextPtr)::xmlNewDocText(xdoc,toChar(data)));
1203createComment(
const DOMString& data)
const
1207 ARCANE_UNUSED(data);
1210CDATASection Document::
1211createCDATASection(
const DOMString& data)
const
1215 ARCANE_UNUSED(data);
1218ProcessingInstruction Document::
1219createProcessingInstruction(
const DOMString& target,
1220 const DOMString& data)
const
1223 ARCANE_UNUSED(target);
1224 ARCANE_UNUSED(data);
1230createAttribute(
const DOMString& name)
const
1233 ARCANE_UNUSED(name);
1238EntityReference Document::
1239createEntityReference(
const DOMString& name)
const
1242 ARCANE_UNUSED(name);
1247getElementsByTagName(
const DOMString& tagname)
const
1250 ARCANE_UNUSED(tagname);
1255importNode(
const Node& imported_node,
bool deep)
const
1258 ARCANE_UNUSED(imported_node);
1259 ARCANE_UNUSED(deep);
1264createElementNS(
const DOMString& namespace_uri,
const DOMString& qualified_name)
const
1267 ARCANE_UNUSED(namespace_uri);
1268 ARCANE_UNUSED(qualified_name);
1273createAttributeNS(
const DOMString& namespace_uri,
const DOMString& qualified_name)
const
1276 ARCANE_UNUSED(namespace_uri);
1277 ARCANE_UNUSED(qualified_name);
1282getElementsByTagNameNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1285 ARCANE_UNUSED(namespace_uri);
1286 ARCANE_UNUSED(local_name);
1291getElementById(
const DOMString& element_id)
const
1295 ARCANE_UNUSED(element_id);
1299actualEncoding()
const
1306actualEncoding(
const DOMString& value)
const
1309 ARCANE_UNUSED(value);
1310 throw NotImplementedException(A_FUNCINFO);
1317 throw NotImplementedException(A_FUNCINFO);
1321encoding(
const DOMString& value)
const
1324 ARCANE_UNUSED(value);
1325 throw NotImplementedException(A_FUNCINFO);
1332 throw NotImplementedException(A_FUNCINFO);
1336standalone(
bool value)
const
1339 ARCANE_UNUSED(value);
1340 throw NotImplementedException(A_FUNCINFO);
1344strictErrorChecking()
const
1351strictErrorChecking(
bool value)
const
1354 ARCANE_UNUSED(value);
1359documentURI(
const DOMString& document_uri)
const
1362 ARCANE_UNUSED(document_uri);
1375adoptNode(
const Node& source)
const
1379 ARCANE_UNUSED(source);
1390renameNode(
const Node& node,
const DOMString& namespace_uri,
1391 const DOMString& name)
1395 ARCANE_UNUSED(node);
1396 ARCANE_UNUSED(namespace_uri);
1397 ARCANE_UNUSED(name);
1410DocumentFragment(DocumentFragmentPrv* prv)
1411: Node(cvt((xmlNodePtr)impl(prv)))
1422Comment(CommentPrv* prv)
1423: CharacterData((CharacterDataPrv*)prv)
1434CDATASection(CDATASectionPrv* prv)
1435: Text(cvt((xmlTextPtr)impl(prv)))
1446EntityReference(EntityReferencePrv* prv)
1447: Node(cvt((xmlNodePtr)impl(prv)))
1458NodeList(NodeListPrv* prv)
1469item(ULong index)
const
1472 ARCANE_UNUSED(index);
1487DOMString CharacterData::
1495data(
const DOMString& value)
const
1498 ARCANE_UNUSED(value);
1502ULong CharacterData::
1509DOMString CharacterData::
1510substringData(ULong offset,ULong count)
const
1513 ARCANE_UNUSED(offset);
1514 ARCANE_UNUSED(count);
1519appendData(
const DOMString& arg)
const
1527insertData(ULong offset,
const DOMString& arg)
const
1530 ARCANE_UNUSED(offset);
1536deleteData(ULong offset,ULong count)
const
1539 ARCANE_UNUSED(offset);
1540 ARCANE_UNUSED(count);
1545replaceData(ULong offset,ULong count,
const DOMString& arg)
const
1549 ARCANE_UNUSED(offset);
1550 ARCANE_UNUSED(count);
1560: Node(cvt((xmlNodePtr)impl(p)))
1565Attr(
const Node& node)
1568 ARCANE_UNUSED(node);
1578 return cvt((xmlAttrPtr)impl(
m_p));
1602value(
const DOMString& str)
const
1625Element(ElementPrv* p)
1626: Node(cvt((xmlNodePtr)impl(p)))
1629Element(
const Node& node)
1632 NodePrv* ni= node._impl();
1633 if (ni && impl(ni)->type==XML_ELEMENT_NODE)
1637Element(
const Element& node)
1640ElementPrv* Element::
1643 return cvt((xmlElementPtr)impl(
m_p));
1654getAttribute(
const DOMString& name)
const
1657 Attr a = getAttributeNode(name);
1660 return fromChar(::xmlGetProp(impl(
m_p),toChar(name)));
1663setAttribute(
const DOMString& name,
const DOMString& value)
const
1666 ::xmlSetProp(impl(
m_p),toChar(name),toChar(value));
1669removeAttribute(
const DOMString& name)
const
1672 ARCANE_UNUSED(name);
1677getAttributeNode(
const DOMString& name)
const
1680 xmlElementPtr elem_ptr = (xmlElementPtr)(impl(_impl()));
1681 return cvt(::xmlHasProp((xmlNodePtr)elem_ptr,toChar(name)));
1684setAttributeNode(
const Attr& new_attr)
const
1687 ARCANE_UNUSED(new_attr);
1692removeAttributeNode(
const Attr& old_attr)
const
1695 ARCANE_UNUSED(old_attr);
1700getElementsByTagName(
const DOMString& name)
const
1703 ARCANE_UNUSED(name);
1708getAttributeNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1711 ARCANE_UNUSED(namespace_uri);
1712 ARCANE_UNUSED(local_name);
1717setAttributeNS(
const DOMString& namespace_uri,
const DOMString& local_name,
1718 const DOMString& value)
const
1721 ARCANE_UNUSED(namespace_uri);
1722 ARCANE_UNUSED(local_name);
1723 ARCANE_UNUSED(value);
1728removeAttributeNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1731 ARCANE_UNUSED(namespace_uri);
1732 ARCANE_UNUSED(local_name);
1737getAttributeNodeNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1740 ARCANE_UNUSED(namespace_uri);
1741 ARCANE_UNUSED(local_name);
1746setAttributeNodeNS(
const Attr& new_attr)
const
1749 new_attr._checkValid();
1754getElementsByTagNameNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1757 ARCANE_UNUSED(namespace_uri);
1758 ARCANE_UNUSED(local_name);
1763hasAttribute(
const DOMString& name)
const
1766 ARCANE_UNUSED(name);
1771hasAttributeNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1774 ARCANE_UNUSED(namespace_uri);
1775 ARCANE_UNUSED(local_name);
1784splitText(ULong offset)
const
1787 ARCANE_UNUSED(offset);
1799replaceWholeText(
const DOMString& content)
const
1802 ARCANE_UNUSED(content);
1815DocumentType(DocumentTypePrv* prv)
1816: Node(cvt((xmlNodePtr)impl(prv)))
1818DocumentTypePrv* DocumentType::
1821 return cvt((xmlDocTypePtr)impl(
m_p));
1823DOMString DocumentType::
1830NamedNodeMap DocumentType::
1837NamedNodeMap DocumentType::
1844DOMString DocumentType::
1851DOMString DocumentType::
1858DOMString DocumentType::
1859internalSubset()
const
1869NotationPrv* Notation::
1872 return cvt((xmlNotationPtr)impl(
m_p));
1897 return cvt((xmlEntityPtr)impl(
m_p));
1925ProcessingInstruction::
1926ProcessingInstruction()
1929ProcessingInstruction::
1930ProcessingInstruction(ProcessingInstructionPrv* prv)
1931: Node(cvt((xmlNodePtr)impl(prv)))
1933ProcessingInstructionPrv* ProcessingInstruction::
1936 return cvt((xmlProcessingInstructionPtr)impl(
m_p));
1939DOMString ProcessingInstruction::
1946DOMString ProcessingInstruction::
1953void ProcessingInstruction::
1954data(
const DOMString& value)
const
1957 ARCANE_UNUSED(value);
1970NamedNodeMap(NamedNodeMapPrv* p)
1974NamedNodeMap(
const NamedNodeMap& from)
1977const NamedNodeMap& NamedNodeMap::
1978operator=(
const NamedNodeMap& from)
1986NamedNodeMapPrv* NamedNodeMap::
2002 ::xmlNodePtr xnode = (::xmlNodePtr)impl(m_p);
2005 xnode = xnode->next;
2010getNamedItem(
const DOMString& name)
const
2021 ::xmlAttrPtr xattrlist = (::xmlAttrPtr)impl(m_p);
2022 const ::xmlChar* aname = toChar(name);
2023 ::xmlAttrPtr current = xattrlist;
2025 if (current->type==XML_ATTRIBUTE_NODE && current->ns){
2026 std::string full_name = (
const char*)(current->ns->prefix);
2028 full_name += (
const char*)(current->name);
2029 if (xmlStrEqual(aname, (
const xmlChar*)full_name.c_str())==1){
2030 return cvt((::xmlNodePtr)current);
2033 if (xmlStrEqual(aname,current->name)==1){
2034 return cvt((::xmlNodePtr)current);
2036 current = current->next;
2041setNamedItem(
const Node& arg)
const
2043 if (_null() || arg._null())
2049removeNamedItem(
const DOMString& name)
const
2053 ARCANE_UNUSED(name);
2058item(ULong index)
const
2063 ::xmlNodePtr xnode = (::xmlNodePtr)impl(m_p);
2066 return Node(cvt(xnode));
2068 xnode = xnode->next;
2073getNamedItemNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
2077 ARCANE_UNUSED(namespace_uri);
2078 ARCANE_UNUSED(local_name);
2083setNamedItemNS(
const Node& arg)
const
2093removeNamedItemNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
2097 ARCANE_UNUSED(namespace_uri);
2098 ARCANE_UNUSED(local_name);
2106DOMImplementation DOMImplementationSource::
2107getDOMImplementation(
const DOMString& features)
const
2109 ARCANE_UNUSED(features);
2110 throw NotImplementedException(A_FUNCINFO);
2116void UserDataHandler::
2117handle(UShort operation,
const DOMString& key,
const DOMObject& data,
2118 const Node& src,
const Node& dest)
const
2120 ARCANE_UNUSED(operation);
2122 ARCANE_UNUSED(data);
2124 ARCANE_UNUSED(dest);
2125 throw NotImplementedException(A_FUNCINFO);
2136DOMWriter(DOMWriterPrv* p)
2141DOMWriter(
const DOMWriter& from)
2145const DOMWriter& DOMWriter::
2146operator=(
const DOMWriter& from)
2165DOMWriterPrv* DOMWriter::
2172writeNode(
const Node& node)
const
2174 ARCANE_UNUSED(node);
2175 throw NotImplementedException(A_FUNCINFO);
2179encoding(
const String& encoding)
2182 ARCANE_UNUSED(encoding);
2183 throw NotImplementedException(A_FUNCINFO);
2190 throw NotImplementedException(A_FUNCINFO);
2201DOMError(DOMErrorPrv* p)
2206DOMError(
const DOMError& from)
2210const DOMError& DOMError::
2211operator=(
const DOMError& from)
2230DOMErrorPrv* DOMError::
2251relatedException()
const
2257DOMLocator DOMError::
2268bool DOMErrorHandler::
2269handleError(
const DOMError& error)
const
2271 ARCANE_UNUSED(error);
2272 throw NotImplementedException(A_FUNCINFO);
2283DOMLocator(DOMLocatorPrv* p)
2288DOMLocator(
const DOMLocator& from)
2292const DOMLocator& DOMLocator::
2293operator=(
const DOMLocator& from)
2312DOMLocatorPrv* DOMLocator::
2334DOMString DOMLocator::
2348XPathExpression XPathEvaluator::
2349createExpression(
const DOMString& expression,
2350 const XPathNSResolver& resolver)
const
2352 ARCANE_UNUSED(expression);
2353 ARCANE_UNUSED(resolver);
2354 throw NotImplementedException(A_FUNCINFO);
2356XPathResult XPathEvaluator::
2359 throw NotImplementedException(A_FUNCINFO);
2361XPathNSResolver XPathEvaluator::
2362createNSResolver(
const Node& node_resolver)
const
2364 ARCANE_UNUSED(node_resolver);
2365 throw NotImplementedException(A_FUNCINFO);
2367XPathResult XPathEvaluator::
2368evaluate(
const DOMString& expression,
const Node& context_node,
2369 const XPathNSResolver& resolver,UShort type,
2370 const XPathResult& result)
const
2372 ARCANE_UNUSED(expression);
2373 ARCANE_UNUSED(context_node);
2374 ARCANE_UNUSED(resolver);
2375 ARCANE_UNUSED(type);
2376 ARCANE_UNUSED(result);
2377 throw NotImplementedException(A_FUNCINFO);
2379XPathResult XPathEvaluator::
2380evaluateExpression(
const XPathExpression& expression,
2381 const Node& context_node,UShort type,
2382 const XPathResult& result)
const
2384 ARCANE_UNUSED(expression);
2385 ARCANE_UNUSED(context_node);
2386 ARCANE_UNUSED(type);
2387 ARCANE_UNUSED(result);
2388 throw NotImplementedException(A_FUNCINFO);
2394DOMString XPathNSResolver::
2395lookupNamespaceURI(
const DOMString& prefix)
const
2397 ARCANE_UNUSED(prefix);
2398 throw NotImplementedException(A_FUNCINFO);
2407 throw NotImplementedException(A_FUNCINFO);
2412 throw NotImplementedException(A_FUNCINFO);
2414DOMString XPathResult::
2417 throw NotImplementedException(A_FUNCINFO);
2422 throw NotImplementedException(A_FUNCINFO);
2425singleNodeValue()
const
2427 throw NotImplementedException(A_FUNCINFO);
2429XPathSetIterator XPathResult::
2430getSetIterator(
bool ordered)
const
2432 ARCANE_UNUSED(ordered);
2433 throw NotImplementedException(A_FUNCINFO);
2435XPathSetSnapshot XPathResult::
2436getSetSnapshot(
bool ordered)
const
2438 ARCANE_UNUSED(ordered);
2439 throw NotImplementedException(A_FUNCINFO);
2445Node XPathSetIterator::
2448 throw NotImplementedException(A_FUNCINFO);
2454ULong XPathSetSnapshot::
2457 throw NotImplementedException(A_FUNCINFO);
2459Node XPathSetSnapshot::
2460item(ULong index)
const
2462 ARCANE_UNUSED(index);
2463 throw NotImplementedException(A_FUNCINFO);
2469Element XPathNamespace::
2472 throw NotImplementedException(A_FUNCINFO);
2478void DOMImplementation::
2493void DOMImplementation::
2499 ::xmlCleanupParser();
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
Gestionnaire d'un document DOM.
Exception liées aux fichiers XML.
IXmlDocumentHolder * _load(const String &fname, ITraceMng *msg, const String &schemaname)
IXmlDocumentHolder * _newDocument()
Les méthodes suivantes sont internes à Arcane.
Gestion des erreurs du lecteur Xml.
static void XMLCDECL handler(void *user_data, T *e)
Handler à connecter à la libxml2.
Classe encapsulant l'analyser d'un document XML.
IXmlDocumentHolder * parse(ILibXml2_Reader *reader, const String &schema_name, ByteConstArrayView schema_data)
Analyse le contenu Xml via le reader reader.
Classe encapsulant la validation XML Schema d'un document XML.
void validate(::xmlDocPtr doc, ByteConstArrayView schema_data)
Valide un document XML.
NodePrv * m_p
Implémentation de la classe.
void releaseNode()
Détruit le noeud.
IXmlDocumentHolder * clone() override
Clone ce document.
XmlNode documentNode() override
Noeud document. Ce noeud est nul si le document n'existe pas.
String save() override
Sauvegarde ce document et retourne la chaîne de caractères.
void save(ByteArray &bytes) override
Sauvegarde ce document dans le tableau bytes.
Classe de base des vecteurs 1D de données.
Vue constante d'un tableau de type T.
constexpr bool empty() const noexcept
true si le tableau est vide (size()==0)
constexpr Integer size() const noexcept
Nombre d'éléments du tableau.
constexpr const_pointer data() const noexcept
Pointeur sur la mémoire allouée.
Interface du gestionnaire de traces.
virtual TraceMessage info()=0
Flot pour un message d'information.
Constructeur de chaîne de caractère unicode.
String toString() const
Retourne la chaîne de caractères construite.
Chaîne de caractères unicode.
const char * localstr() const
Retourne la conversion de l'instance dans l'encodage UTF-8.
bool null() const
Retourne true si la chaîne est nulle.
Vecteur 1D de données avec sémantique par valeur (style STL).
Integer len(const char *s)
Retourne la longueur de la chaîne s.
Int32 toInt32(Int64 v)
Converti un Int64 en un Int32.
Integer arcaneCheckArraySize(unsigned long long size)
Vérifie que size peut être converti dans un 'Integer' pour servir de taille à un tableau....
void arcaneNullPointerError()
Signalue l'utilisation d'un pointeur nul.
Array< Byte > ByteArray
Tableau dynamique à une dimension de caractères.
Span< const std::byte > ByteConstSpan
Vue en lecture seule d'un tableau à une dimension de caractères.
UniqueArray< Byte > ByteUniqueArray
Tableau dynamique à une dimension de caractères.
ConstArrayView< Byte > ByteConstArrayView
Equivalent C d'un tableau à une dimension de caractères.
unsigned char Byte
Type d'un octet.
Int32 Integer
Type représentant un entier.