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);
432 dom::DOMImplementation domimp;
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);
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);
1565: Node(cvt((xmlNodePtr)impl(p)))
1570: Node((const Node&)f)
1574Attr(
const Node& node)
1577 ARCANE_UNUSED(node);
1590 return cvt((xmlAttrPtr)impl(
m_p));
1614value(
const DOMString& str)
const
1637Element(ElementPrv* p)
1638: Node(cvt((xmlNodePtr)impl(p)))
1641Element(
const Node& node)
1644 NodePrv* ni= node._impl();
1645 if (ni && impl(ni)->
type==XML_ELEMENT_NODE)
1649Element(
const Element& node)
1652ElementPrv* Element::
1655 return cvt((xmlElementPtr)impl(
m_p));
1666getAttribute(
const DOMString& name)
const
1669 Attr a = getAttributeNode(name);
1672 return fromChar(::xmlGetProp(impl(
m_p),toChar(name)));
1675setAttribute(
const DOMString& name,
const DOMString& value)
const
1678 ::xmlSetProp(impl(
m_p),toChar(name),toChar(value));
1681removeAttribute(
const DOMString& name)
const
1684 ARCANE_UNUSED(name);
1689getAttributeNode(
const DOMString& name)
const
1692 xmlElementPtr elem_ptr = (xmlElementPtr)(impl(_impl()));
1693 return cvt(::xmlHasProp((xmlNodePtr)elem_ptr,toChar(name)));
1696setAttributeNode(
const Attr& new_attr)
const
1699 ARCANE_UNUSED(new_attr);
1704removeAttributeNode(
const Attr& old_attr)
const
1707 ARCANE_UNUSED(old_attr);
1712getElementsByTagName(
const DOMString& name)
const
1715 ARCANE_UNUSED(name);
1720getAttributeNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1723 ARCANE_UNUSED(namespace_uri);
1724 ARCANE_UNUSED(local_name);
1729setAttributeNS(
const DOMString& namespace_uri,
const DOMString& local_name,
1730 const DOMString& value)
const
1733 ARCANE_UNUSED(namespace_uri);
1734 ARCANE_UNUSED(local_name);
1735 ARCANE_UNUSED(value);
1740removeAttributeNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1743 ARCANE_UNUSED(namespace_uri);
1744 ARCANE_UNUSED(local_name);
1749getAttributeNodeNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1752 ARCANE_UNUSED(namespace_uri);
1753 ARCANE_UNUSED(local_name);
1758setAttributeNodeNS(
const Attr& new_attr)
const
1761 new_attr._checkValid();
1766getElementsByTagNameNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1769 ARCANE_UNUSED(namespace_uri);
1770 ARCANE_UNUSED(local_name);
1775hasAttribute(
const DOMString& name)
const
1778 ARCANE_UNUSED(name);
1783hasAttributeNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
1786 ARCANE_UNUSED(namespace_uri);
1787 ARCANE_UNUSED(local_name);
1796splitText(ULong offset)
const
1799 ARCANE_UNUSED(offset);
1811replaceWholeText(
const DOMString& content)
const
1814 ARCANE_UNUSED(content);
1827DocumentType(DocumentTypePrv* prv)
1828: Node(cvt((xmlNodePtr)impl(prv)))
1830DocumentTypePrv* DocumentType::
1833 return cvt((xmlDocTypePtr)impl(
m_p));
1835DOMString DocumentType::
1842NamedNodeMap DocumentType::
1849NamedNodeMap DocumentType::
1856DOMString DocumentType::
1863DOMString DocumentType::
1870DOMString DocumentType::
1871internalSubset()
const
1881NotationPrv* Notation::
1884 return cvt((xmlNotationPtr)impl(
m_p));
1909 return cvt((xmlEntityPtr)impl(
m_p));
1937ProcessingInstruction::
1938ProcessingInstruction()
1941ProcessingInstruction::
1942ProcessingInstruction(ProcessingInstructionPrv* prv)
1943: Node(cvt((xmlNodePtr)impl(prv)))
1945ProcessingInstructionPrv* ProcessingInstruction::
1948 return cvt((xmlProcessingInstructionPtr)impl(
m_p));
1951DOMString ProcessingInstruction::
1958DOMString ProcessingInstruction::
1965void ProcessingInstruction::
1966data(
const DOMString& value)
const
1969 ARCANE_UNUSED(value);
1982NamedNodeMap(NamedNodeMapPrv* p)
1986NamedNodeMap(
const NamedNodeMap& from)
1989const NamedNodeMap& NamedNodeMap::
1990operator=(
const NamedNodeMap& from)
1998NamedNodeMapPrv* NamedNodeMap::
2014 ::xmlNodePtr xnode = (::xmlNodePtr)impl(m_p);
2017 xnode = xnode->next;
2022getNamedItem(
const DOMString& name)
const
2033 ::xmlAttrPtr xattrlist = (::xmlAttrPtr)impl(m_p);
2034 const ::xmlChar* aname = toChar(name);
2035 ::xmlAttrPtr current = xattrlist;
2037 if (current->type==XML_ATTRIBUTE_NODE && current->ns){
2038 std::string full_name = (
const char*)(current->ns->prefix);
2040 full_name += (
const char*)(current->name);
2041 if (xmlStrEqual(aname, (
const xmlChar*)full_name.c_str())==1){
2042 return cvt((::xmlNodePtr)current);
2045 if (xmlStrEqual(aname,current->name)==1){
2046 return cvt((::xmlNodePtr)current);
2048 current = current->next;
2053setNamedItem(
const Node& arg)
const
2055 if (_null() || arg._null())
2061removeNamedItem(
const DOMString& name)
const
2065 ARCANE_UNUSED(name);
2070item(ULong index)
const
2075 ::xmlNodePtr xnode = (::xmlNodePtr)impl(m_p);
2078 return Node(cvt(xnode));
2080 xnode = xnode->next;
2085getNamedItemNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
2089 ARCANE_UNUSED(namespace_uri);
2090 ARCANE_UNUSED(local_name);
2095setNamedItemNS(
const Node& arg)
const
2105removeNamedItemNS(
const DOMString& namespace_uri,
const DOMString& local_name)
const
2109 ARCANE_UNUSED(namespace_uri);
2110 ARCANE_UNUSED(local_name);
2118DOMImplementation DOMImplementationSource::
2119getDOMImplementation(
const DOMString& features)
const
2121 ARCANE_UNUSED(features);
2122 throw NotImplementedException(A_FUNCINFO);
2128void UserDataHandler::
2129handle(UShort operation,
const DOMString& key,
const DOMObject& data,
2130 const Node& src,
const Node& dest)
const
2132 ARCANE_UNUSED(operation);
2134 ARCANE_UNUSED(data);
2136 ARCANE_UNUSED(dest);
2137 throw NotImplementedException(A_FUNCINFO);
2148DOMWriter(DOMWriterPrv* p)
2153DOMWriter(
const DOMWriter& from)
2157const DOMWriter& DOMWriter::
2158operator=(
const DOMWriter& from)
2177DOMWriterPrv* DOMWriter::
2184writeNode(
const Node& node)
const
2186 ARCANE_UNUSED(node);
2187 throw NotImplementedException(A_FUNCINFO);
2191encoding(
const String& encoding)
2194 ARCANE_UNUSED(encoding);
2195 throw NotImplementedException(A_FUNCINFO);
2202 throw NotImplementedException(A_FUNCINFO);
2213DOMError(DOMErrorPrv* p)
2218DOMError(
const DOMError& from)
2222const DOMError& DOMError::
2223operator=(
const DOMError& from)
2242DOMErrorPrv* DOMError::
2263relatedException()
const
2269DOMLocator DOMError::
2280bool DOMErrorHandler::
2281handleError(
const DOMError& error)
const
2283 ARCANE_UNUSED(error);
2284 throw NotImplementedException(A_FUNCINFO);
2295DOMLocator(DOMLocatorPrv* p)
2300DOMLocator(
const DOMLocator& from)
2304const DOMLocator& DOMLocator::
2305operator=(
const DOMLocator& from)
2324DOMLocatorPrv* DOMLocator::
2346DOMString DOMLocator::
2360XPathExpression XPathEvaluator::
2361createExpression(
const DOMString& expression,
2362 const XPathNSResolver& resolver)
const
2364 ARCANE_UNUSED(expression);
2365 ARCANE_UNUSED(resolver);
2366 throw NotImplementedException(A_FUNCINFO);
2368XPathResult XPathEvaluator::
2371 throw NotImplementedException(A_FUNCINFO);
2373XPathNSResolver XPathEvaluator::
2374createNSResolver(
const Node& node_resolver)
const
2376 ARCANE_UNUSED(node_resolver);
2377 throw NotImplementedException(A_FUNCINFO);
2379XPathResult XPathEvaluator::
2380evaluate(
const DOMString& expression,
const Node& context_node,
2381 const XPathNSResolver& resolver,UShort type,
2382 const XPathResult& result)
const
2384 ARCANE_UNUSED(expression);
2385 ARCANE_UNUSED(context_node);
2386 ARCANE_UNUSED(resolver);
2387 ARCANE_UNUSED(type);
2388 ARCANE_UNUSED(result);
2389 throw NotImplementedException(A_FUNCINFO);
2391XPathResult XPathEvaluator::
2392evaluateExpression(
const XPathExpression& expression,
2393 const Node& context_node,UShort type,
2394 const XPathResult& result)
const
2396 ARCANE_UNUSED(expression);
2397 ARCANE_UNUSED(context_node);
2398 ARCANE_UNUSED(type);
2399 ARCANE_UNUSED(result);
2400 throw NotImplementedException(A_FUNCINFO);
2406DOMString XPathNSResolver::
2407lookupNamespaceURI(
const DOMString& prefix)
const
2409 ARCANE_UNUSED(prefix);
2410 throw NotImplementedException(A_FUNCINFO);
2419 throw NotImplementedException(A_FUNCINFO);
2424 throw NotImplementedException(A_FUNCINFO);
2426DOMString XPathResult::
2429 throw NotImplementedException(A_FUNCINFO);
2434 throw NotImplementedException(A_FUNCINFO);
2437singleNodeValue()
const
2439 throw NotImplementedException(A_FUNCINFO);
2441XPathSetIterator XPathResult::
2442getSetIterator(
bool ordered)
const
2444 ARCANE_UNUSED(ordered);
2445 throw NotImplementedException(A_FUNCINFO);
2447XPathSetSnapshot XPathResult::
2448getSetSnapshot(
bool ordered)
const
2450 ARCANE_UNUSED(ordered);
2451 throw NotImplementedException(A_FUNCINFO);
2457Node XPathSetIterator::
2460 throw NotImplementedException(A_FUNCINFO);
2466ULong XPathSetSnapshot::
2469 throw NotImplementedException(A_FUNCINFO);
2471Node XPathSetSnapshot::
2472item(ULong index)
const
2474 ARCANE_UNUSED(index);
2475 throw NotImplementedException(A_FUNCINFO);
2481Element XPathNamespace::
2484 throw NotImplementedException(A_FUNCINFO);
2490void DOMImplementation::
2505void DOMImplementation::
2511 ::xmlCleanupParser();
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
IXmlDocumentHolder * _load(const String &fname, ITraceMng *msg, const String &schemaname)
IXmlDocumentHolder * _newDocument()
Les méthodes suivantes sont internes à Arcane.
Gestionnaire d'un document DOM.
Item parent() const
premier parent pour les sous-maillages
Int16 type() const
Type de l'entité
void releaseNode()
Détruit le noeud.
NodePrv * m_p
Implémentation de la classe.
Exception liées aux fichiers XML.
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.
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.