Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
DomLibXml2V2.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 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/* DomLibXml2.cc (C) 2000-2024 */
9/* */
10/* Encapsulation du DOM de libxml2. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
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"
24
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"
31
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>
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
42namespace Arcane::dom
43{
44
45/*---------------------------------------------------------------------------*/
46/*---------------------------------------------------------------------------*/
47// TODO: POUR NamedNodeMap, il n'y a pas de type correspondant dans libxml2
48// et comme cela peut représenter des types différents il faut faire un
49// type spécifique qui gère cela.
50class LibXml2_DOMImplementation;
51
52struct _wxmlText : _xmlNode {};
53struct _wxmlComment : _xmlNode {};
54struct _wxmlDocType : _xmlNode {};
55struct _wxmlDocumentFragment : _xmlNode {};
56struct _wxmlCDATA : _xmlNode {};
57struct _wxmlNodeList : _xmlNode {};
58struct _wxmlEntityReference : _xmlNode {};
59struct _wxmlCharacterData : _xmlNode {};
60struct _wxmlProcessingInstruction : _xmlNode {};
61struct _wxmlNamedNodeMapPtr : _xmlNode {};
62
70typedef _wxmlCDATA* xmlCDATAPtr;
71typedef _wxmlText* xmlTextPtr;
73
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; }
90//static ::DOMError* impl(DOMErrorPrv* p) { return (::DOMError*)p; }
91//static ::DOMLocator* impl(DOMLocatorPrv* p) { return (::DOMLocator*)p; }
92
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; }
110//static DOMLocatorPrv* cvt(::DOMLocator* p) { return (DOMLocatorPrv*)p; }
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114typedef char XMLCh;
115
116const xmlChar*
117domStringToXmlChar(const String& str)
118{
119 const xmlChar* ch = reinterpret_cast<const xmlChar*>(str.utf8().data());
120 return ch;
121}
122
123const xmlChar*
124toChar(const String& value)
125{
126 return domStringToXmlChar(value);
127}
128
129String fromChar(const xmlChar* value)
130{
131 if (!value)
132 return DOMString();
133 Integer len = ::xmlStrlen(value);
134 // Ne pas oublier le '\0' terminal
135 ByteConstArrayView bytes(len+1,value);
136 return DOMString(bytes);
137}
138
139String fromCharAndFree(xmlChar* value)
140{
141 if (!value)
142 return DOMString();
143 String s(fromChar(value));
144 ::xmlFree(value);
145 return s;
146}
147
148/*---------------------------------------------------------------------------*/
149/*---------------------------------------------------------------------------*/
150
151NodePrv* toNodePrv(const Node& node)
152{
153 return node._impl();
154}
155
156/*---------------------------------------------------------------------------*/
157/*---------------------------------------------------------------------------*/
158
159/*---------------------------------------------------------------------------*/
160/*---------------------------------------------------------------------------*/
161
162#define TNIE throw NotImplementedException(A_FUNCINFO)
163
164/*---------------------------------------------------------------------------*/
165/*---------------------------------------------------------------------------*/
166
168{
169 public:
170 static LibXml2_DOMImplementation sDOMImplementation;
171 static LibXml2_DOMImplementation* getImplementation()
172 {
173 return &sDOMImplementation;
174 }
175};
176
177LibXml2_DOMImplementation LibXml2_DOMImplementation::sDOMImplementation;
178
179/*---------------------------------------------------------------------------*/
180/*---------------------------------------------------------------------------*/
188{
189 public:
190
192 {
193 ::xmlSetStructuredErrorFunc(this,&LibXml2_ErrorHandler::handler);
194 }
196 {
197 ::xmlSetStructuredErrorFunc(nullptr,nullptr);
198 }
199
200 public:
202 template <class T>
203 static void XMLCDECL handler(void* user_data,T* e)
204 {
205 if (!e)
206 return;
207 auto x = reinterpret_cast<LibXml2_ErrorHandler*>(user_data);
208 if (!x)
209 return;
210 x->addError(e);
211 }
212 public:
213 const String& errorMessage() const { return m_error_message; }
214 private:
215 String m_error_message;
216 public:
217 void addError(const xmlError* e)
218 {
220 if (e->level==XML_ERR_WARNING)
221 sb += "(warning):";
222 else if (e->level==XML_ERR_ERROR)
223 sb += "(error):";
224 else if (e->level==XML_ERR_FATAL)
225 sb += "(fatal):";
226
227 sb += " domain ";
228 sb += e->domain;
229 sb += " errcode ";
230 sb += e->code;
231
232 if (e->line > 0) {
233 sb += " line ";
234 sb += e->line;
235 if (e->int2 > 0) {
236 sb += " column ";
237 sb += e->int2;
238 }
239 }
240 sb += " : ";
241 if (e->message)
242 sb += e->message;
243 else
244 sb += "(unknown)";
245 m_error_message = m_error_message + sb.toString();
246 }
247};
248
249/*---------------------------------------------------------------------------*/
250/*---------------------------------------------------------------------------*/
251
252class ILibXml2_Reader;
253
254/*---------------------------------------------------------------------------*/
255/*---------------------------------------------------------------------------*/
260{
261 public:
263 : m_file_name(file_name), m_trace(trace), m_options(0)
264 {
265 }
266 public:
279 public:
280 const String& fileName() const { return m_file_name; }
281 int options() const { return m_options; }
282 private:
283 String m_file_name;
284 ITraceMng* m_trace;
285 int m_options;
286 private:
287 void _applySchema(::xmlDocPtr doc,LibXml2_ErrorHandler& err_handler,
289};
290
291/*---------------------------------------------------------------------------*/
292/*---------------------------------------------------------------------------*/
297{
298 public:
300 : m_schema_file_name(schema_file_name),m_schema_parser_context(nullptr),
301 m_schema_ptr(nullptr), m_schema_valid_context(nullptr)
302 {
303 }
305 {
306 _clearMemory();
307 }
308 public:
319 void validate(::xmlDocPtr doc,ByteConstArrayView schema_data);
320 private:
321 String m_schema_file_name;
322 ::xmlSchemaParserCtxtPtr m_schema_parser_context;
323 ::xmlSchemaPtr m_schema_ptr;
324 ::xmlSchemaValidCtxtPtr m_schema_valid_context;
325 private:
326 void _clearMemory()
327 {
328 if (m_schema_parser_context){
329 ::xmlSchemaFreeParserCtxt(m_schema_parser_context);
330 m_schema_parser_context = nullptr;
331 }
332 if (m_schema_ptr){
333 ::xmlSchemaFree(m_schema_ptr);
334 m_schema_ptr = nullptr;
335 }
336 if (m_schema_valid_context){
337 ::xmlSchemaFreeValidCtxt(m_schema_valid_context);
338 m_schema_valid_context = nullptr;
339 }
340 }
341};
342
343/*---------------------------------------------------------------------------*/
344/*---------------------------------------------------------------------------*/
345
347{
348 public:
349 virtual ~ILibXml2_Reader(){}
350 public:
351 virtual ::xmlDocPtr read(LibXml2_Parser& context) =0;
352};
353
354/*---------------------------------------------------------------------------*/
355/*---------------------------------------------------------------------------*/
356
358: public ILibXml2_Reader
359{
360 public:
362 : m_buffer(buffer) {}
363 public:
364 ::xmlDocPtr read(LibXml2_Parser& parser) override
365 {
366 const char* encoding = nullptr;
367 int options = parser.options();
368 const char* buf_base = reinterpret_cast<const char*>(m_buffer.data());
369 // TODO: regarder s'il n'y a pas une version 64 bits de lecture
370 // qui fonctionne aussi sur les anciennes versions de LibXml2
371 // (pour le support RHEL6)
372 int buf_size = CheckedConvert::toInt32(m_buffer.size());
373 while (buf_size > 0 && static_cast<char>(m_buffer[buf_size - 1]) == '\0') {
374 buf_size--;
375 }
376 const String& name = parser.fileName();
377 ::xmlParserCtxtPtr ctxt = ::xmlNewParserCtxt();
378 ::xmlDocPtr doc = ::xmlCtxtReadMemory(ctxt,buf_base,buf_size,
379 name.localstr(),encoding,options);
380 ::xmlFreeParserCtxt(ctxt);
381 return doc;
382 }
383 private:
384 ByteConstSpan m_buffer;
385};
386
387/*---------------------------------------------------------------------------*/
388/*---------------------------------------------------------------------------*/
389
391: public ILibXml2_Reader
392{
393 public:
395 : m_file_name(file_name) {}
396 public:
397 ::xmlDocPtr read(LibXml2_Parser& parser) override
398 {
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);
405 return doc;
406 }
407 private:
408 String m_file_name;
409};
410
411/*---------------------------------------------------------------------------*/
412/*---------------------------------------------------------------------------*/
413
415: public IXmlDocumentHolder
416{
417 public:
419 : m_document(nullptr), m_document_node(nullptr)
420 {}
422 {
423 if (m_document){
424 ::xmlDocPtr doc = impl(m_document);
425 ::xmlFreeDoc(doc);
426 }
427 }
428 XmlNode documentNode() override { return XmlNode(nullptr, m_document_node); }
429 IXmlDocumentHolder* clone() override { TNIE; }
430 void save(ByteArray& bytes) override
431 {
432 dom::DOMImplementation domimp;
433 domimp._save(bytes,m_document,(-1));
434 }
435 String save() override
436 {
437 //TODO verifier qu'on sauve toujours en UTF8.
438 ByteUniqueArray bytes;
439 save(bytes);
440 String new_s = String::fromUtf8(bytes);
441 return new_s;
442 }
443
444 public:
445
446 void assignDocument(DocumentPrv* doc)
447 {
448 m_document = doc;
449 m_document_node = (NodePrv*)doc;
450 }
451 DocumentPrv* _document() const { return m_document; }
452 private:
453 DocumentPrv* m_document;
454 NodePrv* m_document_node;
455};
456
457/*---------------------------------------------------------------------------*/
458/*---------------------------------------------------------------------------*/
459
460DOMImplementation::
461DOMImplementation()
462: m_p(nullptr)
463{
464 m_p = cvt(LibXml2_DOMImplementation::getImplementation());
465}
466
467DOMImplementation::
468DOMImplementation(ImplementationPrv* prv)
469: m_p(prv)
470{
471}
472
473DOMImplementation::
474~DOMImplementation()
475{
476}
477
478void DOMImplementation::
479_checkValid() const
480{
481 if (!m_p)
483}
484
485ImplementationPrv* DOMImplementation::
486_impl() const
487{
488 return m_p;
489}
490
491bool DOMImplementation::
492hasFeature(const DOMString& feature,const DOMString& version) const
493{
494 ARCANE_UNUSED(feature);
495 ARCANE_UNUSED(version);
496 _checkValid();
497 TNIE;
498 //return impl(m_p)->hasFeature(toChar(feature),toChar(version));
499}
500
501DocumentType DOMImplementation::
502createDocumentType(const DOMString& qualified_name,const DOMString& public_id,
503 const DOMString& system_id) const
504{
505 ARCANE_UNUSED(qualified_name);
506 ARCANE_UNUSED(public_id);
507 ARCANE_UNUSED(system_id);
508 _checkValid();
509 TNIE;
510 //return cvt(impl(m_p)->createDocumentType(toChar(qualified_name),toChar(public_id),
511 // toChar(system_id)));
512}
513
514DOMImplementation DOMImplementation::
515getInterface(const DOMString& feature) const
516{
517 _checkValid();
518 ARCANE_UNUSED(feature);
519 throw NotImplementedException(A_FUNCINFO);
520}
521
522DOMWriter DOMImplementation::
523createDOMWriter() const
524{
525 _checkValid();
526 throw NotImplementedException(A_FUNCINFO);
527}
528
529/*---------------------------------------------------------------------------*/
530/*---------------------------------------------------------------------------*/
535createDocument(const DOMString& namespace_uri,const DOMString& qualified_name,
536 const DocumentType& doctype) const
537{
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);
546 return cvt(doc);
547}
548
549/*---------------------------------------------------------------------------*/
550/*---------------------------------------------------------------------------*/
551
552String DOMImplementation::
553_implementationName() const
554{
555 return "libxml2";
556}
557
558/*---------------------------------------------------------------------------*/
559/*---------------------------------------------------------------------------*/
560
561IXmlDocumentHolder* DOMImplementation::
563{
564 Document _doc = createDocument(DOMString(),DOMString(),DocumentType());
565 auto xml_doc = new XmlDocumentHolderLibXml2();
566 xml_doc->assignDocument(_doc._impl());
567 return xml_doc;
568}
569
570/*---------------------------------------------------------------------------*/
571/*---------------------------------------------------------------------------*/
572
573IXmlDocumentHolder* DOMImplementation::
574_load(const String& fname,ITraceMng* msg,const String& schemaname)
575{
576 return _load(fname,msg,schemaname,ByteConstArrayView());
577}
578
579/*---------------------------------------------------------------------------*/
580/*---------------------------------------------------------------------------*/
581
582IXmlDocumentHolder* DOMImplementation::
583_load(const String& fname,ITraceMng* trace,const String& schema_name,
584 ByteConstArrayView schema_data)
585{
586 _checkValid();
587 LibXml2_FileReader reader(fname);
588 LibXml2_Parser parser(fname,trace);
589 auto doc_holder = parser.parse(&reader,schema_name,schema_data);
590 return doc_holder;
591}
592
593/*---------------------------------------------------------------------------*/
594/*---------------------------------------------------------------------------*/
595
596IXmlDocumentHolder* DOMImplementation::
597_load(ByteConstSpan buffer,const String& name,ITraceMng* trace)
598{
599 _checkValid();
600 if (buffer.empty())
601 return new XmlDocumentHolderLibXml2();
602
603 LibXml2_MemoryReader reader(buffer);
604 LibXml2_Parser parser(name,trace);
605 auto doc_holder = parser.parse(&reader,String(),ByteConstArrayView());
606 return doc_holder;
607}
608
609/*---------------------------------------------------------------------------*/
610/*---------------------------------------------------------------------------*/
611
612void DOMImplementation::
613_save(ByteArray& bytes,const Document& document,int indent_level)
614{
615 ARCANE_UNUSED(indent_level);
616 // NOTE: Les versions récentes de libxml2 (2.9.0) utilisent une nouvelle
617 // API pour les buffers via les méthodes xmlBufContent() (pour récupérer
618 // le contenu) et xmlBufUse() (pour récupérer la taille utilisée).
619 // Ces deux méthodes permettent de gérer des buffers d'une taille supérieure
620 // à 2Go.
621 // Cependant, sous RHEL6, la version par défaut de libxml2 est trop
622 // ancienne et donc il faut supporter les anciennes méthodes.
623 // La macro 'LIBXML2_NEW_BUFFER' est définie si on peut utiliser le
624 // nouveau mécanisme.
625 xmlDocPtr doc = impl(document._impl());
626 xmlBufferPtr buf = ::xmlBufferCreate();
627
628 int options = 0;
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);
634
635 const xmlChar* content = ::xmlBufferContent(buf);
636 size_t content_len = ::xmlBufferLength(buf);
637
638 Integer buf_view_size = arcaneCheckArraySize(content_len);
639 ByteConstArrayView buf_view(buf_view_size,(const Byte*)content);
640 bytes.copy(buf_view);
641 // TODO: protéger le buffer des exceptions possibles de bytes.copy().
642 ::xmlBufferFree(buf);
643}
644
645/*---------------------------------------------------------------------------*/
646/*---------------------------------------------------------------------------*/
647
651{
652 std::unique_ptr<XmlDocumentHolderLibXml2> xml_parser(new XmlDocumentHolderLibXml2());
653
655 m_options |= XML_PARSE_XINCLUDE;
656
657 ::xmlDocPtr doc_ptr = nullptr;
658
659 {
660 // Note: le handler d'erreur est géré par libxml2 par thread.
661 // Il n'est donc pas nécessaire de le protéger en multi-threading.
663
664 doc_ptr = reader->read(*this);
665
666 if (!doc_ptr)
667 ARCANE_THROW(XmlException,"Could not parse document '{0}'\n{1}", fileName(),
668 err_handler.errorMessage());
669
670 // Assigne le document pour garantir sa libération en cas d'exception.
671 xml_parser->assignDocument(cvt(doc_ptr));
672
673 // Effectue le remplacement des XInclude. La méthode ::xmlXIncludeProcess()
674 // retourne le nombre de substitutions ou (-1) en cas d'erreur.
675 int nb_xinclude = ::xmlXIncludeProcess(doc_ptr);
676 if (nb_xinclude==(-1))
677 ARCANE_THROW(XmlException,"Could not parse xinclude for document '{0}'\n{1}", fileName(),
678 err_handler.errorMessage());
679
680 // Même si la lecture est correcte, il est possible qu'il y ait des
681 // messages d'avertissement à afficher.
682 String err_message = err_handler.errorMessage();
683 if (m_trace && !err_message.null())
684 m_trace->info() << "Info parsing document " << fileName() << " : " << err_message;
685 }
686
687 // Décommenter pour débug si on souhaite afficher le document lu.
688 //::xmlDocDump(stdout,doc_ptr);
689
690 {
692 validator.validate(doc_ptr,schema_data);
693 }
694
695 return xml_parser.release();
696}
697
698/*---------------------------------------------------------------------------*/
699/*---------------------------------------------------------------------------*/
700
703{
704 // Il faut positionner schema_name ou schema_data ou les deux.
705 // Si 'schema_data' est positionné, alors on l'utilise et on considère que
706 // 'schema_name' est le nom du fichier correspondant.
707 if (m_schema_file_name.null() && schema_data.empty())
708 return;
709 _clearMemory();
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());
714 }
715 else
716 m_schema_parser_context = ::xmlSchemaNewParserCtxt(m_schema_file_name.localstr());
717 if (!m_schema_parser_context)
718 ARCANE_THROW(XmlException,"Can not create schema parser");
719 m_schema_ptr = xmlSchemaParse(m_schema_parser_context);
720 if (!m_schema_ptr)
721 ARCANE_THROW(XmlException,"Can not read schema file '{0}'\n{1}",m_schema_file_name,
722 err_handler.errorMessage());
723 m_schema_valid_context = xmlSchemaNewValidCtxt(m_schema_ptr);
724 if (!m_schema_valid_context)
725 ARCANE_THROW(XmlException,"Can not create valid context for file '{0}'\n{1}",
726 m_schema_file_name,err_handler.errorMessage());
728 int result = xmlSchemaValidateDoc(m_schema_valid_context, doc_ptr);
729 if (result!=0)
730 ARCANE_THROW(XmlException,"Can not validate file '{0}'\n{1}",
731 m_schema_file_name,err_handler.errorMessage());
732}
733
734/*---------------------------------------------------------------------------*/
735/*---------------------------------------------------------------------------*/
736
737/*---------------------------------------------------------------------------*/
738/*---------------------------------------------------------------------------*/
739
740Node::
741Node()
742: m_p(0)
743{}
744Node::
745Node(NodePrv* p)
746: m_p(p)
747{
748}
749Node::
750Node(const Node& from)
751: m_p(from.m_p)
752{
753}
754const Node& Node::
755operator=(const Node& from)
756{
757 _assign(from);
758 return (*this);
759}
760Node::
761~Node()
762{}
763bool Node::
764_null() const
765{
766 return !m_p;
767}
768void Node::
769_checkValid() const
770{
771 if (_null())
773}
774NodePrv* Node::
775_impl() const
776{
777 return m_p;
778}
779
780UShort Node::
781nodeType() const
782{
783 _checkValid();
784 // Le type retourné par libxml2 (de type xmlElementType) correspond à celui du DOM
785 // avec les mêmes valeurs. Il faut donc simplement caster la valeur.
786 return (UShort)(impl(m_p)->type);
787}
788Node Node::
789firstChild() const
790{
791 _checkValid();
792 ::xmlNodePtr first_children = impl(m_p)->children;
793 return cvt(first_children);
794}
795Node Node::
796lastChild() const
797{
798 _checkValid();
799 TNIE;
800 //return cvt(impl(m_p)->getLastChild());
801}
802Node Node::
803previousSibling() const
804{
805 _checkValid();
806 TNIE;
807 //return cvt(impl(m_p)->getPreviousSibling());
808}
809Node Node::
810nextSibling() const
811{
812 _checkValid();
813 xmlNodePtr next_node = impl(m_p)->next;
814 return cvt(next_node);
815}
816Node Node::
817parentNode() const
818{
819 _checkValid();
820 return cvt(impl(m_p)->parent);
821}
822NodeList Node::
823childNodes() const
824{
825 _checkValid();
826 TNIE;
827 //return cvt(impl(m_p)->getChildNodes());
828}
829DOMString Node::
830nodeName() const
831{
832 _checkValid();
833 //if (impl(m_p)->type==XML_ELEMENT_NODE)
834 //std::cerr << "NODE_NAME =" << impl(m_p)->name << " content=" << impl(m_p)->content << "\n";
835 return fromChar(impl(m_p)->name);
836}
837NamedNodeMap Node::
838attributes() const
839{
840 _checkValid();
841 ::xmlNodePtr xelement = impl(m_p);
842 xmlAttrPtr p = xelement->properties;
843 return cvt((xmlNamedNodeMapPtr)(p));
844}
845Document Node::
846ownerDocument() const
847{
848 _checkValid();
849 ::xmlNodePtr node = impl(m_p);
850 return cvt(node->doc);
851}
852DOMString Node::
853nodeValue() const
854{
855 _checkValid();
856 xmlChar* content = ::xmlNodeGetContent(impl(m_p));
857 return fromCharAndFree(content);
858}
859void Node::
860nodeValue(const DOMString& str) const
861{
862 ARCANE_UNUSED(str);
863 _checkValid();
864 TNIE;
865 //impl(m_p)->setNodeValue(toChar(str));
866}
867void Node::
868_assign(const Node& node)
869{
870 m_p = node.m_p;
871}
872Node Node::
873insertBefore(const Node& new_child,const Node& ref_child) const
874{
875 ARCANE_UNUSED(new_child);
876 ARCANE_UNUSED(ref_child);
877 _checkValid();
878 TNIE;
879 //return cvt(impl(m_p)->insertBefore(impl(new_child._impl()),impl(ref_child._impl())));
880}
881Node Node::
882replaceChild(const Node& new_child,const Node& old_child) const
883{
884 ARCANE_UNUSED(new_child);
885 ARCANE_UNUSED(old_child);
886 _checkValid();
887 TNIE;
888 //return cvt(impl(m_p)->replaceChild(impl(new_child._impl()),impl(old_child._impl())));
889}
890Node Node::
891removeChild(const Node& old_child) const
892{
893 _checkValid();
894 ::xmlNodePtr xchild = impl(old_child._impl());
895 // Attention, il faut ensuite détruire le noeud via Node::releaseNode())
896 // pour libérer la mémoire.
897 ::xmlUnlinkNode(xchild);
898 return cvt(xchild);
899}
900Node Node::
901appendChild(const Node& new_child) const
902{
903 _checkValid();
904 return cvt(::xmlAddChild(impl(m_p),impl(new_child._impl())));
905}
906bool Node::
907hasChildNodes() const
908{
909 _checkValid();
910 TNIE;
911 //return impl(m_p)->hasChildNodes();
912}
913Node Node::
914cloneNode(bool deep) const
915{
916 _checkValid();
917 ARCANE_UNUSED(deep);
918 TNIE;
919 //return cvt(impl(m_p)->cloneNode(deep));
920}
921DOMString Node::
922prefix() const
923{
924 _checkValid();
925 TNIE;
926 //return fromChar(impl(m_p)->getPrefix());
927}
928void Node::
929prefix(const DOMString& new_prefix) const
930{
931 _checkValid();
932 ARCANE_UNUSED(new_prefix);
933 TNIE;
934 //impl(m_p)->setPrefix(toChar(new_prefix));
935}
936void Node::
937normalize() const
938{
939 _checkValid();
940 TNIE;
941 //impl(m_p)->normalize();
942}
943bool Node::
944isSupported(const DOMString& feature,const DOMString& version) const
945{
946 ARCANE_UNUSED(feature);
947 ARCANE_UNUSED(version);
948 _checkValid();
949 TNIE;
950 //return impl(m_p)->isSupported(toChar(feature),toChar(version));
951}
952DOMString Node::
953namespaceURI() const
954{
955 _checkValid();
956 TNIE;
957 //return fromChar(impl(m_p)->getNamespaceURI());
958}
959DOMString Node::
960localName() const
961{
962 _checkValid();
963 return fromChar(impl(m_p)->name);
964}
965DOMString Node::
966baseURI() const
967{
968 _checkValid();
969 TNIE;
970 //return fromChar(impl(m_p)->getBaseURI());
971}
972DOMString Node::
973textContent() const
974{
975 _checkValid();
976 TNIE;
977 //return fromChar(impl(m_p)->getTextContent());
978}
979void Node::
980textContent(const DOMString& value) const
981{
982 _checkValid();
983 ARCANE_UNUSED(value);
984 TNIE;
985 //impl(m_p)->setTextContent(toChar(value));
986}
987bool Node::
988isSameNode(const Node& node) const
989{
990 _checkValid();
991 ARCANE_UNUSED(node);
992 TNIE;
993 //return impl(m_p)->isSameNode(impl(node.m_p));
994}
995bool Node::
996isEqualNode(const Node& other) const
997{
998 _checkValid();
999 ARCANE_UNUSED(other);
1000 TNIE;
1001 //return impl(m_p)->isEqualNode(impl(other._impl()));
1002}
1003bool Node::
1004isDefaultNamespace(const DOMString& namespace_uri) const
1005{
1006 _checkValid();
1007 ARCANE_UNUSED(namespace_uri);
1008 TNIE;
1009 //return impl(m_p)->isDefaultNamespace(toChar(namespace_uri));
1010}
1011DOMString Node::
1012lookupNamespaceURI(const DOMString& prefix) const
1013{
1014 _checkValid();
1015 ARCANE_UNUSED(prefix);
1016 TNIE;
1017 //return fromChar(impl(m_p)->lookupNamespaceURI(toChar(prefix)));
1018}
1019DOMObject Node::
1020setUserData(const DOMString& key,const DOMObject& data,
1021 const UserDataHandler& handler) const
1022{
1023 _checkValid();
1024 ARCANE_UNUSED(key);
1025 ARCANE_UNUSED(data);
1026 ARCANE_UNUSED(handler);
1027 throw NotImplementedException(A_FUNCINFO);
1028}
1029DOMObject Node::
1030getUserData(const DOMString& key) const
1031{
1032 _checkValid();
1033 ARCANE_UNUSED(key);
1034 TNIE;
1035 //return impl(m_p)->getUserData(toChar(key));
1036}
1039{
1040 ::xmlNodePtr xnode = impl(m_p);
1041 if (xnode)
1042 ::xmlFreeNode(xnode);
1043}
1044bool
1045operator==(const Node& n1,const Node& n2)
1046{
1047 return impl(n1.m_p) == impl(n2.m_p);
1048}
1049bool
1050operator!=(const Node& n1,const Node& n2)
1051{
1052 return ! operator==(n1,n2);
1053}
1054
1055/*---------------------------------------------------------------------------*/
1056/*---------------------------------------------------------------------------*/
1057
1058CharacterData::
1059CharacterData(CharacterDataPrv* v)
1060: Node(cvt((xmlNodePtr)impl(v)))
1061{}
1062
1063CharacterData::
1064CharacterData()
1065: Node()
1066{}
1067
1068CharacterData::
1069CharacterData(const CharacterData& node)
1070: Node(node)
1071{
1072}
1073
1074CharacterData::
1075CharacterData(const Node& node)
1076: Node()
1077{
1078 TNIE;
1079 ARCANE_UNUSED(node);
1080 //NodePrv* ni= node._impl();
1081 //if (ni && impl(ni)->getNodeType()==CDATA_SECTION_NODE)
1082 //_assign(node);
1083}
1084
1085CharacterDataPrv* CharacterData::
1086_impl() const
1087{
1088 TNIE;
1089 //return cvt((xmlCharacterDataPtr)impl(m_p));
1090}
1091
1092/*---------------------------------------------------------------------------*/
1093/*---------------------------------------------------------------------------*/
1094
1095Text::
1096Text(TextPrv* v)
1097: CharacterData(cvt((xmlCharacterDataPtr)impl(v)))
1098{}
1099Text::
1100Text()
1101: CharacterData()
1102{}
1103Text::
1104Text(const Text& node)
1105: CharacterData(node)
1106{
1107}
1108Text::
1109Text(const Node& node)
1110: CharacterData()
1111{
1112 TNIE;
1113 ARCANE_UNUSED(node);
1114 //NodePrv* ni= node._impl();
1115 //if (ni && impl(ni)->getNodeType()==TEXT_NODE)
1116 //_assign(node);
1117}
1118TextPrv* Text::
1119_impl() const
1120{
1121 return cvt((xmlTextPtr)impl(m_p));
1122}
1123
1124/*---------------------------------------------------------------------------*/
1125/*---------------------------------------------------------------------------*/
1126
1127/*---------------------------------------------------------------------------*/
1128/*---------------------------------------------------------------------------*/
1129
1130/*---------------------------------------------------------------------------*/
1131/*---------------------------------------------------------------------------*/
1132
1133/*---------------------------------------------------------------------------*/
1134/*---------------------------------------------------------------------------*/
1135
1136Document::
1137Document()
1138{}
1139Document::
1140Document(DocumentPrv* p)
1141: Node(cvt((xmlNodePtr)impl(p)))
1142{}
1143Document::
1144Document(const Node& node)
1145: Node()
1146{
1147 NodePrv* ni= node._impl();
1148 if (ni && impl(ni)->type==XML_DOCUMENT_NODE)
1149 _assign(node);
1150}
1151DocumentPrv* Document::
1152_impl() const
1153{
1154 return cvt((xmlDocPtr)impl(m_p));
1155}
1156DocumentType Document::
1157doctype() const
1158{
1159 _checkValid();
1160 TNIE;
1161 //return cvt(impl(_impl())->getDoctype());
1162}
1163DOMImplementation Document::
1164implementation() const
1165{
1166 _checkValid();
1167 TNIE;
1168 //return cvt(impl(_impl())->getImplementation());
1169}
1170Element Document::
1171documentElement() const
1172{
1173 _checkValid();
1174 xmlDocPtr xdoc = impl(_impl());
1175 xmlNodePtr xnode = ::xmlDocGetRootElement(xdoc);
1176 return cvt((xmlElementPtr)xnode);
1177}
1178Element Document::
1179createElement(const DOMString& name) const
1180{
1181 _checkValid();
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);
1187}
1188DocumentFragment Document::
1189createDocumentFragment() const
1190{
1191 _checkValid();
1192 TNIE;
1193 //return cvt(impl(_impl())->createDocumentFragment());
1194}
1195Text Document::
1196createTextNode(const DOMString& data) const
1197{
1198 _checkValid();
1199 xmlDocPtr xdoc = impl(_impl());
1200 return cvt((xmlTextPtr)::xmlNewDocText(xdoc,toChar(data)));
1201}
1202Comment Document::
1203createComment(const DOMString& data) const
1204{
1205 _checkValid();
1206 TNIE;
1207 ARCANE_UNUSED(data);
1208 //return cvt(impl(_impl())->createComment(toChar(data)));
1209}
1210CDATASection Document::
1211createCDATASection(const DOMString& data) const
1212{
1213 _checkValid();
1214 TNIE;
1215 ARCANE_UNUSED(data);
1216 //return cvt(impl(_impl())->createCDATASection(toChar(data)));
1217}
1218ProcessingInstruction Document::
1219createProcessingInstruction(const DOMString& target,
1220 const DOMString& data) const
1221{
1222 _checkValid();
1223 ARCANE_UNUSED(target);
1224 ARCANE_UNUSED(data);
1225 TNIE;
1226 // return cvt(impl(_impl())->createProcessingInstruction(toChar(target),toChar(data)));
1227}
1228
1229Attr Document::
1230createAttribute(const DOMString& name) const
1231{
1232 _checkValid();
1233 ARCANE_UNUSED(name);
1234 TNIE;
1235 //return cvt(impl(_impl())->createAttribute(toChar(name)));
1236}
1237
1238EntityReference Document::
1239createEntityReference(const DOMString& name) const
1240{
1241 _checkValid();
1242 ARCANE_UNUSED(name);
1243 TNIE;
1244 //return cvt(impl(_impl())->createEntityReference(toChar(name)));
1245}
1246NodeList Document::
1247getElementsByTagName(const DOMString& tagname) const
1248{
1249 _checkValid();
1250 ARCANE_UNUSED(tagname);
1251 TNIE;
1252 //return cvt(impl(_impl())->getElementsByTagName(toChar(tagname)));
1253}
1254Node Document::
1255importNode(const Node& imported_node,bool deep) const
1256{
1257 _checkValid();
1258 ARCANE_UNUSED(imported_node);
1259 ARCANE_UNUSED(deep);
1260 TNIE;
1261 //return cvt(impl(_impl())->importNode(impl(toNodePrv(imported_node)),deep));
1262}
1263Element Document::
1264createElementNS(const DOMString& namespace_uri,const DOMString& qualified_name) const
1265{
1266 _checkValid();
1267 ARCANE_UNUSED(namespace_uri);
1268 ARCANE_UNUSED(qualified_name);
1269 TNIE;
1270 //return cvt(impl(_impl())->createElementNS(toChar(namespace_uri),toChar(qualified_name)));
1271}
1272Attr Document::
1273createAttributeNS(const DOMString& namespace_uri,const DOMString& qualified_name) const
1274{
1275 _checkValid();
1276 ARCANE_UNUSED(namespace_uri);
1277 ARCANE_UNUSED(qualified_name);
1278 TNIE;
1279 //return cvt(impl(_impl())->createAttributeNS(toChar(namespace_uri),toChar(qualified_name)));
1280}
1281NodeList Document::
1282getElementsByTagNameNS(const DOMString& namespace_uri,const DOMString& local_name) const
1283{
1284 _checkValid();
1285 ARCANE_UNUSED(namespace_uri);
1286 ARCANE_UNUSED(local_name);
1287 TNIE;
1288 //return cvt(impl(_impl())->getElementsByTagNameNS(toChar(namespace_uri),toChar(local_name)));
1289}
1290Element Document::
1291getElementById(const DOMString& element_id) const
1292{
1293 _checkValid();
1294 TNIE;
1295 ARCANE_UNUSED(element_id);
1296 //return cvt(impl(_impl())->getElementById(toChar(element_id)));
1297}
1298DOMString Document::
1299actualEncoding() const
1300{
1301 _checkValid();
1302 TNIE;
1303 //throw NotImplementedException(A_FUNCINFO);
1304}
1305void Document::
1306actualEncoding(const DOMString& value) const
1307{
1308 _checkValid();
1309 ARCANE_UNUSED(value);
1310 throw NotImplementedException(A_FUNCINFO);
1311}
1312
1313DOMString Document::
1314encoding() const
1315{
1316 _checkValid();
1317 throw NotImplementedException(A_FUNCINFO);
1318}
1319
1320void Document::
1321encoding(const DOMString& value) const
1322{
1323 _checkValid();
1324 ARCANE_UNUSED(value);
1325 throw NotImplementedException(A_FUNCINFO);
1326}
1327
1328bool Document::
1329standalone() const
1330{
1331 _checkValid();
1332 throw NotImplementedException(A_FUNCINFO);
1333}
1334
1335void Document::
1336standalone(bool value) const
1337{
1338 _checkValid();
1339 ARCANE_UNUSED(value);
1340 throw NotImplementedException(A_FUNCINFO);
1341}
1342
1343bool Document::
1344strictErrorChecking() const
1345{
1346 _checkValid();
1347 TNIE;
1348 //return impl(_impl())->getStrictErrorChecking();
1349}
1350void Document::
1351strictErrorChecking(bool value) const
1352{
1353 _checkValid();
1354 ARCANE_UNUSED(value);
1355 TNIE;
1356 //impl(_impl())->setStrictErrorChecking(value);
1357}
1358void Document::
1359documentURI(const DOMString& document_uri) const
1360{
1361 _checkValid();
1362 ARCANE_UNUSED(document_uri);
1363 TNIE;
1364 //impl(_impl())->setDocumentURI(toChar(document_uri));
1365}
1366DOMString Document::
1367documentURI() const
1368{
1369 _checkValid();
1370 TNIE;
1371 //return fromChar(impl(_impl())->getDocumentURI());
1372}
1373
1374Node Document::
1375adoptNode(const Node& source) const
1376{
1377 _checkValid();
1378 TNIE;
1379 ARCANE_UNUSED(source);
1380 //return Node(cvt(impl(_impl())->adoptNode(impl(source._impl()))));
1381}
1382void Document::
1383normalizeDocument()
1384{
1385 _checkValid();
1386 TNIE;
1387 //impl(_impl())->normalizeDocument();
1388}
1389Node Document::
1390renameNode(const Node& node,const DOMString& namespace_uri,
1391 const DOMString& name)
1392{
1393 _checkValid();
1394 node._checkValid();
1395 ARCANE_UNUSED(node);
1396 ARCANE_UNUSED(namespace_uri);
1397 ARCANE_UNUSED(name);
1398 TNIE;
1399 //return Node(cvt(impl(_impl())->renameNode(impl(node._impl()),toChar(namespace_uri),toChar(name))));
1400}
1401
1402/*---------------------------------------------------------------------------*/
1403/*---------------------------------------------------------------------------*/
1404
1405DocumentFragment::
1406DocumentFragment()
1407: Node()
1408{}
1409DocumentFragment::
1410DocumentFragment(DocumentFragmentPrv* prv)
1411: Node(cvt((xmlNodePtr)impl(prv)))
1412{}
1413
1414/*---------------------------------------------------------------------------*/
1415/*---------------------------------------------------------------------------*/
1416
1417Comment::
1418Comment()
1419: CharacterData()
1420{}
1421Comment::
1422Comment(CommentPrv* prv)
1423: CharacterData((CharacterDataPrv*)prv)
1424{}
1425
1426/*---------------------------------------------------------------------------*/
1427/*---------------------------------------------------------------------------*/
1428
1429CDATASection::
1430CDATASection()
1431: Text()
1432{}
1433CDATASection::
1434CDATASection(CDATASectionPrv* prv)
1435: Text(cvt((xmlTextPtr)impl(prv)))
1436{}
1437
1438/*---------------------------------------------------------------------------*/
1439/*---------------------------------------------------------------------------*/
1440
1441EntityReference::
1442EntityReference()
1443: Node()
1444{}
1445EntityReference::
1446EntityReference(EntityReferencePrv* prv)
1447: Node(cvt((xmlNodePtr)impl(prv)))
1448{}
1449
1450/*---------------------------------------------------------------------------*/
1451/*---------------------------------------------------------------------------*/
1452
1453NodeList::
1454NodeList()
1455: m_p(0)
1456{}
1457NodeList::
1458NodeList(NodeListPrv* prv)
1459: m_p(prv)
1460{}
1461
1462void NodeList::
1463_checkValid() const
1464{
1465 if (!m_p)
1467}
1468Node NodeList::
1469item(ULong index) const
1470{
1471 _checkValid();
1472 ARCANE_UNUSED(index);
1473 TNIE;
1474 //return cvt(impl(m_p)->item(index));
1475}
1476ULong NodeList::
1477length() const
1478{
1479 _checkValid();
1480 TNIE;
1481 //return impl(m_p)->getLength();
1482}
1483
1484/*---------------------------------------------------------------------------*/
1485/*---------------------------------------------------------------------------*/
1486
1487DOMString CharacterData::
1488data() const
1489{
1490 _checkValid();
1491 TNIE;
1492 //return fromChar(impl(_impl())->getData());
1493}
1494void CharacterData::
1495data(const DOMString& value) const
1496{
1497 _checkValid();
1498 ARCANE_UNUSED(value);
1499 TNIE;
1500 //impl(_impl())->setData(toChar(value));
1501}
1502ULong CharacterData::
1503length() const
1504{
1505 _checkValid();
1506 TNIE;
1507 //return impl(_impl())->getLength();
1508}
1509DOMString CharacterData::
1510substringData(ULong offset,ULong count) const
1511{
1512 _checkValid();
1513 ARCANE_UNUSED(offset);
1514 ARCANE_UNUSED(count);
1515 TNIE;
1516 //return fromChar(impl(_impl())->substringData(offset,count));
1517}
1518void CharacterData::
1519appendData(const DOMString& arg) const
1520{
1521 _checkValid();
1522 ARCANE_UNUSED(arg);
1523 TNIE;
1524 //impl(_impl())->appendData(toChar(arg));
1525}
1526void CharacterData::
1527insertData(ULong offset,const DOMString& arg) const
1528{
1529 _checkValid();
1530 ARCANE_UNUSED(offset);
1531 ARCANE_UNUSED(arg);
1532 TNIE;
1533 //impl(_impl())->insertData(offset,toChar(arg));
1534}
1535void CharacterData::
1536deleteData(ULong offset,ULong count) const
1537{
1538 _checkValid();
1539 ARCANE_UNUSED(offset);
1540 ARCANE_UNUSED(count);
1541 TNIE;
1542 //impl(_impl())->deleteData(offset,count);
1543}
1544void CharacterData::
1545replaceData(ULong offset,ULong count,const DOMString& arg) const
1546{
1547 _checkValid();
1548 TNIE;
1549 ARCANE_UNUSED(offset);
1550 ARCANE_UNUSED(count);
1551 ARCANE_UNUSED(arg);
1552 //impl(_impl())->replaceData(offset,count,toChar(arg));
1553}
1554
1555/*---------------------------------------------------------------------------*/
1556/*---------------------------------------------------------------------------*/
1557
1558Attr::
1559Attr()
1560: Node()
1561{
1562}
1563Attr::
1564Attr(AttrPrv* p)
1565: Node(cvt((xmlNodePtr)impl(p)))
1566{
1567}
1568Attr::
1569Attr(const Attr& f)
1570: Node((const Node&)f)
1571{
1572}
1573Attr::
1574Attr(const Node& node)
1575: Node()
1576{
1577 ARCANE_UNUSED(node);
1578 TNIE;
1579 // NodePrv* ni= node._impl();
1580 //if (ni && impl(ni)->getNodeType()==ATTRIBUTE_NODE)
1581 //_assign(node);
1582}
1583Attr::
1584~Attr()
1585{
1586}
1587AttrPrv* Attr::
1588_impl() const
1589{
1590 return cvt((xmlAttrPtr)impl(m_p));
1591}
1592DOMString Attr::
1593name() const
1594{
1595 _checkValid();
1596 TNIE;
1597 //return fromChar(impl(_impl())->getName());
1598}
1599bool Attr::
1600specified() const
1601{
1602 _checkValid();
1603 TNIE;
1604 //return impl(_impl())->getSpecified();
1605}
1606DOMString Attr::
1607value() const
1608{
1609 _checkValid();
1610 TNIE;
1611 //return fromChar(impl(_impl())->getValue());
1612}
1613void Attr::
1614value(const DOMString& str) const
1615{
1616 _checkValid();
1617 ARCANE_UNUSED(str);
1618 TNIE;
1619 //impl(_impl())->setValue(toChar(str));
1620}
1621Element Attr::
1622ownerElement() const
1623{
1624 _checkValid();
1625 TNIE;
1626 //return cvt(impl(_impl())->getOwnerElement());
1627}
1628
1629/*---------------------------------------------------------------------------*/
1630/*---------------------------------------------------------------------------*/
1631
1632Element::
1633Element()
1634: Node()
1635{}
1636Element::
1637Element(ElementPrv* p)
1638: Node(cvt((xmlNodePtr)impl(p)))
1639{}
1640Element::
1641Element(const Node& node)
1642: Node()
1643{
1644 NodePrv* ni= node._impl();
1645 if (ni && impl(ni)->type==XML_ELEMENT_NODE)
1646 _assign(node);
1647}
1648Element::
1649Element(const Element& node)
1650: Node(node)
1651{}
1652ElementPrv* Element::
1653_impl() const
1654{
1655 return cvt((xmlElementPtr)impl(m_p));
1656}
1657
1658DOMString Element::
1659tagName() const
1660{
1661 _checkValid();
1662 TNIE;
1663 // return fromChar(impl(_impl())->getTagName());
1664}
1665DOMString Element::
1666getAttribute(const DOMString& name) const
1667{
1668 _checkValid();
1669 Attr a = getAttributeNode(name);
1670 if (a._null())
1671 return String();
1672 return fromChar(::xmlGetProp(impl(m_p),toChar(name)));
1673}
1674void Element::
1675setAttribute(const DOMString& name,const DOMString& value) const
1676{
1677 _checkValid();
1678 ::xmlSetProp(impl(m_p),toChar(name),toChar(value));
1679}
1680void Element::
1681removeAttribute(const DOMString& name) const
1682{
1683 _checkValid();
1684 ARCANE_UNUSED(name);
1685 TNIE;
1686 //impl(_impl())->removeAttribute(toChar(name));
1687}
1688Attr Element::
1689getAttributeNode(const DOMString& name) const
1690{
1691 _checkValid();
1692 xmlElementPtr elem_ptr = (xmlElementPtr)(impl(_impl()));
1693 return cvt(::xmlHasProp((xmlNodePtr)elem_ptr,toChar(name)));
1694}
1695Attr Element::
1696setAttributeNode(const Attr& new_attr) const
1697{
1698 _checkValid();
1699 ARCANE_UNUSED(new_attr);
1700 TNIE;
1701 //return cvt(impl(_impl())->setAttributeNode(impl(new_attr._impl())));
1702}
1703Attr Element::
1704removeAttributeNode(const Attr& old_attr) const
1705{
1706 _checkValid();
1707 ARCANE_UNUSED(old_attr);
1708 TNIE;
1709 //return cvt(impl(_impl())->removeAttributeNode(impl(old_attr._impl())));
1710}
1711NodeList Element::
1712getElementsByTagName(const DOMString& name) const
1713{
1714 _checkValid();
1715 ARCANE_UNUSED(name);
1716 TNIE;
1717 //return NodeList(cvt(impl(_impl())->getElementsByTagName(toChar(name))));
1718}
1719DOMString Element::
1720getAttributeNS(const DOMString& namespace_uri,const DOMString& local_name) const
1721{
1722 _checkValid();
1723 ARCANE_UNUSED(namespace_uri);
1724 ARCANE_UNUSED(local_name);
1725 TNIE;
1726 //return fromChar(impl(_impl())->getAttributeNS(toChar(namespace_uri),toChar(local_name)));
1727}
1728void Element::
1729setAttributeNS(const DOMString& namespace_uri,const DOMString& local_name,
1730 const DOMString& value) const
1731{
1732 _checkValid();
1733 ARCANE_UNUSED(namespace_uri);
1734 ARCANE_UNUSED(local_name);
1735 ARCANE_UNUSED(value);
1736 TNIE;
1737 //impl(_impl())->setAttributeNS(toChar(namespace_uri),toChar(local_name),toChar(value));
1738}
1739void Element::
1740removeAttributeNS(const DOMString& namespace_uri,const DOMString& local_name) const
1741{
1742 _checkValid();
1743 ARCANE_UNUSED(namespace_uri);
1744 ARCANE_UNUSED(local_name);
1745 TNIE;
1746 //impl(_impl())->removeAttributeNS(toChar(namespace_uri),toChar(local_name));
1747}
1748Attr Element::
1749getAttributeNodeNS(const DOMString& namespace_uri,const DOMString& local_name) const
1750{
1751 _checkValid();
1752 ARCANE_UNUSED(namespace_uri);
1753 ARCANE_UNUSED(local_name);
1754 TNIE;
1755 //return Attr(cvt(impl(_impl())->getAttributeNodeNS(toChar(namespace_uri),toChar(local_name))));
1756}
1757Attr Element::
1758setAttributeNodeNS(const Attr& new_attr) const
1759{
1760 _checkValid();
1761 new_attr._checkValid();
1762 TNIE;
1763 //return Attr(cvt(impl(_impl())->setAttributeNodeNS(impl(new_attr._impl()))));
1764}
1765NodeList Element::
1766getElementsByTagNameNS(const DOMString& namespace_uri,const DOMString& local_name) const
1767{
1768 _checkValid();
1769 ARCANE_UNUSED(namespace_uri);
1770 ARCANE_UNUSED(local_name);
1771 TNIE;
1772 //return NodeList(cvt(impl(_impl())->getElementsByTagNameNS(toChar(namespace_uri),toChar(local_name))));
1773}
1774bool Element::
1775hasAttribute(const DOMString& name) const
1776{
1777 _checkValid();
1778 ARCANE_UNUSED(name);
1779 TNIE;
1780 //return impl(_impl())->hasAttribute(toChar(name));
1781}
1782bool Element::
1783hasAttributeNS(const DOMString& namespace_uri,const DOMString& local_name) const
1784{
1785 _checkValid();
1786 ARCANE_UNUSED(namespace_uri);
1787 ARCANE_UNUSED(local_name);
1788 TNIE;
1789 //return impl(_impl())->hasAttributeNS(toChar(namespace_uri),toChar(local_name));
1790}
1791
1792/*---------------------------------------------------------------------------*/
1793/*---------------------------------------------------------------------------*/
1794
1795Text Text::
1796splitText(ULong offset) const
1797{
1798 _checkValid();
1799 ARCANE_UNUSED(offset);
1800 TNIE;
1801 //return Text(cvt(impl(_impl())->splitText(offset)));
1802}
1803DOMString Text::
1804wholeText() const
1805{
1806 _checkValid();
1807 TNIE;
1808 //return fromChar(impl(_impl())->getWholeText());
1809}
1810Text Text::
1811replaceWholeText(const DOMString& content) const
1812{
1813 _checkValid();
1814 ARCANE_UNUSED(content);
1815 TNIE;
1816 //return Text(cvt(impl(_impl())->replaceWholeText(toChar(content))));
1817}
1818
1819/*---------------------------------------------------------------------------*/
1820/*---------------------------------------------------------------------------*/
1821
1822DocumentType::
1823DocumentType()
1824: Node()
1825{}
1826DocumentType::
1827DocumentType(DocumentTypePrv* prv)
1828: Node(cvt((xmlNodePtr)impl(prv)))
1829{}
1830DocumentTypePrv* DocumentType::
1831_impl() const
1832{
1833 return cvt((xmlDocTypePtr)impl(m_p));
1834}
1835DOMString DocumentType::
1836name() const
1837{
1838 _checkValid();
1839 TNIE;
1840 //return fromChar(impl(_impl())->getName());
1841}
1842NamedNodeMap DocumentType::
1843entities() const
1844{
1845 _checkValid();
1846 TNIE;
1847 //return NamedNodeMap(cvt(impl(_impl())->getEntities()));
1848}
1849NamedNodeMap DocumentType::
1850notations() const
1851{
1852 _checkValid();
1853 TNIE;
1854 //return NamedNodeMap(cvt(impl(_impl())->getNotations()));
1855}
1856DOMString DocumentType::
1857publicId() const
1858{
1859 _checkValid();
1860 TNIE;
1861 //return fromChar(impl(_impl())->getPublicId());
1862}
1863DOMString DocumentType::
1864systemId() const
1865{
1866 _checkValid();
1867 TNIE;
1868 //return fromChar(impl(_impl())->getSystemId());
1869}
1870DOMString DocumentType::
1871internalSubset() const
1872{
1873 _checkValid();
1874 TNIE;
1875 //return fromChar(impl(_impl())->getInternalSubset());
1876}
1877
1878/*---------------------------------------------------------------------------*/
1879/*---------------------------------------------------------------------------*/
1880
1881NotationPrv* Notation::
1882_impl() const
1883{
1884 return cvt((xmlNotationPtr)impl(m_p));
1885}
1886
1887DOMString Notation::
1888publicId() const
1889{
1890 _checkValid();
1891 TNIE;
1892 //return fromChar(impl(_impl())->getPublicId());
1893}
1894
1895DOMString Notation::
1896systemId() const
1897{
1898 _checkValid();
1899 TNIE;
1900 //return fromChar(impl(_impl())->getSystemId());
1901}
1902
1903/*---------------------------------------------------------------------------*/
1904/*---------------------------------------------------------------------------*/
1905
1906EntityPrv* Entity::
1907_impl() const
1908{
1909 return cvt((xmlEntityPtr)impl(m_p));
1910}
1911
1912DOMString Entity::
1913publicId() const
1914{
1915 _checkValid();
1916 TNIE;
1917 //return fromChar(impl(_impl())->getPublicId());
1918}
1919DOMString Entity::
1920systemId() const
1921{
1922 _checkValid();
1923 TNIE;
1924 //return fromChar(impl(_impl())->getSystemId());
1925}
1926DOMString Entity::
1927notationName() const
1928{
1929 _checkValid();
1930 TNIE;
1931 //return fromChar(impl(_impl())->getNotationName());
1932}
1933
1934/*---------------------------------------------------------------------------*/
1935/*---------------------------------------------------------------------------*/
1936
1937ProcessingInstruction::
1938ProcessingInstruction()
1939: Node()
1940{}
1941ProcessingInstruction::
1942ProcessingInstruction(ProcessingInstructionPrv* prv)
1943: Node(cvt((xmlNodePtr)impl(prv)))
1944{}
1945ProcessingInstructionPrv* ProcessingInstruction::
1946_impl() const
1947{
1948 return cvt((xmlProcessingInstructionPtr)impl(m_p));
1949}
1950
1951DOMString ProcessingInstruction::
1952target() const
1953{
1954 _checkValid();
1955 TNIE;
1956 //return fromChar(impl(_impl())->getTarget());
1957}
1958DOMString ProcessingInstruction::
1959data() const
1960{
1961 _checkValid();
1962 TNIE;
1963 //return fromChar(impl(_impl())->getData());
1964}
1965void ProcessingInstruction::
1966data(const DOMString& value) const
1967{
1968 _checkValid();
1969 ARCANE_UNUSED(value);
1970 TNIE;
1971 //impl(_impl())->setData(toChar(value));
1972}
1973
1974/*---------------------------------------------------------------------------*/
1975/*---------------------------------------------------------------------------*/
1976
1977NamedNodeMap::
1978NamedNodeMap()
1979: m_p(nullptr)
1980{}
1981NamedNodeMap::
1982NamedNodeMap(NamedNodeMapPrv* p)
1983: m_p(p)
1984{}
1985NamedNodeMap::
1986NamedNodeMap(const NamedNodeMap& from)
1987: m_p(from.m_p)
1988{}
1989const NamedNodeMap& NamedNodeMap::
1990operator=(const NamedNodeMap& from)
1991{
1992 m_p = from.m_p;
1993 return (*this);
1994}
1995NamedNodeMap::
1996~NamedNodeMap()
1997{}
1998NamedNodeMapPrv* NamedNodeMap::
1999_impl() const
2000{
2001 return m_p;
2002}
2003bool NamedNodeMap::
2004_null() const
2005{
2006 return !m_p;
2007}
2008ULong NamedNodeMap::
2009length() const
2010{
2011 if (_null())
2012 return 0;
2013 ULong n = 0;
2014 ::xmlNodePtr xnode = (::xmlNodePtr)impl(m_p);
2015 while(xnode){
2016 ++n;
2017 xnode = xnode->next;
2018 }
2019 return n;
2020}
2021Node NamedNodeMap::
2022getNamedItem(const DOMString& name) const
2023{
2024 // NOTE: Ne marche que pour les attributs. Pour les autres types (entities, ...)
2025 // il faudrait faire une autre version. A priori, si on caste 'xmlAttr' en
2026 // 'xmlNode' et qu'on utilise que les champs de base (name, next), ca devrait
2027 // pouvoir aller pour tout.
2028 // NOTE: Pour les attributs, \a name peut contenir un préfix de namespace (par
2029 // exemple xml:lang). Il faut donc rechercher via le préfix + le nom local
2030 // et pas seulement le nom local.
2031 if (_null())
2032 return Node();
2033 ::xmlAttrPtr xattrlist = (::xmlAttrPtr)impl(m_p);
2034 const ::xmlChar* aname = toChar(name);
2035 ::xmlAttrPtr current = xattrlist;
2036 while (current){
2037 if (current->type==XML_ATTRIBUTE_NODE && current->ns){
2038 std::string full_name = (const char*)(current->ns->prefix);
2039 full_name += ":";
2040 full_name += (const char*)(current->name);
2041 if (xmlStrEqual(aname, (const xmlChar*)full_name.c_str())==1){
2042 return cvt((::xmlNodePtr)current);
2043 }
2044 }
2045 if (xmlStrEqual(aname,current->name)==1){
2046 return cvt((::xmlNodePtr)current);
2047 }
2048 current = current->next;
2049 }
2050 return Node();
2051}
2052Node NamedNodeMap::
2053setNamedItem(const Node& arg) const
2054{
2055 if (_null() || arg._null())
2056 return Node();
2057 TNIE;
2058 //return Node(cvt(impl(_impl())->setNamedItem(impl(arg._impl()))));
2059}
2060Node NamedNodeMap::
2061removeNamedItem(const DOMString& name) const
2062{
2063 if (_null())
2064 return Node();
2065 ARCANE_UNUSED(name);
2066 TNIE;
2067 //return Node(cvt(impl(_impl())->removeNamedItem(toChar(name))));
2068}
2069Node NamedNodeMap::
2070item(ULong index) const
2071{
2072 if (_null())
2073 return Node();
2074 ULong n = 0;
2075 ::xmlNodePtr xnode = (::xmlNodePtr)impl(m_p);
2076 while(xnode){
2077 if (n==index)
2078 return Node(cvt(xnode));
2079 ++n;
2080 xnode = xnode->next;
2081 }
2082 return Node();
2083}
2084Node NamedNodeMap::
2085getNamedItemNS(const DOMString& namespace_uri,const DOMString& local_name) const
2086{
2087 if (_null())
2088 return Node();
2089 ARCANE_UNUSED(namespace_uri);
2090 ARCANE_UNUSED(local_name);
2091 TNIE;
2092 //return Node(cvt(impl(_impl())->getNamedItemNS(toChar(namespace_uri),toChar(local_name))));
2093}
2094Node NamedNodeMap::
2095setNamedItemNS(const Node& arg) const
2096{
2097 if (_null())
2098 return Node();
2099 if (arg._null())
2100 return Node();
2101 TNIE;
2102 //return Node(cvt(impl(_impl())->setNamedItemNS(impl(arg._impl()))));
2103}
2104Node NamedNodeMap::
2105removeNamedItemNS(const DOMString& namespace_uri,const DOMString& local_name) const
2106{
2107 if (_null())
2108 return Node();
2109 ARCANE_UNUSED(namespace_uri);
2110 ARCANE_UNUSED(local_name);
2111 TNIE;
2112 //return Node(cvt(impl(_impl())->removeNamedItemNS(toChar(namespace_uri),toChar(local_name))));
2113}
2114
2115/*---------------------------------------------------------------------------*/
2116/*---------------------------------------------------------------------------*/
2117
2118DOMImplementation DOMImplementationSource::
2119getDOMImplementation(const DOMString& features) const
2120{
2121 ARCANE_UNUSED(features);
2122 throw NotImplementedException(A_FUNCINFO);
2123}
2124
2125/*---------------------------------------------------------------------------*/
2126/*---------------------------------------------------------------------------*/
2127
2128void UserDataHandler::
2129handle(UShort operation,const DOMString& key,const DOMObject& data,
2130 const Node& src,const Node& dest) const
2131{
2132 ARCANE_UNUSED(operation);
2133 ARCANE_UNUSED(key);
2134 ARCANE_UNUSED(data);
2135 ARCANE_UNUSED(src);
2136 ARCANE_UNUSED(dest);
2137 throw NotImplementedException(A_FUNCINFO);
2138}
2139
2140/*---------------------------------------------------------------------------*/
2141/*---------------------------------------------------------------------------*/
2142
2143DOMWriter::
2144DOMWriter()
2145: m_p(0)
2146{}
2147DOMWriter::
2148DOMWriter(DOMWriterPrv* p)
2149: m_p(p)
2150{
2151}
2152DOMWriter::
2153DOMWriter(const DOMWriter& from)
2154: m_p(from.m_p)
2155{
2156}
2157const DOMWriter& DOMWriter::
2158operator=(const DOMWriter& from)
2159{
2160 m_p = from.m_p;
2161 return (*this);
2162}
2163DOMWriter::
2164~DOMWriter()
2165{}
2166bool DOMWriter::
2167_null() const
2168{
2169 return !m_p;
2170}
2171void DOMWriter::
2172_checkValid() const
2173{
2174 if (_null())
2176}
2177DOMWriterPrv* DOMWriter::
2178_impl() const
2179{
2180 return m_p;
2181}
2182
2183ByteUniqueArray DOMWriter::
2184writeNode(const Node& node) const
2185{
2186 ARCANE_UNUSED(node);
2187 throw NotImplementedException(A_FUNCINFO);
2188}
2189
2190void DOMWriter::
2191encoding(const String& encoding)
2192{
2193 _checkValid();
2194 ARCANE_UNUSED(encoding);
2195 throw NotImplementedException(A_FUNCINFO);
2196}
2197
2198String DOMWriter::
2199encoding() const
2200{
2201 _checkValid();
2202 throw NotImplementedException(A_FUNCINFO);
2203}
2204
2205/*---------------------------------------------------------------------------*/
2206/*---------------------------------------------------------------------------*/
2207
2208DOMError::
2209DOMError()
2210: m_p(0)
2211{}
2212DOMError::
2213DOMError(DOMErrorPrv* p)
2214: m_p(p)
2215{
2216}
2217DOMError::
2218DOMError(const DOMError& from)
2219: m_p(from.m_p)
2220{
2221}
2222const DOMError& DOMError::
2223operator=(const DOMError& from)
2224{
2225 m_p = from.m_p;
2226 return (*this);
2227}
2228DOMError::
2229~DOMError()
2230{}
2231bool DOMError::
2232_null() const
2233{
2234 return !m_p;
2235}
2236void DOMError::
2237_checkValid() const
2238{
2239 if (_null())
2241}
2242DOMErrorPrv* DOMError::
2243_impl() const
2244{
2245 return m_p;
2246}
2247
2248UShort DOMError::
2249severity() const
2250{
2251 _checkValid();
2252 TNIE;
2253 //return impl(_impl())->getSeverity();
2254}
2255DOMString DOMError::
2256message() const
2257{
2258 _checkValid();
2259 TNIE;
2260 //return fromChar(impl(_impl())->getMessage());
2261}
2262DOMObject DOMError::
2263relatedException() const
2264{
2265 _checkValid();
2266 TNIE;
2267 //return DOMObject(impl(_impl())->getRelatedException());
2268}
2269DOMLocator DOMError::
2270location() const
2271{
2272 _checkValid();
2273 TNIE;
2274 //return DOMLocator(cvt(impl(_impl())->getLocation()));
2275}
2276
2277/*---------------------------------------------------------------------------*/
2278/*---------------------------------------------------------------------------*/
2279
2280bool DOMErrorHandler::
2281handleError(const DOMError& error) const
2282{
2283 ARCANE_UNUSED(error);
2284 throw NotImplementedException(A_FUNCINFO);
2285}
2286
2287/*---------------------------------------------------------------------------*/
2288/*---------------------------------------------------------------------------*/
2289
2290DOMLocator::
2291DOMLocator()
2292: m_p(0)
2293{}
2294DOMLocator::
2295DOMLocator(DOMLocatorPrv* p)
2296: m_p(p)
2297{
2298}
2299DOMLocator::
2300DOMLocator(const DOMLocator& from)
2301: m_p(from.m_p)
2302{
2303}
2304const DOMLocator& DOMLocator::
2305operator=(const DOMLocator& from)
2306{
2307 m_p = from.m_p;
2308 return (*this);
2309}
2310DOMLocator::
2311~DOMLocator()
2312{}
2313bool DOMLocator::
2314_null() const
2315{
2316 return !m_p;
2317}
2318void DOMLocator::
2319_checkValid() const
2320{
2321 if (_null())
2323}
2324DOMLocatorPrv* DOMLocator::
2325_impl() const
2326{
2327 return m_p;
2328}
2329
2330long DOMLocator::
2331lineNumber() const
2332{
2333 _checkValid();
2334 TNIE;
2335 //return impl(_impl())->getLineNumber();
2336}
2337
2338long DOMLocator::
2339columnNumber() const
2340{
2341 _checkValid();
2342 TNIE;
2343 //return impl(_impl())->getColumnNumber();
2344}
2345
2346DOMString DOMLocator::
2347uri() const
2348{
2349 _checkValid();
2350 TNIE;
2351 //return fromChar(impl(_impl())->getURI());
2352}
2353
2354/*---------------------------------------------------------------------------*/
2355/*---------------------------------------------------------------------------*/
2356
2357/*---------------------------------------------------------------------------*/
2358/*---------------------------------------------------------------------------*/
2359
2360XPathExpression XPathEvaluator::
2361createExpression(const DOMString& expression,
2362 const XPathNSResolver& resolver) const
2363{
2364 ARCANE_UNUSED(expression);
2365 ARCANE_UNUSED(resolver);
2366 throw NotImplementedException(A_FUNCINFO);
2367}
2368XPathResult XPathEvaluator::
2369createResult() const
2370{
2371 throw NotImplementedException(A_FUNCINFO);
2372}
2373XPathNSResolver XPathEvaluator::
2374createNSResolver(const Node& node_resolver) const
2375{
2376 ARCANE_UNUSED(node_resolver);
2377 throw NotImplementedException(A_FUNCINFO);
2378}
2379XPathResult XPathEvaluator::
2380evaluate(const DOMString& expression,const Node& context_node,
2381 const XPathNSResolver& resolver,UShort type,
2382 const XPathResult& result) const
2383{
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);
2390}
2391XPathResult XPathEvaluator::
2392evaluateExpression(const XPathExpression& expression,
2393 const Node& context_node,UShort type,
2394 const XPathResult& result) const
2395{
2396 ARCANE_UNUSED(expression);
2397 ARCANE_UNUSED(context_node);
2398 ARCANE_UNUSED(type);
2399 ARCANE_UNUSED(result);
2400 throw NotImplementedException(A_FUNCINFO);
2401}
2402
2403/*---------------------------------------------------------------------------*/
2404/*---------------------------------------------------------------------------*/
2405
2406DOMString XPathNSResolver::
2407lookupNamespaceURI(const DOMString& prefix) const
2408{
2409 ARCANE_UNUSED(prefix);
2410 throw NotImplementedException(A_FUNCINFO);
2411}
2412
2413/*---------------------------------------------------------------------------*/
2414/*---------------------------------------------------------------------------*/
2415
2416UShort XPathResult::
2417resultType() const
2418{
2419 throw NotImplementedException(A_FUNCINFO);
2420}
2421double XPathResult::
2422numberValue() const
2423{
2424 throw NotImplementedException(A_FUNCINFO);
2425}
2426DOMString XPathResult::
2427stringValue() const
2428{
2429 throw NotImplementedException(A_FUNCINFO);
2430}
2431bool XPathResult::
2432booleanValue() const
2433{
2434 throw NotImplementedException(A_FUNCINFO);
2435}
2436Node XPathResult::
2437singleNodeValue() const
2438{
2439 throw NotImplementedException(A_FUNCINFO);
2440}
2441XPathSetIterator XPathResult::
2442getSetIterator(bool ordered) const
2443{
2444 ARCANE_UNUSED(ordered);
2445 throw NotImplementedException(A_FUNCINFO);
2446}
2447XPathSetSnapshot XPathResult::
2448getSetSnapshot(bool ordered) const
2449{
2450 ARCANE_UNUSED(ordered);
2451 throw NotImplementedException(A_FUNCINFO);
2452}
2453
2454/*---------------------------------------------------------------------------*/
2455/*---------------------------------------------------------------------------*/
2456
2457Node XPathSetIterator::
2458nextNode() const
2459{
2460 throw NotImplementedException(A_FUNCINFO);
2461}
2462
2463/*---------------------------------------------------------------------------*/
2464/*---------------------------------------------------------------------------*/
2465
2466ULong XPathSetSnapshot::
2467length() const
2468{
2469 throw NotImplementedException(A_FUNCINFO);
2470}
2471Node XPathSetSnapshot::
2472item(ULong index) const
2473{
2474 ARCANE_UNUSED(index);
2475 throw NotImplementedException(A_FUNCINFO);
2476}
2477
2478/*---------------------------------------------------------------------------*/
2479/*---------------------------------------------------------------------------*/
2480
2481Element XPathNamespace::
2482ownerElement() const
2483{
2484 throw NotImplementedException(A_FUNCINFO);
2485}
2486
2487/*---------------------------------------------------------------------------*/
2488/*---------------------------------------------------------------------------*/
2489
2490void DOMImplementation::
2491initialize()
2492{
2493 // Appelle explicitement xmlInitParser(). Cela n'est en théorie pas
2494 // indispensable mais cette méthode peut générer des exceptions flottante
2495 // car à un momement il y a un appel explicite à une division par zéro pour
2496 // générer un Nan (dans xmlXPathInit()). Comme DOMImplementation::initialize()
2497 // est appelé avant d'activer les exception flottantes il faut faire
2498 // explicitement l'appel à l'initialisation du parseur ici.
2499 ::xmlInitParser();
2500}
2501
2502/*---------------------------------------------------------------------------*/
2503/*---------------------------------------------------------------------------*/
2504
2505void DOMImplementation::
2506terminate()
2507{
2508 // Là encore ce n'est pas indispensable mais cela permet de libérer les
2509 // ressources globales et ainsi éviter des fuites mémoire potentielles
2510 // (ce qui gène les outils comme valgrind).
2511 ::xmlCleanupParser();
2512}
2513
2514/*---------------------------------------------------------------------------*/
2515/*---------------------------------------------------------------------------*/
2516
2517}
2518
2519/*---------------------------------------------------------------------------*/
2520/*---------------------------------------------------------------------------*/
2521
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
Tableau d'items de types quelconques.
Document createDocument(const DOMString &namespace_uri, const DOMString &qualified_name, const DocumentType &doctype) const
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
Definition Item.h:280
Int16 type() const
Type de l'entité
Definition Item.h:232
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Noeud d'un maillage.
Definition Dom.h:204
void releaseNode()
Détruit le noeud.
NodePrv * m_p
Implémentation de la classe.
Definition Dom.h:412
Exception liées aux fichiers XML.
Noeud d'un arbre DOM.
Definition XmlNode.h:51
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.
Vue constante d'un tableau de type T.
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.
Definition String.cc:227
bool null() const
Retourne true si la chaîne est nulle.
Definition String.cc:304
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.
Definition UtilsTypes.h:321
Span< const std::byte > ByteConstSpan
Vue en lecture seule d'un tableau à une dimension de caractères.
Definition UtilsTypes.h:706
UniqueArray< Byte > ByteUniqueArray
Tableau dynamique à une dimension de caractères.
Definition UtilsTypes.h:509
ConstArrayView< Byte > ByteConstArrayView
Equivalent C d'un tableau à une dimension de caractères.
Definition UtilsTypes.h:634
unsigned char Byte
Type d'un octet.
Definition UtilsTypes.h:142
Int32 Integer
Type représentant un entier.