17#include "arcane/utils/StringBuilder.h"
18#include "arcane/utils/StringImpl.h"
19#include "arcane/utils/String.h"
20#include "arcane/utils/NotImplementedException.h"
21#include "arcane/utils/ITraceMng.h"
23#include "arcane/Dom.h"
24#include "arcane/DomUtils.h"
25#include "arcane/IXmlDocumentHolder.h"
26#include "arcane/XmlNode.h"
47#include "arcane/utils/Exception.h"
48#include "arcane/utils/String.h"
49#include <libxml/tree.h>
61typedef unsigned char XMLByte;
66typedef char16_t XMLCh;
67typedef unsigned char XMLByte;
72ARCANE_BEGIN_NAMESPACE_DOM
81const XMLCh chNull = 0x00;
82const XMLCh chHTab = 0x09;
83const XMLCh chLF = 0x0A;
84const XMLCh chVTab = 0x0B;
85const XMLCh chFF = 0x0C;
86const XMLCh chCR = 0x0D;
87const XMLCh chAmpersand = 0x26;
88const XMLCh chAsterisk = 0x2A;
89const XMLCh chAt = 0x40;
90const XMLCh chBackSlash = 0x5C;
91const XMLCh chBang = 0x21;
92const XMLCh chCaret = 0x5E;
93const XMLCh chCloseAngle = 0x3E;
94const XMLCh chCloseCurly = 0x7D;
95const XMLCh chCloseParen = 0x29;
96const XMLCh chCloseSquare = 0x5D;
97const XMLCh chColon = 0x3A;
98const XMLCh chComma = 0x2C;
99const XMLCh chDash = 0x2D;
100const XMLCh chDollarSign = 0x24;
101const XMLCh chDoubleQuote = 0x22;
102const XMLCh chEqual = 0x3D;
103const XMLCh chForwardSlash = 0x2F;
104const XMLCh chGrave = 0x60;
105const XMLCh chNEL = 0x85;
106const XMLCh chOpenAngle = 0x3C;
107const XMLCh chOpenCurly = 0x7B;
108const XMLCh chOpenParen = 0x28;
109const XMLCh chOpenSquare = 0x5B;
110const XMLCh chPercent = 0x25;
111const XMLCh chPeriod = 0x2E;
112const XMLCh chPipe = 0x7C;
113const XMLCh chPlus = 0x2B;
114const XMLCh chPound = 0x23;
115const XMLCh chQuestion = 0x3F;
116const XMLCh chSingleQuote = 0x27;
117const XMLCh chSpace = 0x20;
118const XMLCh chSemiColon = 0x3B;
119const XMLCh chTilde = 0x7E;
120const XMLCh chUnderscore = 0x5F;
122const XMLCh chSwappedUnicodeMarker = XMLCh(0xFFFE);
123const XMLCh chUnicodeMarker = XMLCh(0xFEFF);
125const XMLCh chDigit_0 = 0x30;
126const XMLCh chDigit_1 = 0x31;
127const XMLCh chDigit_2 = 0x32;
128const XMLCh chDigit_3 = 0x33;
129const XMLCh chDigit_4 = 0x34;
130const XMLCh chDigit_5 = 0x35;
131const XMLCh chDigit_6 = 0x36;
132const XMLCh chDigit_7 = 0x37;
133const XMLCh chDigit_8 = 0x38;
134const XMLCh chDigit_9 = 0x39;
136const XMLCh chLatin_A = 0x41;
137const XMLCh chLatin_B = 0x42;
138const XMLCh chLatin_C = 0x43;
139const XMLCh chLatin_D = 0x44;
140const XMLCh chLatin_E = 0x45;
141const XMLCh chLatin_F = 0x46;
142const XMLCh chLatin_G = 0x47;
143const XMLCh chLatin_H = 0x48;
144const XMLCh chLatin_I = 0x49;
145const XMLCh chLatin_J = 0x4A;
146const XMLCh chLatin_K = 0x4B;
147const XMLCh chLatin_L = 0x4C;
148const XMLCh chLatin_M = 0x4D;
149const XMLCh chLatin_N = 0x4E;
150const XMLCh chLatin_O = 0x4F;
151const XMLCh chLatin_P = 0x50;
152const XMLCh chLatin_Q = 0x51;
153const XMLCh chLatin_R = 0x52;
154const XMLCh chLatin_S = 0x53;
155const XMLCh chLatin_T = 0x54;
156const XMLCh chLatin_U = 0x55;
157const XMLCh chLatin_V = 0x56;
158const XMLCh chLatin_W = 0x57;
159const XMLCh chLatin_X = 0x58;
160const XMLCh chLatin_Y = 0x59;
161const XMLCh chLatin_Z = 0x5A;
163const XMLCh chLatin_a = 0x61;
164const XMLCh chLatin_b = 0x62;
165const XMLCh chLatin_c = 0x63;
166const XMLCh chLatin_d = 0x64;
167const XMLCh chLatin_e = 0x65;
168const XMLCh chLatin_f = 0x66;
169const XMLCh chLatin_g = 0x67;
170const XMLCh chLatin_h = 0x68;
171const XMLCh chLatin_i = 0x69;
172const XMLCh chLatin_j = 0x6A;
173const XMLCh chLatin_k = 0x6B;
174const XMLCh chLatin_l = 0x6C;
175const XMLCh chLatin_m = 0x6D;
176const XMLCh chLatin_n = 0x6E;
177const XMLCh chLatin_o = 0x6F;
178const XMLCh chLatin_p = 0x70;
179const XMLCh chLatin_q = 0x71;
180const XMLCh chLatin_r = 0x72;
181const XMLCh chLatin_s = 0x73;
182const XMLCh chLatin_t = 0x74;
183const XMLCh chLatin_u = 0x75;
184const XMLCh chLatin_v = 0x76;
185const XMLCh chLatin_w = 0x77;
186const XMLCh chLatin_x = 0x78;
187const XMLCh chLatin_y = 0x79;
188const XMLCh chLatin_z = 0x7A;
190const XMLCh chYenSign = 0xA5;
191const XMLCh chWonSign = 0x20A9;
193const XMLCh chLineSeparator = 0x2028;
194const XMLCh chParagraphSeparator = 0x2029;
200 : m_document_node(node)
212 void assignNode(NodePrv* node) { m_document_node = node; }
215 NodePrv* m_document_node;
225 operator UInt32() {
return mRefcount; }
233 void operator++() { AtomicInt32::increment(&mRefcount); }
237 AtomicInt32::decrement(&mRefcount);
238 return (mRefcount != 0);
245#define LIBXML2_IMPL_REFCOUNT \
248 LIBXML2_RefCount _libxml2_refcount; \
251 void add_ref() throw() { ++_libxml2_refcount; } \
252 void release_ref() throw() \
254 if (!--_libxml2_refcount) \
263class LIBXML2_NodeMap;
282 static const char* INTERFACE_NAME() {
return "LIBXML2_DOMImplementation"; }
283 bool hasFeature(
const String& feature,
const String& version);
290 void ProcessXMLError(
String& aErrorMessage, xmlError* aErr);
291 void ProcessContextError(
String& aErrorMessage, xmlParserCtxt* ctxt);
292 LIBXML2_IMPL_REFCOUNT;
303 static const char* INTERFACE_NAME() {
return "LIBXML2_Node"; }
306 static const UInt16 NODE_NODE = 0;
307 static const UInt16 ELEMENT_NODE = 1;
308 static const UInt16 ATTRIBUTE_NODE = 2;
309 static const UInt16 TEXT_NODE = 3;
310 static const UInt16 CDATA_SECTION_NODE = 4;
311 static const UInt16 ENTITY_REFERENCE_NODE = 5;
312 static const UInt16 ENTITY_NODE = 6;
313 static const UInt16 PROCESSING_INSTRUCTION_NODE = 7;
314 static const UInt16 COMMENT_NODE = 8;
315 static const UInt16 DOCUMENT_NODE = 9;
316 static const UInt16 DOCUMENT_TYPE_NODE = 10;
317 static const UInt16 DOCUMENT_FRAGMENT_NODE = 11;
318 static const UInt16 NOTATION_NODE = 12;
326 void nodeValue(
const String& attr);
327 virtual UInt16 nodeType();
342 bool hasChildNodes();
351 bool isSupported(
const String& feature,
const String& version);
354 void prefix(
const String& attr);
356 bool hasAttributes() {
return false; }
357 void updateDocumentAncestorStatus(
bool aStatus);
363 std::list<LIBXML2_Node*>::iterator mPositionInParent;
364 bool mDocumentIsAncestor;
366 String mNodeName, mLocalName, mNodeValue, mNamespaceURI;
367 std::list<LIBXML2_Node*> mNodeList;
381 if (_libxml2_refcount == 0) {
382 ARCANE_ASSERT((_libxml2_refcount == 0), (
"release_ref called too many times"));
384 bool hitZero = !--_libxml2_refcount;
385 if (mParent == NULL) {
393 mParent->release_ref();
401 static const char* INTERFACE_NAME() {
return "LIBXML2_NodeList"; }
414 mParent->release_ref();
419 LIBXML2_IMPL_REFCOUNT;
423 std::list<LIBXML2_Node*>::iterator m_hintIterator;
431 , mNameFilter(aNameFilter)
432 , mFilterType(LEVEL_1_NAME_FILTER)
438 const String& aLocalnameFilter)
440 , mNamespaceFilter(aNamespaceFilter)
441 , mNameFilter(aLocalnameFilter)
442 , mFilterType(LEVEL_2_NAME_FILTER)
452 mParent->release_ref();
455 LIBXML2_IMPL_REFCOUNT;
458 String mNamespaceFilter, mNameFilter;
470 static const char* INTERFACE_NAME() {
return "LIBXML2_EmptyNamedNodeMap"; }
490 ARCANE_UNUSED(index);
499 ARCANE_UNUSED(namespaceURI);
500 ARCANE_UNUSED(localName);
510 ARCANE_UNUSED(namespaceURI);
511 ARCANE_UNUSED(localName);
514 LIBXML2_IMPL_REFCOUNT;
520 static const char* INTERFACE_NAME() {
return "LIBXML2_CharacterData"; }
526 void Data(
const String& attr);
527 void nodeValue(
const String& attr);
529 String substringdata(UInt32 offset, UInt32 count);
530 void appenddata(
const String& arg);
531 void insertdata(UInt32 offset,
const String& arg);
532 void deletedata(UInt32 offset, UInt32 count);
533 void replacedata(UInt32 offset, UInt32 count,
const String& arg);
534 LIBXML2_IMPL_REFCOUNT;
537#define LIBXML2_IMPL_NODETYPE(type) \
542 return LIBXML2_Node::type##_NODE; \
548 static const char* INTERFACE_NAME() {
return "LIBXML2_Attr"; }
554 LIBXML2_IMPL_NODETYPE(ATTRIBUTE);
559 void value(
const String& attr);
567 static const char* INTERFACE_NAME() {
return "LIBXML2_Element"; }
572 LIBXML2_IMPL_NODETYPE(ELEMENT);
577 void setAttribute(
const String& name,
const String& value);
578 void removeAttribute(
const String& name);
584 void setAttributeNS(
const String& namespaceURI,
const String& qualifiedname,
const String& value);
585 void removeAttributeNS(
const String& namespaceURI,
const String& localname);
589 bool hasAttribute(
const String& name);
590 bool hasAttributeNS(
const String& namespaceURI,
const String& localname);
591 bool hasAttributes();
603 bool operator==(
const LocalName& aCompareWith)
const {
return name == aCompareWith.name; }
605 bool operator<(
const LocalName& aCompareWith)
const {
return name < aCompareWith.name; }
623 return name == aCompareWith.name && ns == aCompareWith.ns;
630 LIBXML2_IMPL_REFCOUNT;
632 std::map<QualifiedName, LIBXML2_Attr*> attributeMapNS;
633 std::map<LocalName, LIBXML2_Attr*> attributeMap;
639 static const char* INTERFACE_NAME() {
return "LIBXML2_NamedNodeMap"; }
650 virtual UInt32 length();
655 LIBXML2_IMPL_REFCOUNT;
659 std::map<LIBXML2_Element::QualifiedName, LIBXML2_Attr*>::iterator m_hintIterator;
665 static const char* INTERFACE_NAME() {
return "LIBXML2_NamedNodeDT"; }
676 LIBXML2_IMPL_REFCOUNT;
685 static const char* INTERFACE_NAME() {
return "LIBXML2_TextBase"; }
691 LIBXML2_IMPL_REFCOUNT;
697 static const char* INTERFACE_NAME() {
return "LIBXML2_Text"; }
702 LIBXML2_IMPL_NODETYPE(TEXT);
709 static const char* INTERFACE_NAME() {
return "LIBXML2_Comment"; }
714 LIBXML2_IMPL_NODETYPE(COMMENT);
721 static const char* INTERFACE_NAME() {
return "LIBXML2_CDATASection"; }
726 LIBXML2_IMPL_NODETYPE(CDATA_SECTION);
734 static const char* INTERFACE_NAME() {
return "LIBXML2_DocumentType"; }
739 mNodeName = qualifiedName;
740 mPublicId = publicId;
741 mSystemId = systemId;
744 LIBXML2_IMPL_NODETYPE(DOCUMENT_TYPE);
752 String mPublicId, mSystemId;
758 static const char* INTERFACE_NAME() {
return "LIBXML2_Notation"; }
761 , mPublicId(aPublicId)
762 , mSystemId(aSystemId)
765 LIBXML2_IMPL_NODETYPE(NOTATION);
769 String mPublicId, mSystemId;
775 static const char* INTERFACE_NAME() {
return "LIBXML2_Entity"; }
779 , mPublicId(aPublicId)
780 , mSystemId(aSystemId)
781 , mNotationName(aNotationname)
784 LIBXML2_IMPL_NODETYPE(ENTITY);
789 String mPublicId, mSystemId, mNotationName;
795 static const char* INTERFACE_NAME() {
return "LIBXML2_EntityReference"; }
800 LIBXML2_IMPL_NODETYPE(ENTITY_REFERENCE);
807 static const char* INTERFACE_NAME() {
return "LIBXML2_ProcessingInstruction"; }
816 LIBXML2_IMPL_NODETYPE(PROCESSING_INSTRUCTION);
820 void Data(
const String& attr);
826 static const char* INTERFACE_NAME() {
return "LIBXML2_DocumentFragment"; }
831 LIBXML2_IMPL_NODETYPE(DOCUMENT_FRAGMENT);
838 static const char* INTERFACE_NAME() {
return "LIBXML2_Document"; }
846 mDocumentIsAncestor =
true;
847 mDocument->release_ref();
853 if (context_->myDoc !=
nullptr) {
854 xmlFreeDoc(context_->myDoc);
858 if (Impl_() !=
nullptr) {
864 LIBXML2_IMPL_NODETYPE(DOCUMENT);
882 void Impl_(_xmlDoc* Doc) { impl_ = Doc; }
883 _xmlDoc* Impl_(
void) {
return impl_; }
884 void Context_(xmlParserCtxt* Context) { context_ = Context; }
885 xmlParserCtxt* Context_() {
return context_; }
891 xmlParserCtxt* context_;
902 , indent(indentation)
910 , indent(indentation)
932 static const char* get_encoding_or_utf8(
const String& encoding)
934 if (encoding.
empty()) {
939 return (
const char*)encoding.
localstr();
945 xmlParserCtxt* context_;
947 LIBXML2_IMPL_REFCOUNT;
959 void setDefaultNamespace(
const String& newns);
960 void recordPrefix(
const String& prefix,
const String& ns);
961 String getDefaultNamespace();
964 void possiblyInventPrefix(
const String& prefix);
965 void resolveOrInventPrefixes();
967 LIBXML2_IMPL_REFCOUNT;
971 bool mOverrideDefaultNamespace;
973 std::map<String, String> mURIfromPrefix;
974 std::map<String, String> mPrefixfromURI;
975 std::list<String> mNamespacesNeedingPrefixes;
978ARCANE_END_NAMESPACE_DOM
989#include "arcane/XmlException.h"
990#include "arcane/utils/PlatformUtils.h"
991#include <arcane/utils/TraceInfo.h>
996#include <libxml/parserInternals.h>
997#include <libxml/xinclude.h>
998#include <libxml/xmlschemas.h>
1007typedef std::wstring ustring;
1011typedef std::u16string ustring;
1013static_assert(
sizeof(char16_t) ==
sizeof(
short),
"Inconsistent size");
1014typedef unsigned short unsigned_char16_t;
1017wcscmp(
const char16_t* s1,
const char16_t* s2)
1019 while (*s1 == *s2++)
1022 return (*(
const unsigned_char16_t*)s1 - *(
const unsigned_char16_t*)--s2);
1026wcsncmp(
const char16_t* s1,
const char16_t* s2,
size_t n)
1032 return (*(
const unsigned_char16_t*)s1 - *(
const unsigned_char16_t*)--s2);
1041wcschr(
const char16_t* s,
const char16_t c)
1043 while (*s != c && *s != L
'\0')
1046 return ((
char16_t*)s);
1051wcslen(
const char16_t* s)
1061wcstombs(
char* dest,
const char16_t* src,
size_t n)
1065 if (!(*dest++ = *src++))
1073ARCANE_BEGIN_NAMESPACE
1074ARCANE_BEGIN_NAMESPACE_DOM
1079static_assert(
sizeof(XMLByte) ==
sizeof(Byte),
"Inconsistent data size");
1080static_assert(
sizeof(xmlChar) ==
sizeof(
char),
"Inconsistent data size");
1082LIBXML2_Node* WrapXML2Node(LIBXML2_Document* doc, xmlNode* x2node);
1084struct LIBXML2_PartialLoad
1086 LIBXML2_DOMImplementation* mImpl;
1091LIBXML2_XMLStructuredHandler(
void* userData, xmlErrorPtr error)
1093 LIBXML2_PartialLoad* pl =
reinterpret_cast<LIBXML2_PartialLoad*
>(userData);
1094 pl->mImpl->ProcessXMLError(pl->mMsgTo, error);
1103 return reinterpret_cast<LIBXML2_Node*
>(p);
1108 return reinterpret_cast<LIBXML2_Attr*
>(p);
1110static LIBXML2_Element*
1113 return reinterpret_cast<LIBXML2_Element*
>(p);
1115static LIBXML2_Document*
1118 return reinterpret_cast<LIBXML2_Document*
>(p);
1120static LIBXML2_DocumentType*
1121impl(DocumentTypePrv* p)
1123 return reinterpret_cast<LIBXML2_DocumentType*
>(p);
1125static LIBXML2_DOMImplementation*
1126impl(ImplementationPrv* p)
1128 return reinterpret_cast<LIBXML2_DOMImplementation*
>(p);
1130static LIBXML2_CharacterData*
1131impl(CharacterDataPrv* p)
1133 return reinterpret_cast<LIBXML2_CharacterData*
>(p);
1138 return reinterpret_cast<LIBXML2_Text*
>(p);
1140static LIBXML2_NodeList*
1143 return reinterpret_cast<LIBXML2_NodeList*
>(p);
1145static LIBXML2_DocumentFragment*
1146impl(DocumentFragmentPrv* p)
1148 return reinterpret_cast<LIBXML2_DocumentFragment*
>(p);
1150static LIBXML2_NamedNodeMap*
1151impl(NamedNodeMapPrv* p)
1153 return reinterpret_cast<LIBXML2_NamedNodeMap*
>(p);
1155static LIBXML2_Comment*
1158 return reinterpret_cast<LIBXML2_Comment*
>(p);
1160static LIBXML2_CDATASection*
1161impl(CDATASectionPrv* p)
1163 return reinterpret_cast<LIBXML2_CDATASection*
>(p);
1165static LIBXML2_ProcessingInstruction*
1166impl(ProcessingInstructionPrv* p)
1168 return reinterpret_cast<LIBXML2_ProcessingInstruction*
>(p);
1170static LIBXML2_EntityReference*
1171impl(EntityReferencePrv* p)
1173 return reinterpret_cast<LIBXML2_EntityReference*
>(p);
1175static LIBXML2_Entity*
1178 return reinterpret_cast<LIBXML2_Entity*
>(p);
1180static LIBXML2_Notation*
1183 return reinterpret_cast<LIBXML2_Notation*
>(p);
1185static LIBXML2_DOMWriter*
1186impl(DOMWriterPrv* p)
1188 return reinterpret_cast<LIBXML2_DOMWriter*
>(p);
1194 return reinterpret_cast<NodePrv*
>(p);
1199 return reinterpret_cast<AttrPrv*
>(p);
1202cvt(LIBXML2_Element* p)
1204 return reinterpret_cast<ElementPrv*
>(p);
1207cvt(LIBXML2_Document* p)
1209 return reinterpret_cast<DocumentPrv*
>(p);
1211static DocumentTypePrv*
1212cvt(LIBXML2_DocumentType* p)
1214 return reinterpret_cast<DocumentTypePrv*
>(p);
1216static ImplementationPrv*
1217cvt(LIBXML2_DOMImplementation* p)
1219 return reinterpret_cast<ImplementationPrv*
>(p);
1221static CharacterDataPrv*
1222cvt(LIBXML2_CharacterData* p)
1224 return reinterpret_cast<CharacterDataPrv*
>(p);
1229 return reinterpret_cast<TextPrv*
>(p);
1232cvt(LIBXML2_NodeList* p)
1234 return reinterpret_cast<NodeListPrv*
>(p);
1236static DocumentFragmentPrv*
1237cvt(LIBXML2_DocumentFragment* p)
1239 return reinterpret_cast<DocumentFragmentPrv*
>(p);
1241static NamedNodeMapPrv*
1242cvt(LIBXML2_NamedNodeMap* p)
1244 return reinterpret_cast<NamedNodeMapPrv*
>(p);
1247cvt(LIBXML2_Comment* p)
1249 return reinterpret_cast<CommentPrv*
>(p);
1251static CDATASectionPrv*
1252cvt(LIBXML2_CDATASection* p)
1254 return reinterpret_cast<CDATASectionPrv*
>(p);
1256static ProcessingInstructionPrv*
1257cvt(LIBXML2_ProcessingInstruction* p)
1259 return reinterpret_cast<ProcessingInstructionPrv*
>(p);
1262cvt(LIBXML2_Entity* p)
1264 return reinterpret_cast<EntityPrv*
>(p);
1266static EntityReferencePrv*
1267cvt(LIBXML2_EntityReference* p)
1269 return reinterpret_cast<EntityReferencePrv*
>(p);
1272cvt(LIBXML2_Notation* p)
1274 return reinterpret_cast<NotationPrv*
>(p);
1277cvt(LIBXML2_DOMWriter* p)
1279 return reinterpret_cast<DOMWriterPrv*
>(p);
1285static const XMLCh g1_0[] =
1286 { chDigit_1, chPeriod, chDigit_0, chNull };
1287static const XMLCh g2_0[] =
1288 { chDigit_2, chPeriod, chDigit_0, chNull };
1289static const XMLCh g3_0[] =
1290 { chDigit_3, chPeriod, chDigit_0, chNull };
1291static const XMLCh gTrav[] =
1292 { chLatin_T, chLatin_r, chLatin_a, chLatin_v, chLatin_e,
1293 chLatin_r, chLatin_s, chLatin_a, chLatin_l, chNull };
1294static const XMLCh gCore[] =
1295 { chLatin_C, chLatin_o, chLatin_r, chLatin_e, chNull };
1296static const XMLCh gRange[] =
1297 { chLatin_R, chLatin_a, chLatin_n, chLatin_g, chLatin_e, chNull };
1298static const XMLCh gLS[] =
1299 { chLatin_L, chLatin_S, chNull };
1300static const XMLCh gXPath[] =
1301 { chLatin_X, chLatin_P, chLatin_a, chLatin_t, chLatin_h, chNull };
1302const XMLCh gXMLString[] = { chLatin_x, chLatin_m, chLatin_l, chNull };
1306format_xml_error(
const xmlError* error)
1309 error = xmlGetLastError();
1311 if (!error || error->code == XML_ERR_OK)
1316 if (error->file && *error->file !=
'\0') {
1317 str = str +
"File ";
1318 str = str + error->file;
1320 if (error->line > 0) {
1321 strError = String::format(
"{0}", error->line);
1322 str = str + (str.empty() ?
"Line " :
", line ") + strError;
1323 if (error->int2 > 0) {
1324 strError = String::format(
"{0}", error->int2);
1325 str = str +
", column " + strError;
1328 const bool two_lines = !str.empty();
1331 switch (error->level) {
1332 case XML_ERR_WARNING:
1333 str = str +
"(warning):";
1336 str = str +
"(error):";
1339 str = str +
"(fatal):";
1345 str = str + (two_lines ?
"\n" :
" ");
1346 if (error->message && *error->message !=
'\0')
1347 str = str + error->message;
1349 strError = String::format(
"{0}", error->code);
1350 str = str +
"Error code " + strError;
1353 if (!str.endsWith(
"\n"))
1359format_xml_parser_error(
const xmlParserCtxt* parser_context)
1361 if (!parser_context)
1362 return "Error. format_xml_parser_error() called with parser_context == nullptr\n";
1363 const xmlErrorPtr error = xmlCtxtGetLastError(
const_cast<xmlParserCtxt*
>(parser_context));
1367 if (!parser_context->wellFormed)
1368 str = str +
"Document not well-formed.\n";
1369 return str + format_xml_error(error);
1373toNodePrv(
const Node& node)
1375 return node._impl();
1384XmlDocumentHolderLibXml2::
1385~XmlDocumentHolderLibXml2()
1387 if (m_document_node)
1388 delete impl(m_document_node);
1394 LIBXML2_Node* n = impl(m_document_node)->cloneNode(
true);
1398void XmlDocumentHolderLibXml2::
1401 domutils::saveDocument(bytes, documentNode().domNode());
1409 domutils::saveDocument(bytes, documentNode().domNode());
1412 String new_s = String::fromUtf8(bytes);
1423 m_p = cvt(getDomImplementation());
1427DOMImplementation(ImplementationPrv* prv)
1432~DOMImplementation() {}
1451bool DOMImplementation::
1452hasFeature(
const DOMString& feature,
const DOMString& version)
const
1455 const XMLCh* xmlfeature =
reinterpret_cast<const XMLCh*
>(feature.utf16().begin());
1456 const XMLCh* xmlversion =
reinterpret_cast<const XMLCh*
>(version.utf16().begin());
1460 if (*xmlfeature == chPlus)
1462 bool anyVersion = (xmlversion == 0 || !*xmlversion);
1463 bool version1_0 = wcscmp(xmlversion, g1_0) == 0;
1464 bool version2_0 = wcscmp(xmlversion, g2_0) == 0;
1465 bool version3_0 = wcscmp(xmlversion, g3_0) == 0;
1467 if (wcscmp(xmlfeature, gXMLString) == 0 && (anyVersion || version1_0 || version2_0))
1469 if (wcscmp(xmlfeature, gCore) == 0 && (anyVersion || version1_0 || version2_0 || version3_0))
1471 if (wcscmp(xmlfeature, gTrav) == 0 && (anyVersion || version2_0))
1473 if (wcscmp(xmlfeature, gRange) == 0 && (anyVersion || version2_0))
1475 if (wcscmp(xmlfeature, gLS) == 0 && (anyVersion || version3_0))
1477 if (wcscmp(xmlfeature, gXPath) == 0 && (anyVersion || version3_0))
1482Document DOMImplementation::
1483createDocument(
const DOMString& namespace_uri,
const DOMString& qualifiedname,
1484 const DocumentType& doctype)
const
1487 LIBXML2_Document* doc =
nullptr;
1489 LIBXML2_DocumentType* doctypei = impl(doctype._impl());
1490 doc = impl(m_p)->createDocument(namespace_uri, qualifiedname, doctypei);
1491 }
catch (
const DOMException& ex) {
1492 cerr <<
"** DOMException call in createDocument(const DOMString& namespace_uri, const DOMString& "
1493 "qualifiedname, const DocumentType& doctype)"
1497 impl(m_p)->SetDocument(doc);
1501DocumentType DOMImplementation::
1502createDocumentType(
const DOMString& qualifiedname,
const DOMString& public_id,
1503 const DOMString& system_id)
const
1506 LIBXML2_DocumentType* doctype = impl(m_p)->createDocumentType(qualifiedname, public_id, system_id);
1507 return cvt(doctype);
1516 throw Arcane::Exception::exception();
1518 if (xml_doc == NULL)
1519 throw Arcane::Exception::exception();
1525 XML_PARSE_SCHEMA_FILE,
1526 XML_PARSE_SCHEMA_MEMORY
1528static xmlParserCtxt*
1529_xmlSchemaValidationAndParsing(
const String& fname, ITraceMng* msg, XML_PARSE_TYPE type,
1532 xmlSchemaPtr schema = NULL;
1533 xmlSchemaValidCtxtPtr vctxt = NULL;
1534 xmlSchemaParserCtxtPtr pctxt = NULL;
1535 xmlParserCtxt* context = NULL;
1536 xmlDocPtr myDoc = NULL;
1539 if ((context = xmlCreateFileParserCtxt(fname.localstr())) == NULL) {
1541 String::format(
"LIBXML2 Could not create File parser context '{0}'\n{1}",
1542 fname, format_xml_error(xmlGetLastError())));
1544 if (type == XML_PARSE_SCHEMA_FILE) {
1546 if ((pctxt = xmlSchemaNewParserCtxt(schemaname.localstr())) == NULL) {
1548 String::format(
"LIBXML2 Could not create context Schema '{0}'\n{1}",
1549 schemaname, format_xml_error(xmlGetLastError())));
1553 if ((pctxt = xmlSchemaNewMemParserCtxt(
1554 const_cast<char*
>(
reinterpret_cast<const char*
>(schemaData.begin())), schemaData.size())) ==
1557 String::format(
"LIBXML2 Could not create context Schema '{0}'\n{1}",
1558 schemaname, format_xml_error(xmlGetLastError())));
1561 xmlSchemaSetParserErrors(pctxt, (xmlSchemaValidityErrorFunc)fprintf, (xmlSchemaValidityWarningFunc)fprintf,
1563 if ((schema = xmlSchemaParse(pctxt)) == NULL) {
1565 String::format(
"LIBXML2 Could not parse Schema '{0}'\n{1}", schemaname,
1566 format_xml_error(xmlGetLastError())));
1569 if ((myDoc = xmlReadFile(fname.localstr(), NULL, 0)) == NULL) {
1571 String::format(
"LIBXML2 Could not read xml file '{0}'\n{1}", fname,
1572 format_xml_error(xmlGetLastError())));
1574 if ((vctxt = xmlSchemaNewValidCtxt(schema)) == NULL) {
1576 String::format(
"LIBXML2 Could not validate context Schema '{0}'\n{1}",
1577 schemaname, format_xml_error(xmlGetLastError())));
1579 xmlSchemaSetParserErrors(pctxt, (xmlSchemaValidityErrorFunc)fprintf, (xmlSchemaValidityWarningFunc)fprintf,
1582 xmlSchemaSetValidOptions(vctxt, XML_SCHEMA_VAL_VC_I_CREATE);
1583 result = xmlSchemaValidateDoc(vctxt, myDoc);
1585 xmlSchemaFreeParserCtxt(pctxt);
1587 xmlSchemaFree(schema);
1589 xmlSchemaFreeValidCtxt(vctxt);
1592 msg->info() <<
"LIBXML2 ---------------- _xmlSchemaValidation OK";
1594 }
else if (result > 0) {
1603 String::format(
"LIBXML2 '{0}' validation generated an internal error \n{1}",
1604 fname, format_xml_error(xmlGetLastError())));
1606 xmlResetLastError();
1608 context->myDoc = myDoc;
1617 if (xml_doc == NULL)
1618 throw Arcane::Exception::exception();
1619 xmlParserCtxt* context = NULL;
1620 char* encoding = NULL;
1623 xinclude_baseurl = platform::getFileDirName(fname) +
"/";
1624 bool _useSchema =
true;
1626 if (schemaname.
null()) {
1630 throw Arcane::XmlException(A_FUNCINFO, String::format(
"LIBXML2 XML file not defined '{0}'\n", fname));
1635 msg->
info() <<
"LIBXML2 ---------------- the parser uses schema (1): " << schemaname;
1636 if ((context = _xmlSchemaValidationAndParsing(fname, msg, XML_PARSE_SCHEMA_FILE, schemaname,
1637 schemaData)) == NULL) {
1639 String::format(
"LIBXML2 XML validation schema '{0}' failed \n", schemaname));
1642 msg->
info() << String::format(
"LIBXML2 '{0}' validates\n", fname);
1646 if ((context = xmlCreateFileParserCtxt(fname.
localstr())) == NULL) {
1648 String::format(
"LIBXML2 Could not create File parser context '{0}'\n{1}",
1649 fname, format_xml_error(xmlGetLastError())));
1654 context->encoding =
reinterpret_cast<xmlChar*
>(encoding);
1656 int options = context->options;
1658 XML_PARSE_DTDLOAD | XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOBLANKS;
1659 if (xinclude_baseurl.
null())
1660 options &= ~XML_PARSE_XINCLUDE;
1662 options |= XML_PARSE_XINCLUDE;
1663 xmlCtxtUseOptions(context, options);
1665 if (!xmlParseDocument(context)) {
1666 ARCANE_ASSERT((context->myDoc != NULL && context->myDoc->URL == NULL), (
"Inconsistent initial state"));
1668 if (!xinclude_baseurl.
null()) {
1669 std::unique_ptr<xmlChar> URL(
new xmlChar[xinclude_baseurl.
len() + 1]);
1671 throw Arcane::Exception::exception();
1672 context->myDoc->URL = URL.get();
1673 strcpy(
const_cast<char*
>(
reinterpret_cast<const char*
>(context->myDoc->URL)),
1676 const int retcode = xmlXIncludeProcess(context->myDoc);
1680 context->myDoc->URL = NULL;
1683 String::format(
"LIBXML2 XInclude processing failed '{0}'\n{1}", fname,
1684 format_xml_error(xmlGetLastError())));
1689 String::format(
"LIBXML2 xmlParseDocument failed 1 '{0}'\n{1}", fname,
1690 format_xml_error(xmlGetLastError())));
1695 static_cast<LIBXML2_Document*
>(WrapXML2Node(NULL,
reinterpret_cast<xmlNode*
>(context->myDoc)));
1696 xml_doc->assignNode(
reinterpret_cast<NodePrv*
>(doc));
1697 doc->Impl_(context->myDoc);
1698 doc->Context_(context);
1699 return xml_doc.release();
1708 if (xml_doc == NULL)
1709 throw Arcane::Exception::exception();
1710 xmlParserCtxt* context = NULL;
1712 LIBXML2_PartialLoad pl = { getDomImplementation(), aErrorMessage };
1713 xmlSetStructuredErrorFunc(
reinterpret_cast<void*
>(&pl), LIBXML2_XMLStructuredHandler);
1714 char* encoding = NULL;
1717 xinclude_baseurl = platform::getFileDirName(fname) +
"/";
1718 bool _useSchema =
true;
1719 if (schemaData.
empty()) {
1723 throw Arcane::XmlException(A_FUNCINFO, String::format(
"LIBXML2 XML file not defined '{0}'\n", fname));
1728 msg->
info() <<
"LIBXML2 ---------------- the parser uses schema (2): " << schemaname;
1730 if ((context = _xmlSchemaValidationAndParsing(fname, msg, XML_PARSE_SCHEMA_MEMORY, schemaname,
1731 schemaData)) == NULL) {
1733 String::format(
"LIBXML2 XML validation schema '{0}' failed \n", schemaname));
1736 msg->
info() << String::format(
"LIBXML2 '{0}' validates", fname);
1740 if ((context = xmlCreateFileParserCtxt(fname.
localstr())) == NULL) {
1742 String::format(
"LIBXML2 xmlCreateFileParserCtxt failed '{0}'\n{1}", fname,
1743 format_xml_error(xmlGetLastError())));
1747 context->encoding =
reinterpret_cast<xmlChar*
>(encoding);
1748 int options = context->options;
1749 options |= XML_PARSE_DTDLOAD | XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID;
1750 if (xinclude_baseurl.
null())
1751 options &= ~XML_PARSE_XINCLUDE;
1753 options |= XML_PARSE_XINCLUDE;
1754 xmlCtxtUseOptions(context, options);
1755 if (!xmlParseDocument(context)) {
1756 ARCANE_ASSERT((context->myDoc != NULL && context->myDoc->URL == NULL), (
"Inconsistent initial state"));
1757 if (!xinclude_baseurl.
null()) {
1758 std::unique_ptr<xmlChar> URL(
new xmlChar[xinclude_baseurl.
len() + 1]);
1760 throw Arcane::Exception::exception();
1761 context->myDoc->URL = URL.get();
1762 strcpy(
const_cast<char*
>(
reinterpret_cast<const char*
>(context->myDoc->URL)),
1765 const int retcode = xmlXIncludeProcess(context->myDoc);
1769 context->myDoc->URL = NULL;
1772 String::format(
"LIBXML2 XInclude processing failed '{0}'\n{1}", fname,
1773 format_xml_error(xmlGetLastError())));
1778 String::format(
"LIBXML2 xmlParseDocument failed 2 '{0}'\n{1}", fname,
1779 format_xml_error(xmlGetLastError())));
1784 static_cast<LIBXML2_Document*
>(WrapXML2Node(NULL,
reinterpret_cast<xmlNode*
>(context->myDoc)));
1785 xml_doc->assignNode(
reinterpret_cast<NodePrv*
>(doc));
1786 doc->Impl_(context->myDoc);
1787 doc->Context_(context);
1788 return xml_doc.release();
1794 ARCANE_UNUSED(trace);
1797 if (xml_doc == NULL)
1798 throw Arcane::Exception::exception();
1800 return xml_doc.release();
1801 xmlParserCtxt* context = NULL;
1803 LIBXML2_PartialLoad pl = { getDomImplementation(), aErrorMessage };
1804 xmlSetStructuredErrorFunc(
reinterpret_cast<void*
>(&pl), LIBXML2_XMLStructuredHandler);
1805 char* encoding = NULL;
1807 String xinclude_baseurl = String();
1809 xinclude_baseurl = platform::getFileDirName(fname) +
"/";
1812 xmlResetLastError();
1813 const XMLByte* src =
reinterpret_cast<const XMLByte*
>(buffer.
begin());
1814 context = xmlCreateMemoryParserCtxt(
1815 reinterpret_cast<const char*
>(src),
1819 String::format(
"LIBXML2 Could not create parser context '{0}'\n{1}", fname,
1820 format_xml_error(xmlGetLastError())));
1823 context->encoding =
reinterpret_cast<xmlChar*
>(encoding);
1824 int options = context->options;
1825 options |= XML_PARSE_DTDLOAD | XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID;
1826 if (xinclude_baseurl.null())
1827 options &= ~XML_PARSE_XINCLUDE;
1829 options |= XML_PARSE_XINCLUDE;
1831 xmlCtxtUseOptions(context, options);
1832 if (!xmlParseDocument(context)) {
1833 ARCANE_ASSERT((context->myDoc != NULL && context->myDoc->URL == NULL), (
"Inconsistent initial state"));
1834 if (!xinclude_baseurl.null()) {
1835 std::unique_ptr<xmlChar> URL(
new xmlChar[xinclude_baseurl.len() + 1]);
1837 throw Arcane::Exception::exception();
1838 context->myDoc->URL = URL.get();
1839 strcpy(
const_cast<char*
>(
reinterpret_cast<const char*
>(context->myDoc->URL)),
1840 xinclude_baseurl.localstr());
1842 const int retcode = xmlXIncludeProcess(context->myDoc);
1846 context->myDoc->URL = NULL;
1849 String::format(
"LIBXML2 XInclude processing failed '{0}'\n{1}", fname,
1850 format_xml_error(xmlGetLastError())));
1855 String::format(
"LIBXML2 xmlParseDocument failed 3 '{0}'{1}\n", fname,
1856 format_xml_error(xmlGetLastError())));
1859 LIBXML2_Document* doc =
1860 static_cast<LIBXML2_Document*
>(WrapXML2Node(NULL,
reinterpret_cast<xmlNode*
>(context->myDoc)));
1861 xml_doc->assignNode(
reinterpret_cast<NodePrv*
>(doc));
1862 doc->Impl_(context->myDoc);
1863 doc->Context_(context);
1864 return xml_doc.release();
1869void DOMImplementation::
1870_save(std::ostream& ostr,
const Document& document,
int indent_level)
1872 bool indented = (indent_level == 1);
1873 LIBXML2_DOMWriter dw(indented);
1876 dw.writeDocument(NULL,
reinterpret_cast<LIBXML2_Document*
>(document._impl()), text);
1877 int len = text.toString().len();
1879 ostr.write(text.toString().localstr(), len);
1901Node(
const Node& from)
1906operator=(
const Node& from)
1938 return impl(
m_p)->nodeType();
1945 LIBXML2_Node* n = impl(
m_p)->firstChild();
1953 LIBXML2_Node* n = impl(
m_p)->lastChild();
1958previousSibling()
const
1961 LIBXML2_Node* n = impl(
m_p)->previousSibling();
1968 LIBXML2_Node* n = impl(
m_p)->nextSibling();
1976 LIBXML2_Node* n = impl(
m_p)->parentNode();
1984 LIBXML2_NodeList* n = impl(
m_p)->childNodes();
1992 return impl(
m_p)->nodeName();
1998 LIBXML2_Node* node = impl(
m_p);
1999 LIBXML2_Element* aElement =
dynamic_cast<LIBXML2_Element*
>(node);
2000 LIBXML2_NamedNodeMap* NamedNodeMap = aElement->attributes();
2001 return cvt(NamedNodeMap);
2005ownerDocument()
const
2008 LIBXML2_Document* d = impl(
m_p)->ownerDocument();
2016 return impl(
m_p)->nodeValue();
2020nodeValue(
const DOMString& str)
const
2023 impl(
m_p)->nodeValue(str);
2027_assign(
const Node& node)
2033insertBefore(
const Node& new_child,
const Node& ref_child)
const
2036 LIBXML2_Node* n = impl(
m_p)->insertBefore(impl(new_child._impl()), impl(ref_child._impl()));
2042replaceChild(
const Node& new_child,
const Node& old_child)
const
2045 LIBXML2_Node* n = impl(
m_p)->replaceChild(impl(new_child._impl()), impl(old_child._impl()));
2050removeChild(
const Node& old_child)
const
2053 LIBXML2_Node* n = impl(
m_p)->removeChild(impl(old_child._impl()));
2058appendChild(
const Node& new_child)
const
2061 LIBXML2_Node* n = impl(
m_p)->appendChild(impl(new_child._impl()));
2066hasChildNodes()
const
2069 return impl(
m_p)->hasChildNodes();
2073cloneNode(
bool deep)
const
2076 LIBXML2_Node* n = impl(
m_p)->cloneNode(deep);
2084 return impl(
m_p)->prefix();
2088prefix(
const DOMString& new_prefix)
const
2091 impl(
m_p)->prefix(new_prefix);
2098 impl(
m_p)->normalize();
2102isSupported(
const DOMString& feature,
const DOMString& version)
const
2105 return impl(
m_p)->isSupported(feature, version);
2112 return impl(
m_p)->namespaceURI();
2119 return impl(
m_p)->localName();
2126 throw NotImplementedException(A_FUNCINFO);
2133 return impl(
m_p)->nodeValue();
2137textContent(
const DOMString& value)
const
2140 impl(
m_p)->nodeValue(value);
2145isSameNode(
const Node& node)
const
2147 return (
this == &node);
2150#ifndef ARCANE_USE_LIBXML2
2152compareTreePosition(
const Node& other)
const
2155 throw NotImplementedException(A_FUNCINFO);
2158#ifndef ARCANE_USE_LIBXML2
2160getInterface(
const DOMString& feature)
const
2163 throw NotImplementedException(A_FUNCINFO);
2168isEqualNode(
const Node& other)
const
2170 return (
this == &other);
2174isDefaultNamespace(
const DOMString& namespace_uri)
const
2176 ARCANE_UNUSED(namespace_uri);
2178 throw NotImplementedException(A_FUNCINFO);
2180#ifndef ARCANE_USE_LIBXML2
2182lookupNamespacePrefix(
const DOMString& namespace_uri,
bool use_default)
const
2184 ARCANE_UNUSED(namespace_uri);
2185 ARCANE_UNUSED(use_default);
2187 throw NotImplementedException(A_FUNCINFO);
2191lookupNamespaceURI(
const DOMString& prefix)
const
2193 ARCANE_UNUSED(prefix);
2195 throw NotImplementedException(A_FUNCINFO);
2199setUserData(
const DOMString& key,
const DOMObject& data,
const UserDataHandler& handler)
const
2202 ARCANE_UNUSED(data);
2203 ARCANE_UNUSED(handler);
2205 throw NotImplementedException(A_FUNCINFO);
2209getUserData(
const DOMString& key)
const
2213 throw NotImplementedException(A_FUNCINFO);
2217operator==(
const Node& n1,
const Node& n2)
2219 return impl(n1.m_p) == impl(n2.m_p);
2223operator!=(
const Node& n1,
const Node& n2)
2225 return !operator==(n1, n2);
2233CharacterData(CharacterDataPrv* prv)
2234: Node(reinterpret_cast<NodePrv*>(impl(prv)))
2243CharacterData(
const CharacterData& node)
2248CharacterData(
const Node& node)
2251 CDATASectionPrv* ni =
reinterpret_cast<CDATASectionPrv*
>(node._impl());
2252 if (ni && (impl(ni)->nodeType() == CDATA_SECTION_NODE))
2256CharacterDataPrv* CharacterData::
2259 return cvt(
reinterpret_cast<LIBXML2_CharacterData*
>(impl(
m_p)));
2268: CharacterData(reinterpret_cast<CharacterDataPrv*>(impl(prv)))
2277Text(
const Text& node)
2278: CharacterData(node)
2282Text(
const Node& node)
2285 TextPrv* ni =
reinterpret_cast<TextPrv*
>(node._impl());
2286 if (ni && (impl(ni)->nodeType() == TEXT_NODE))
2293 return cvt(
reinterpret_cast<LIBXML2_Text*
>(impl(
m_p)));
2304Document(DocumentPrv* prv)
2305: Node(reinterpret_cast<NodePrv*>(impl(prv)))
2309Document(
const Node& node)
2312 DocumentPrv* ni =
reinterpret_cast<DocumentPrv*
>(node._impl());
2313 if (ni && (impl(ni)->nodeType() == DOCUMENT_NODE))
2317DocumentPrv* Document::
2320 return cvt(
reinterpret_cast<LIBXML2_Document*
>(impl(
m_p)));
2323DocumentType Document::
2327 LIBXML2_DocumentType* dt =
reinterpret_cast<LIBXML2_DocumentType*
>(impl(_impl())->doctype());
2331DOMImplementation Document::
2332implementation()
const
2335 return cvt(getDomImplementation());
2339documentElement()
const
2342 LIBXML2_Element* el = impl(_impl())->documentElement();
2347createElement(
const DOMString& name)
const
2350 LIBXML2_Element* el = impl(_impl())->createElement(name);
2354DocumentFragment Document::
2355createDocumentFragment()
const
2358 LIBXML2_DocumentFragment* df = impl(_impl())->createDocumentFragment();
2363createTextNode(
const DOMString& data)
const
2366 LIBXML2_Text* tn = impl(_impl())->createTextNode(data);
2371createComment(
const DOMString& data)
const
2374 LIBXML2_Comment* cn = impl(_impl())->createComment(data);
2378CDATASection Document::
2379createCDATASection(
const DOMString& data)
const
2382 LIBXML2_CDATASection* cds = impl(_impl())->createCDATASection(data);
2386ProcessingInstruction Document::
2387createProcessingInstruction(
const DOMString& target,
const DOMString& data)
const
2390 LIBXML2_ProcessingInstruction* pi = impl(_impl())->createProcessingInstruction(target, data);
2395createAttribute(
const DOMString& name)
const
2398 LIBXML2_Attr* at = impl(_impl())->createAttribute(name);
2402EntityReference Document::
2403createEntityReference(
const DOMString& name)
const
2406 LIBXML2_EntityReference* er = impl(_impl())->createEntityReference(name);
2411getElementsByTagName(
const DOMString& tagname)
const
2414 LIBXML2_NodeList* nl = impl(_impl())->getElementsByTagName(tagname);
2419importNode(
const Node& imported_node,
bool deep)
const
2422 LIBXML2_Node* n = impl(_impl())->importNode(impl(toNodePrv(imported_node)), deep);
2427createElementNS(
const DOMString& namespace_uri,
const DOMString& qualifiedname)
const
2430 LIBXML2_Element* el = impl(_impl())->createElementNS(namespace_uri, qualifiedname);
2435createAttributeNS(
const DOMString& namespace_uri,
const DOMString& qualifiedname)
const
2438 LIBXML2_Attr* at = impl(_impl())->createAttributeNS(namespace_uri, qualifiedname);
2443getElementsByTagNameNS(
const DOMString& namespace_uri,
const DOMString& localname)
const
2446 LIBXML2_NodeList* nl = impl(_impl())->getElementsByTagNameNS(namespace_uri, localname);
2451getElementById(
const DOMString& element_id)
const
2454 LIBXML2_Element* el = impl(_impl())->getElementById(element_id);
2459actualEncoding()
const
2462 throw NotImplementedException(A_FUNCINFO);
2466actualEncoding(
const DOMString& value)
const
2468 ARCANE_UNUSED(value);
2470 throw NotImplementedException(A_FUNCINFO);
2477 throw NotImplementedException(A_FUNCINFO);
2481encoding(
const DOMString& value)
const
2483 ARCANE_UNUSED(value);
2485 throw NotImplementedException(A_FUNCINFO);
2492 throw NotImplementedException(A_FUNCINFO);
2496standalone(
bool value)
const
2498 ARCANE_UNUSED(value);
2500 throw NotImplementedException(A_FUNCINFO);
2504strictErrorChecking()
const
2507 throw NotImplementedException(A_FUNCINFO);
2511strictErrorChecking(
bool value)
const
2513 ARCANE_UNUSED(value);
2515 throw NotImplementedException(A_FUNCINFO);
2517#ifndef ARCANE_USE_LIBXML2
2522 throw NotImplementedException(A_FUNCINFO);
2525#ifndef ARCANE_USE_LIBXML2
2527version(
const DOMString& value)
const
2529 ARCANE_UNUSED(value);
2531 throw NotImplementedException(A_FUNCINFO);
2536documentURI(
const DOMString& document_uri)
const
2538 ARCANE_UNUSED(document_uri);
2540 throw NotImplementedException(A_FUNCINFO);
2547 throw NotImplementedException(A_FUNCINFO);
2551adoptNode(
const Node& source)
const
2553 ARCANE_UNUSED(source);
2555 throw NotImplementedException(A_FUNCINFO);
2562 throw NotImplementedException(A_FUNCINFO);
2566renameNode(
const Node& node,
const DOMString& namespace_uri,
const DOMString& name)
2568 ARCANE_UNUSED(node);
2569 ARCANE_UNUSED(namespace_uri);
2570 ARCANE_UNUSED(name);
2572 throw NotImplementedException(A_FUNCINFO);
2585DocumentFragment(DocumentFragmentPrv* prv)
2586: Node(reinterpret_cast<NodePrv*>(impl(prv)))
2599Comment(CommentPrv* prv)
2600: CharacterData(reinterpret_cast<CharacterDataPrv*>(impl(prv)))
2613CDATASection(CDATASectionPrv* prv)
2614: Text(reinterpret_cast<TextPrv*>(impl(prv)))
2627EntityReference(EntityReferencePrv* prv)
2628: Node(reinterpret_cast<NodePrv*>(impl(prv)))
2641NodeList(NodeListPrv* prv)
2653item(ULong index)
const
2656 LIBXML2_Node* n = impl(m_p)->item(index);
2664 return impl(m_p)->length();
2671DOMString CharacterData::
2675 return impl(_impl())->Data();
2679data(
const DOMString& value)
const
2682 impl(_impl())->Data(value);
2685ULong CharacterData::
2689 return impl(_impl())->length();
2692DOMString CharacterData::
2693substringData(ULong offset, ULong count)
const
2696 return impl(_impl())->substringdata(offset, count);
2700appendData(
const DOMString& arg)
const
2703 impl(_impl())->appenddata(arg);
2707insertData(ULong offset,
const DOMString& arg)
const
2710 impl(_impl())->insertdata(offset, arg);
2714deleteData(ULong offset, ULong count)
const
2717 impl(_impl())->deletedata(offset, count);
2721replaceData(ULong offset, ULong count,
const DOMString& arg)
const
2724 impl(_impl())->replacedata(offset, count, arg);
2738: Node(reinterpret_cast<NodePrv*>(impl(prv)))
2743: Node((const Node&)f)
2747Attr(
const Node& node)
2750 AttrPrv* ni =
reinterpret_cast<AttrPrv*
>(node._impl());
2751 if (ni && (impl(ni)->nodeType() == ATTRIBUTE_NODE))
2761 return cvt(
reinterpret_cast<LIBXML2_Attr*
>(impl(
m_p)));
2768 return impl(_impl())->name();
2775 return impl(_impl())->specified();
2782 return impl(_impl())->value();
2786value(
const DOMString& str)
const
2789 impl(_impl())->value(str);
2796 LIBXML2_Element* el = impl(_impl())->ownerElement();
2810Element(ElementPrv* prv)
2811: Node(reinterpret_cast<NodePrv*>(impl(prv)))
2815Element(
const Node& node)
2818 ElementPrv* ni =
reinterpret_cast<ElementPrv*
>(node._impl());
2819 if (ni && (impl(ni)->nodeType() == ELEMENT_NODE))
2824Element(
const Element& node)
2828ElementPrv* Element::
2831 return cvt(
reinterpret_cast<LIBXML2_Element*
>(impl(
m_p)));
2838 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2839 return el->tagName();
2843getAttribute(
const DOMString& name)
const
2846 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2847 return el->getAttribute(name);
2851setAttribute(
const DOMString& name,
const DOMString& value)
const
2854 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2855 el->setAttribute(name, value);
2859removeAttribute(
const DOMString& name)
const
2862 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2863 el->removeAttribute(name);
2867getAttributeNode(
const DOMString& name)
const
2870 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2871 LIBXML2_Attr* attr = el->getAttributeNode(name);
2876setAttributeNode(
const Attr& new_attr)
const
2879 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2880 LIBXML2_Attr* attr = el->setAttributeNode(impl(new_attr._impl()));
2885removeAttributeNode(
const Attr& old_attr)
const
2888 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2889 LIBXML2_Attr* attr = el->removeAttributeNode(impl(old_attr._impl()));
2894getElementsByTagName(
const DOMString& name)
const
2897 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2898 LIBXML2_NodeList* ndl = el->getElementsByTagName(name);
2899 return NodeList(
reinterpret_cast<NodeListPrv*
>(ndl));
2903getAttributeNS(
const DOMString& namespace_uri,
const DOMString& localname)
const
2906 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2907 return el->getAttributeNS(namespace_uri, localname);
2911setAttributeNS(
const DOMString& namespace_uri,
const DOMString& localname,
2912 const DOMString& value)
const
2915 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2916 el->setAttributeNS(namespace_uri, localname, value);
2920removeAttributeNS(
const DOMString& namespace_uri,
const DOMString& localname)
const
2923 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2924 el->removeAttributeNS(namespace_uri, localname);
2928getAttributeNodeNS(
const DOMString& namespace_uri,
const DOMString& localname)
const
2931 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2932 LIBXML2_Attr* attr = el->getAttributeNodeNS(namespace_uri, localname);
2937setAttributeNodeNS(
const Attr& new_attr)
const
2940 new_attr._checkValid();
2941 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2942 LIBXML2_Attr* attr = el->setAttributeNodeNS(impl(new_attr._impl()));
2947getElementsByTagNameNS(
const DOMString& namespace_uri,
const DOMString& localname)
const
2950 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2951 LIBXML2_NodeList* ndl = el->getElementsByTagNameNS(namespace_uri, localname);
2952 return NodeList(cvt(ndl));
2956hasAttribute(
const DOMString& name)
const
2959 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2960 return el->hasAttribute(name);
2964hasAttributeNS(
const DOMString& namespace_uri,
const DOMString& localname)
const
2967 LIBXML2_Element* el =
reinterpret_cast<LIBXML2_Element*
>(_impl());
2968 return el->hasAttributeNS(namespace_uri, localname);
2976splitText(ULong offset)
const
2979 LIBXML2_Text* txt =
reinterpret_cast<LIBXML2_Text*
>(_impl());
2980 LIBXML2_Text* txt2 = txt->splitText(offset);
2981 return Text(cvt(txt2));
2984#ifndef ARCANE_USE_LIBXML2
2986isWhiteSpaceInElementContent()
const
2989 throw NotImplementedException(A_FUNCINFO);
2997 throw NotImplementedException(A_FUNCINFO);
3001replaceWholeText(
const DOMString& content)
const
3003 ARCANE_UNUSED(content);
3005 throw NotImplementedException(A_FUNCINFO);
3018DocumentType(DocumentTypePrv* prv)
3019: Node(reinterpret_cast<NodePrv*>(impl(prv)))
3022DocumentTypePrv* DocumentType::
3025 return cvt(
reinterpret_cast<LIBXML2_DocumentType*
>(
m_p));
3028DOMString DocumentType::
3032 return impl(_impl())->name();
3035NamedNodeMap DocumentType::
3039 LIBXML2_NamedNodeMap* nnodeMap = impl(_impl())->entities();
3040 return NamedNodeMap(
reinterpret_cast<NamedNodeMapPrv*
>(nnodeMap));
3043NamedNodeMap DocumentType::
3047 LIBXML2_NamedNodeMap* nnodeMap = impl(_impl())->notations();
3048 return NamedNodeMap(
reinterpret_cast<NamedNodeMapPrv*
>(nnodeMap));
3051DOMString DocumentType::
3055 return impl(_impl())->publicId();
3058DOMString DocumentType::
3062 return impl(_impl())->systemId();
3065DOMString DocumentType::
3066internalSubset()
const
3069 return impl(_impl())->internalSubset();
3076NotationPrv* Notation::
3079 return cvt(
reinterpret_cast<LIBXML2_Notation*
>(impl(
m_p)));
3086 return impl(_impl())->publicId();
3093 return impl(_impl())->systemId();
3103 return cvt(
reinterpret_cast<LIBXML2_Entity*
>(impl(
m_p)));
3110 return impl(_impl())->publicId();
3117 return impl(_impl())->systemId();
3124 return impl(_impl())->notationName();
3127#ifndef ARCANE_USE_LIBXML2
3129actualEncoding()
const
3132 throw NotImplementedException(A_FUNCINFO);
3135#ifndef ARCANE_USE_LIBXML2
3137actualEncoding(
const DOMString& value)
const
3140 throw NotImplementedException(A_FUNCINFO);
3143#ifndef ARCANE_USE_LIBXML2
3148 throw NotImplementedException(A_FUNCINFO);
3151#ifndef ARCANE_USE_LIBXML2
3153encoding(
const DOMString& value)
const
3156 throw NotImplementedException(A_FUNCINFO);
3159#ifndef ARCANE_USE_LIBXML2
3164 throw NotImplementedException(A_FUNCINFO);
3167#ifndef ARCANE_USE_LIBXML2
3169version(
const DOMString& value)
const
3172 throw NotImplementedException(A_FUNCINFO);
3180ProcessingInstruction::
3181ProcessingInstruction()
3185ProcessingInstruction::
3186ProcessingInstruction(ProcessingInstructionPrv* prv)
3187: Node(reinterpret_cast<NodePrv*>(impl(prv)))
3190ProcessingInstructionPrv* ProcessingInstruction::
3193 return cvt(
reinterpret_cast<LIBXML2_ProcessingInstruction*
>(impl(
m_p)));
3196DOMString ProcessingInstruction::
3200 return impl(_impl())->target();
3203DOMString ProcessingInstruction::
3207 return impl(_impl())->Data();
3210void ProcessingInstruction::
3211data(
const DOMString& value)
const
3214 impl(_impl())->Data(value);
3225NamedNodeMap(NamedNodeMapPrv* p)
3230NamedNodeMap(
const NamedNodeMap& from)
3234const NamedNodeMap& NamedNodeMap::
3235operator=(
const NamedNodeMap& from)
3244NamedNodeMapPrv* NamedNodeMap::
3261 return impl(m_p)->length();
3265getNamedItem(
const DOMString& name)
const
3269 LIBXML2_Node* n = impl(m_p)->getNamedItem(name);
3274setNamedItem(
const Node& arg)
const
3276 if (_null() || arg._null())
3278 LIBXML2_Node* n = impl(_impl())->setNamedItem(impl(arg._impl()));
3279 return Node(
reinterpret_cast<NodePrv*
>(n));
3283removeNamedItem(
const DOMString& name)
const
3287 LIBXML2_Node* n = impl(_impl())->removeNamedItem(name);
3288 return Node(cvt(n));
3292item(ULong index)
const
3296 LIBXML2_Node* n = impl(m_p)->item(index);
3297 return Node(
reinterpret_cast<NodePrv*
>(n));
3301getNamedItemNS(
const DOMString& namespace_uri,
const DOMString& localname)
const
3305 LIBXML2_Node* n = impl(_impl())->getNamedItemNS(namespace_uri, localname);
3306 return Node(
reinterpret_cast<NodePrv*
>(n));
3310setNamedItemNS(
const Node& arg)
const
3316 LIBXML2_Node* n = impl(_impl())->setNamedItemNS(impl(arg._impl()));
3317 return Node(cvt(n));
3321removeNamedItemNS(
const DOMString& namespace_uri,
const DOMString& localname)
const
3325 LIBXML2_Node* n = impl(_impl())->removeNamedItemNS(namespace_uri, localname);
3326 return Node(cvt(n));
3333DOMImplementation DOMImplementationSource::
3334getDOMImplementation(
const DOMString& features)
const
3336 ARCANE_UNUSED(features);
3337 throw NotImplementedException(A_FUNCINFO);
3343void UserDataHandler::
3344handle(UShort operation,
const DOMString& key,
const DOMObject& data,
const Node& src,
3345 const Node& dest)
const
3347 ARCANE_UNUSED(operation);
3349 ARCANE_UNUSED(data);
3351 ARCANE_UNUSED(dest);
3352 throw NotImplementedException(A_FUNCINFO);
3365DOMWriter(DOMWriterPrv* p)
3370DOMWriter(
const DOMWriter& from)
3374const DOMWriter& DOMWriter::
3375operator=(
const DOMWriter& from)
3397DOMWriterPrv* DOMWriter::
3404writeNode(
const Node& node)
const
3406 ARCANE_UNUSED(node);
3408 throw NotImplementedException(A_FUNCINFO);
3412encoding(
const String& encoding)
3414 ARCANE_UNUSED(encoding);
3415 throw NotImplementedException(A_FUNCINFO);
3421 throw NotImplementedException(A_FUNCINFO);
3434DOMError(DOMErrorPrv* p)
3439DOMError(
const DOMError& from)
3443const DOMError& DOMError::
3444operator=(
const DOMError& from)
3466DOMErrorPrv* DOMError::
3475 throw NotImplementedException(A_FUNCINFO);
3481 throw NotImplementedException(A_FUNCINFO);
3485relatedException()
const
3487 throw NotImplementedException(A_FUNCINFO);
3490DOMLocator DOMError::
3493 throw NotImplementedException(A_FUNCINFO);
3500bool DOMErrorHandler::
3501handleError(
const DOMError& error)
const
3503 ARCANE_UNUSED(error);
3504 throw NotImplementedException(A_FUNCINFO);
3517DOMLocator(DOMLocatorPrv* p)
3522DOMLocator(
const DOMLocator& from)
3526const DOMLocator& DOMLocator::
3527operator=(
const DOMLocator& from)
3549DOMLocatorPrv* DOMLocator::
3558 throw NotImplementedException(A_FUNCINFO);
3564 throw NotImplementedException(A_FUNCINFO);
3567#ifndef ARCANE_USE_LIBXML2
3571 throw NotImplementedException(A_FUNCINFO);
3575#ifndef ARCANE_USE_LIBXML2
3579 throw NotImplementedException(A_FUNCINFO);
3583DOMString DOMLocator::
3593XPathExpression XPathEvaluator::
3594createExpression(
const DOMString& expression,
const XPathNSResolver& resolver)
const
3596 ARCANE_UNUSED(expression);
3597 ARCANE_UNUSED(resolver);
3598 throw NotImplementedException(A_FUNCINFO);
3601XPathResult XPathEvaluator::
3604 throw NotImplementedException(A_FUNCINFO);
3607XPathNSResolver XPathEvaluator::
3608createNSResolver(
const Node& node_resolver)
const
3610 ARCANE_UNUSED(node_resolver);
3611 throw NotImplementedException(A_FUNCINFO);
3614XPathResult XPathEvaluator::
3615evaluate(
const DOMString& expression,
const Node& context_node,
3616 const XPathNSResolver& resolver, UShort type,
const XPathResult& result)
const
3618 ARCANE_UNUSED(expression);
3619 ARCANE_UNUSED(context_node);
3620 ARCANE_UNUSED(resolver);
3621 ARCANE_UNUSED(type);
3622 ARCANE_UNUSED(result);
3623 throw NotImplementedException(A_FUNCINFO);
3626XPathResult XPathEvaluator::
3627evaluateExpression(
const XPathExpression& expression,
const Node& context_node, UShort type,
3628 const XPathResult& result)
const
3630 ARCANE_UNUSED(expression);
3631 ARCANE_UNUSED(context_node);
3632 ARCANE_UNUSED(type);
3633 ARCANE_UNUSED(result);
3634 throw NotImplementedException(A_FUNCINFO);
3641DOMString XPathNSResolver::
3642lookupNamespaceURI(
const DOMString& prefix)
const
3644 ARCANE_UNUSED(prefix);
3645 throw NotImplementedException(A_FUNCINFO);
3654 throw NotImplementedException(A_FUNCINFO);
3660 throw NotImplementedException(A_FUNCINFO);
3663DOMString XPathResult::
3666 throw NotImplementedException(A_FUNCINFO);
3672 throw NotImplementedException(A_FUNCINFO);
3676singleNodeValue()
const
3678 throw NotImplementedException(A_FUNCINFO);
3681XPathSetIterator XPathResult::
3682getSetIterator(
bool ordered)
const
3684 ARCANE_UNUSED(ordered);
3685 throw NotImplementedException(A_FUNCINFO);
3688XPathSetSnapshot XPathResult::
3689getSetSnapshot(
bool ordered)
const
3691 ARCANE_UNUSED(ordered);
3692 throw NotImplementedException(A_FUNCINFO);
3699Node XPathSetIterator::
3702 throw NotImplementedException(A_FUNCINFO);
3708ULong XPathSetSnapshot::
3711 throw NotImplementedException(A_FUNCINFO);
3714Node XPathSetSnapshot::
3715item(ULong index)
const
3717 ARCANE_UNUSED(index);
3718 throw NotImplementedException(A_FUNCINFO);
3725Element XPathNamespace::
3728 throw NotImplementedException(A_FUNCINFO);
3734LIBXML2_DOMImplementation*
3735getDomImplementation()
3737 return LIBXML2_DOMImplementation::sDOMImplementation;
3740LIBXML2_DOMImplementation::
3741~LIBXML2_DOMImplementation()
3743 LIBXML2_Document* _xDoc = GetDocument();
3745 xmlParserCtxtPtr ctxt = _xDoc->Context_();
3748 xmlFreeDoc(ctxt->myDoc);
3750 xmlFreeParserCtxt(ctxt);
3752 _xmlDoc* myDoc = _xDoc->Impl_();
3757 SetDocument(
nullptr);
3761std::unique_ptr<LIBXML2_DOMImplementation> sDom(
new LIBXML2_DOMImplementation());
3762LIBXML2_DOMImplementation* LIBXML2_DOMImplementation::sDOMImplementation = sDom.release();
3765LIBXML2_NewElement(LIBXML2_Document* doc,
const String& nsURI,
const String& elname)
3767 ARCANE_UNUSED(nsURI);
3768 ARCANE_UNUSED(elname);
3769 return new LIBXML2_Element(doc);
3773LIBXML2_NewDocument(
const String& nsURI)
3775 ARCANE_UNUSED(nsURI);
3776 return new LIBXML2_Document();
3779bool LIBXML2_DOMImplementation::
3780hasFeature(
const String& feature,
const String& version)
3782 return (feature ==
"Core" && (version ==
"1.0" || version ==
"2.0" || version ==
"3.0"));
3785LIBXML2_DocumentType* LIBXML2_DOMImplementation::
3786createDocumentType(
const String& qualifiedname,
const String& publicId,
3787 const String& systemId)
3789 return new LIBXML2_DocumentType(NULL, qualifiedname, publicId, systemId);
3792LIBXML2_Document* LIBXML2_DOMImplementation::
3793createDocument(
const String& namespaceURI,
const String& qualifiedname,
3794 LIBXML2_DocumentType* doctype)
3796 const XMLCh* cqname =
reinterpret_cast<const XMLCh*
>(qualifiedname.utf16().begin());
3797 const XMLCh* cpos = wcschr(cqname, L
':');
3803 String localName = String::fromUtf8(utf8_array);
3804 if (namespaceURI == String()) {
3805 throw Arcane::Exception::exception();
3807 if (cpos - cqname == 3 && !wcsncmp(cqname, U(
"xml"), 3) &&
3808 qualifiedname !=
"http://www.w3.org/XML/1998/namespace") {
3809 throw Arcane::Exception::exception();
3812 if (doctype && doctype->mDocument != NULL) {
3813 throw Arcane::Exception::exception();
3815 LIBXML2_Document* doc = LIBXML2_NewDocument(namespaceURI);
3817 throw Arcane::Exception::exception();
3818 if (doctype != NULL) {
3819 doctype->mDocument = doc;
3820 doctype->mDocumentIsAncestor =
false;
3822 doc->insertBeforePrivate(doctype, NULL)->release_ref();
3825 LIBXML2_Element* docel =
new LIBXML2_Element(doc);
3827 throw Arcane::Exception::exception();
3828 docel->mNamespaceURI = namespaceURI;
3829 docel->mNodeName = qualifiedname;
3830 docel->mLocalName = localName;
3832 doc->mNamespaceURI = namespaceURI;
3833 doc->mNodeName = qualifiedname;
3834 doc->mLocalName = localName;
3835 doc->appendChild(docel)->release_ref();
3837 _xmlDoc* myDoc = xmlNewDoc(
reinterpret_cast<const xmlChar*
>(
"1.0"));
3839 throw Arcane::Exception::exception();
3846LIBXML2_Node(LIBXML2_Document* aDocument)
3848, mDocumentIsAncestor(false)
3849, mDocument(aDocument)
3850, mNodeType(DOCUMENT_NODE)
3853 mDocument->add_ref();
3859 if (!mDocumentIsAncestor && mDocument)
3860 mDocument->release_ref();
3862 for (std::list<LIBXML2_Node*>::iterator i2(mNodeList.begin()); i2 != mNodeList.end(); i2++)
3866String LIBXML2_Node::
3872String LIBXML2_Node::
3879nodeValue(
const String& attr)
3890LIBXML2_Node* LIBXML2_Node::
3893 if (mParent != NULL)
3898LIBXML2_NodeList* LIBXML2_Node::
3901 return new LIBXML2_NodeList(
this);
3904LIBXML2_Node* LIBXML2_Node::
3907 for (std::list<LIBXML2_Node*>::iterator i = mNodeList.begin(); i != mNodeList.end(); i++) {
3908 UInt16 type = (*i)->nodeType();
3909 if (type != LIBXML2_Node::ATTRIBUTE_NODE && type != LIBXML2_Node::NOTATION_NODE &&
3910 type != LIBXML2_Node::ENTITY_NODE) {
3918LIBXML2_Node* LIBXML2_Node::
3921 std::list<LIBXML2_Node*>::iterator i = mNodeList.end();
3922 while (i != mNodeList.begin()) {
3924 UInt16 type = (*i)->nodeType();
3925 if (type != LIBXML2_Node::ATTRIBUTE_NODE && type != LIBXML2_Node::NOTATION_NODE &&
3926 type != LIBXML2_Node::ENTITY_NODE) {
3934LIBXML2_Node* LIBXML2_Node::
3937 if (mParent == NULL)
3939 if (nodeType() == LIBXML2_Node::ATTRIBUTE_NODE)
3941 std::list<LIBXML2_Node*>::iterator i = mPositionInParent;
3943 if (i == mParent->mNodeList.begin())
3946 UInt16 type = (*i)->nodeType();
3947 if (type != LIBXML2_Node::ATTRIBUTE_NODE && type != LIBXML2_Node::ENTITY_NODE &&
3948 type != LIBXML2_Node::NOTATION_NODE) {
3955LIBXML2_Node* LIBXML2_Node::
3958 if (mParent == NULL)
3960 if (nodeType() == LIBXML2_Node::ATTRIBUTE_NODE)
3962 std::list<LIBXML2_Node*>::iterator i = mPositionInParent;
3965 if (i == mParent->mNodeList.end())
3967 UInt16 type = (*i)->nodeType();
3968 if (type != LIBXML2_Node::ATTRIBUTE_NODE && type != LIBXML2_Node::ENTITY_NODE &&
3969 type != LIBXML2_Node::NOTATION_NODE) {
3976LIBXML2_NamedNodeMap* LIBXML2_Node::
3979 return (LIBXML2_NamedNodeMap*)(
new LIBXML2_EmptyNamedNodeMap());
3982LIBXML2_Document* LIBXML2_Node::
3985 if (mDocument != NULL)
3986 mDocument->add_ref();
3991updateDocumentAncestorStatus(
bool aStatus)
3993 if (mDocumentIsAncestor == aStatus)
3995 if (aStatus && mDocument) {
3997 mDocument->release_ref();
3998 }
else if (mDocument && !aStatus) {
4000 mDocument->add_ref();
4002 mDocumentIsAncestor = aStatus;
4004 for (std::list<LIBXML2_Node*>::iterator i = mNodeList.begin(); i != mNodeList.end(); i++)
4005 (*i)->updateDocumentAncestorStatus(aStatus);
4008LIBXML2_Node* LIBXML2_Node::
4009insertBefore(LIBXML2_Node* newChild, LIBXML2_Node* refChild)
4011 if (newChild == NULL)
4012 throw Arcane::Exception::exception();
4014 UInt16 type = newChild->nodeType();
4017 if (type == LIBXML2_Node::ATTRIBUTE_NODE || type == LIBXML2_Node::DOCUMENT_NODE ||
4018 type == LIBXML2_Node::DOCUMENT_TYPE_NODE || type == LIBXML2_Node::NOTATION_NODE ||
4019 type == LIBXML2_Node::ENTITY_NODE)
4020 throw Arcane::Exception::exception();
4021 if (type == LIBXML2_Node::DOCUMENT_FRAGMENT_NODE) {
4022 if (newChild == NULL)
4023 throw Arcane::Exception::exception();
4025 for (std::list<LIBXML2_Node*>::iterator i = newChild->mNodeList.begin(); i != newChild->mNodeList.end();
4027 insertBefore(*i, refChild)->release_ref();
4028 newChild->add_ref();
4031 return insertBeforePrivate(newChild, refChild);
4034LIBXML2_Node* LIBXML2_Node::
4035insertBeforePrivate(LIBXML2_Node* newChild, LIBXML2_Node* refChild)
4038 if (newChild == NULL)
4039 throw Arcane::Exception::exception();
4041 if (refChild && refChild->mParent !=
this)
4042 throw Arcane::Exception::exception();
4043 if (newChild->mDocument != mDocument)
4044 throw Arcane::Exception::exception();
4045 if (newChild == refChild) {
4047 newChild->add_ref();
4050 if (newChild->mParent != NULL) {
4052 LIBXML2_Node* n =
this;
4055 throw Arcane::Exception::exception();
4059 std::list<LIBXML2_Node*>::iterator posit;
4060 if (newChild->mParent != NULL) {
4061 ARCANE_ASSERT(!refChild || (refChild->mParent ==
this),
4062 (
"The child belongs to us, but isn't on the list!"));
4063 newChild->mParent->removeChild(newChild)->release_ref();
4064 ARCANE_ASSERT(!refChild || (refChild->mParent ==
this),
4065 (
"The child belongs to us, but isn't on the list!"));
4068 if (newChild->mParent != NULL)
4069 throw Arcane::Exception::exception();
4070 if (refChild != NULL) {
4071 posit = std::find(mNodeList.begin(), mNodeList.end(), refChild);
4072 if (posit == mNodeList.end()) {
4074 ARCANE_ASSERT(refChild->mParent ==
this, (
"The child belongs to us, but isn't on the list!"));
4075 throw Arcane::Exception::exception();
4078 posit = mNodeList.end();
4080 if (mDocumentIsAncestor)
4081 newChild->updateDocumentAncestorStatus(
true);
4082 newChild->mParent =
this;
4083 newChild->mPositionInParent = mNodeList.insert(posit, newChild);
4084 UInt32 i, rc = newChild->_libxml2_refcount;
4085 for (i = 0; i < rc; i++)
4087 newChild->add_ref();
4091LIBXML2_Node* LIBXML2_Node::
4092replaceChild(LIBXML2_Node* newChild, LIBXML2_Node* oldChild)
4094 if (newChild == oldChild) {
4095 oldChild->add_ref();
4098 if (oldChild == NULL)
4099 throw Arcane::Exception::exception();
4100 insertBefore(newChild, oldChild)->release_ref();
4101 return removeChild(oldChild);
4104LIBXML2_Node* LIBXML2_Node::
4105removeChild(LIBXML2_Node* oldChild)
4107 if (oldChild == NULL)
4108 throw Arcane::Exception::exception();
4109 UInt16 type = oldChild->nodeType();
4110 if (type == LIBXML2_Node::ATTRIBUTE_NODE || type == LIBXML2_Node::DOCUMENT_TYPE_NODE ||
4111 type == LIBXML2_Node::NOTATION_NODE || type == LIBXML2_Node::ENTITY_NODE)
4112 throw Arcane::Exception::exception();
4113 return removeChildPrivate(oldChild);
4116LIBXML2_Node* LIBXML2_Node::
4117removeChildPrivate(LIBXML2_Node* oldChild)
4119 std::list<LIBXML2_Node*>::iterator posit = std::find(mNodeList.begin(), mNodeList.end(), oldChild);
4120 if (posit == mNodeList.end())
4121 throw Arcane::Exception::exception();
4122 mNodeList.erase(posit);
4123 oldChild->mParent = NULL;
4124 UInt32 i, rc = oldChild->_libxml2_refcount;
4125 for (i = 0; i < rc; i++)
4127 if (mDocumentIsAncestor)
4128 oldChild->updateDocumentAncestorStatus(
false);
4129 oldChild->add_ref();
4133LIBXML2_Node* LIBXML2_Node::
4134appendChild(LIBXML2_Node* inewChild)
4136 return insertBefore(inewChild, NULL);
4142 return !mNodeList.empty();
4145LIBXML2_Node* LIBXML2_Node::
4148 return cloneNodePrivate(mDocument, deep);
4151LIBXML2_Node* LIBXML2_Node::
4152cloneNodePrivate(LIBXML2_Document* aDoc,
bool deep)
4154 LIBXML2_Node* c = shallowCloneNode(aDoc);
4160 for (std::list<LIBXML2_Node*>::iterator i = mNodeList.begin(); i != mNodeList.end(); i++) {
4162 if ((*i)->nodeType() == LIBXML2_Node::ATTRIBUTE_NODE)
4164 LIBXML2_Node* n = (*i)->cloneNodePrivate(c->mDocument,
true);
4165 c->insertBeforePrivate(n, NULL)->release_ref();
4175 std::list<LIBXML2_Node*>::iterator i;
4176 for (i = mNodeList.begin(); i != mNodeList.end(); i++)
4181 LIBXML2_TextBase* lastText = NULL;
4182 for (i = mNodeList.begin(); i != mNodeList.end(); i++) {
4183 LIBXML2_TextBase* tb =
dynamic_cast<LIBXML2_TextBase*
>(*i);
4188 if (tb->mNodeValue == String()) {
4189 removeChild(tb)->release_ref();
4192 if (lastText != NULL) {
4193 removeChild(tb)->release_ref();
4194 lastText->mNodeValue = lastText->mNodeValue + tb->mNodeValue;
4202isSupported(
const String& feature,
const String& version)
4204 if ((feature ==
"xml" && (version ==
"1.0")) || (version ==
"2.0") || (version ==
"3.0"))
4206 if ((feature ==
"Core" && (version ==
"1.0")) || (version ==
"2.0") || (version ==
"3.0"))
4208 if (feature ==
"Trav" && (version ==
"2.0"))
4210 if (feature ==
"Range" && (version ==
"2.0"))
4212 if (feature ==
"LS" && (version ==
"2.0"))
4214 if (feature ==
"XPath" && (version ==
"3.0"))
4219String LIBXML2_Node::
4222 return mNamespaceURI;
4225String LIBXML2_Node::
4228 const XMLCh* cNodename =
reinterpret_cast<const XMLCh*
>(mNodeName.
utf16().begin());
4229 const XMLCh* cpos = wcschr(cNodename, U(
':'));
4233 return mNodeName.
substring(0, wcslen(cNodename) - wcslen(cpos));
4237prefix(
const String& attr)
4239 if (mNamespaceURI == String())
4240 throw Arcane::Exception::exception();
4241 if (attr ==
"xml" && mNamespaceURI !=
"http://www.w3.org/XML/1998/namespace")
4242 throw Arcane::Exception::exception();
4243 if (mLocalName ==
"xmlns" && attr != String())
4244 throw Arcane::Exception::exception();
4245 if (attr ==
"xmlns" && mNamespaceURI !=
"http://www.w3.org/2000/xmlns/")
4246 throw Arcane::Exception::exception();
4248 mNodeName = mNodeName +
":";
4249 mNodeName = mNodeName + mLocalName;
4252String LIBXML2_Node::
4259recursivelyChangeDocument(LIBXML2_Document* aNewDocument)
4261 ARCANE_ASSERT(!mDocumentIsAncestor, (
"The document is the ancestor !"));
4262 if (mDocument == aNewDocument)
4264 if (mDocument != NULL)
4265 mDocument->release_ref();
4266 mDocument = aNewDocument;
4267 if (mDocument != NULL)
4268 mDocument->add_ref();
4269 for (std::list<LIBXML2_Node*>::iterator i = mNodeList.begin(); i != mNodeList.end(); i++)
4270 (*i)->recursivelyChangeDocument(mDocument);
4273LIBXML2_Element* LIBXML2_Node::
4274searchForElementById(
const String& elementId)
4276 for (std::list<LIBXML2_Node*>::iterator i = mNodeList.begin(); i != mNodeList.end(); i++) {
4277 LIBXML2_Element* e = (*i)->searchForElementById(elementId);
4284#ifdef DEBUG_NODELEAK
4289 for (std::list<LIBXML2_Node*>::const_iterator i(mNodeList.begin()); i != mNodeList.end(); i++) {
4290 sum += (*i)->_libxml2_refcount;
4291 (*i)->find_leaked();
4293 ARCANE_ASSERT((_libxml2_refcount != sum), (
"Warning: object leaked "));
4297LIBXML2_Node* LIBXML2_NodeList::
4300 UInt32 saveIndex = index;
4301 if (mParent == NULL)
4303 for (std::list<LIBXML2_Node*>::iterator i = mParent->mNodeList.begin(); i != mParent->mNodeList.end();
4306 UInt16 type = (*i)->nodeType();
4307 if (type == LIBXML2_Node::ATTRIBUTE_NODE || type == LIBXML2_Node::DOCUMENT_TYPE_NODE)
4311 m_hintIndex = saveIndex;
4324 for (std::list<LIBXML2_Node*>::iterator i = mParent->mNodeList.begin(); i != mParent->mNodeList.end();
4326 UInt16 type = (*i)->nodeType();
4327 if (type == LIBXML2_Node::ATTRIBUTE_NODE || type == LIBXML2_Node::DOCUMENT_TYPE_NODE)
4334LIBXML2_Node* LIBXML2_NodeListDFSSearch::
4337 if (mParent == NULL)
4340 std::list<std::pair<std::list<LIBXML2_Node*>::iterator, std::list<LIBXML2_Node*>::iterator>> iteratorStack;
4341 iteratorStack.push_front(std::pair<std::list<LIBXML2_Node*>::iterator, std::list<LIBXML2_Node*>::iterator>(
4342 mParent->mNodeList.begin(), mParent->mNodeList.end()));
4343 while (!iteratorStack.empty()) {
4344 std::pair<std::list<LIBXML2_Node*>::iterator, std::list<LIBXML2_Node*>::iterator>& itp =
4345 iteratorStack.front();
4346 if (itp.first == itp.second) {
4347 iteratorStack.pop_front();
4350 std::list<LIBXML2_Node*>::iterator p = itp.first;
4353 if ((*p)->nodeType() == LIBXML2_Node::ELEMENT_NODE) {
4355 switch (mFilterType) {
4356 case LEVEL_1_NAME_FILTER:
4357 if ((*p)->mNodeName != mNameFilter && (*p)->mNodeName !=
"*")
4360 case LEVEL_2_NAME_FILTER:
4361 if ((*p)->mLocalName != mNameFilter && (mNameFilter !=
"*"))
4363 if ((*p)->mNamespaceURI != mNamespaceFilter && (mNamespaceFilter !=
"*"))
4376 iteratorStack.push_front(
4377 std::pair<std::list<LIBXML2_Node*>::iterator, std::list<LIBXML2_Node*>::iterator>(
4378 (*p)->mNodeList.begin(), (*p)->mNodeList.end()));
4383UInt32 LIBXML2_NodeListDFSSearch::
4386 if (mParent == NULL)
4390 std::list<std::pair<std::list<LIBXML2_Node*>::iterator, std::list<LIBXML2_Node*>::iterator>> iteratorStack;
4391 iteratorStack.push_front(std::pair<std::list<LIBXML2_Node*>::iterator, std::list<LIBXML2_Node*>::iterator>(
4392 mParent->mNodeList.begin(), mParent->mNodeList.end()));
4393 while (!iteratorStack.empty()) {
4394 std::pair<std::list<LIBXML2_Node*>::iterator, std::list<LIBXML2_Node*>::iterator>& itp =
4395 iteratorStack.front();
4396 if (itp.first == itp.second) {
4397 iteratorStack.pop_front();
4401 if ((*(itp.first))->nodeType() == LIBXML2_Node::ELEMENT_NODE) {
4403 switch (mFilterType) {
4404 case LEVEL_1_NAME_FILTER:
4405 if ((*(itp.first))->mNodeName != mNameFilter && (*(itp.first))->mNodeName !=
"*")
4408 case LEVEL_2_NAME_FILTER:
4409 if ((*(itp.first))->mLocalName != mNameFilter && (mNameFilter !=
"*"))
4411 if ((*(itp.first))->mNamespaceURI != mNamespaceFilter && (mNamespaceFilter !=
"*"))
4420 LIBXML2_Node* n = *(itp.first);
4422 iteratorStack.push_front(
4423 std::pair<std::list<LIBXML2_Node*>::iterator, std::list<LIBXML2_Node*>::iterator>(
4424 n->mNodeList.begin(), n->mNodeList.end()));
4429LIBXML2_NamedNodeMap::
4430 LIBXML2_NamedNodeMap(LIBXML2_Element* aElement)
4434 mElement->add_ref();
4437LIBXML2_NamedNodeMap::
4438 ~LIBXML2_NamedNodeMap()
4440 mElement->release_ref();
4443LIBXML2_Node* LIBXML2_NamedNodeMap::
4444 getNamedItem(
const String& name)
4446 std::map<LIBXML2_Element::LocalName, LIBXML2_Attr*>::iterator i =
4447 mElement->attributeMap.find(LIBXML2_Element::LocalName(name));
4448 if (i == mElement->attributeMap.end())
4450 (*i).second->add_ref();
4454LIBXML2_Node* LIBXML2_NamedNodeMap::
4455 setNamedItem(LIBXML2_Node* arg)
4457 LIBXML2_Attr* attr =
dynamic_cast<LIBXML2_Attr*
>(arg);
4458 return mElement->setAttributeNode(attr);
4461LIBXML2_Node* LIBXML2_NamedNodeMap::
4462 removeNamedItem(
const String& name)
4464 std::map<LIBXML2_Element::LocalName, LIBXML2_Attr*>::iterator i =
4465 mElement->attributeMap.find(LIBXML2_Element::LocalName(name));
4466 if (i == mElement->attributeMap.end())
4467 throw Arcane::Exception::exception();
4469 LIBXML2_Attr* at = (*i).second;
4470 mElement->removeChildPrivate(at)->release_ref();
4471 LIBXML2_Element::LocalName ln((*i).first);
4472 mElement->attributeMap.erase(i);
4473 std::map<LIBXML2_Element::QualifiedName, LIBXML2_Attr*>::iterator j =
4474 mElement->attributeMapNS.find(LIBXML2_Element::QualifiedName(at->mNamespaceURI, at->mLocalName));
4475 LIBXML2_Element::QualifiedName qn((*j).first);
4476 mElement->attributeMapNS.erase(j);
4480LIBXML2_Node* LIBXML2_NamedNodeMap::
4483 UInt32 saveIndex = index;
4484 for (std::map<LIBXML2_Element::QualifiedName, LIBXML2_Attr*>::iterator i = mElement->attributeMapNS.begin();
4485 i != mElement->attributeMapNS.end(); i++) {
4488 m_hintIndex = saveIndex;
4490 (*i).second->add_ref();
4498UInt32 LIBXML2_NamedNodeMap::
4501 return mElement->attributeMap.size();
4504LIBXML2_Node* LIBXML2_NamedNodeMap::
4505getNamedItemNS(
const String& namespaceURI,
const String& localName)
4507 std::map<LIBXML2_Element::QualifiedName, LIBXML2_Attr*>::iterator i =
4508 mElement->attributeMapNS.find(LIBXML2_Element::QualifiedName(namespaceURI, localName));
4509 if (i == mElement->attributeMapNS.end())
4511 (*i).second->add_ref();
4515LIBXML2_Node* LIBXML2_NamedNodeMap::
4516setNamedItemNS(LIBXML2_Node* arg)
4518 LIBXML2_Attr* attr =
dynamic_cast<LIBXML2_Attr*
>(arg);
4519 return mElement->setAttributeNodeNS(attr);
4522LIBXML2_Node* LIBXML2_NamedNodeMap::
4523removeNamedItemNS(
const String& namespaceURI,
const String& localName)
4525 std::map<LIBXML2_Element::QualifiedName, LIBXML2_Attr*>::iterator i =
4526 mElement->attributeMapNS.find(LIBXML2_Element::QualifiedName(namespaceURI, localName));
4527 if (i == mElement->attributeMapNS.end())
4528 throw Arcane::Exception::exception();
4530 LIBXML2_Attr* at = (*i).second;
4531 mElement->removeChildPrivate(at)->release_ref();
4532 std::map<LIBXML2_Element::LocalName, LIBXML2_Attr*>::iterator j =
4533 mElement->attributeMap.find(LIBXML2_Element::LocalName(at->mNodeName));
4534 mElement->attributeMapNS.erase(i);
4535 mElement->attributeMap.erase(j);
4539LIBXML2_NamedNodeMapDT::
4540LIBXML2_NamedNodeMapDT(LIBXML2_DocumentType* aDocType,
UInt16 aType)
4544 mDocType->add_ref();
4547LIBXML2_NamedNodeMapDT::
4548~LIBXML2_NamedNodeMapDT()
4550 mDocType->release_ref();
4553LIBXML2_Node* LIBXML2_NamedNodeMapDT::
4554getNamedItem(
const String& name)
4556 for (std::list<LIBXML2_Node*>::iterator i = mDocType->mNodeList.begin(); i != mDocType->mNodeList.end();
4558 if ((*i)->nodeType() != mType)
4560 if ((*i)->mNodeName != name)
4568LIBXML2_Node* LIBXML2_NamedNodeMapDT::
4569setNamedItem(LIBXML2_Node* arg)
4572 throw NotImplementedException(A_FUNCINFO);
4575LIBXML2_Node* LIBXML2_NamedNodeMapDT::
4576removeNamedItem(
const String& name)
4578 ARCANE_UNUSED(name);
4579 throw NotImplementedException(A_FUNCINFO);
4582LIBXML2_Node* LIBXML2_NamedNodeMapDT::
4585 for (std::list<LIBXML2_Node*>::iterator i = mDocType->mNodeList.begin(); i != mDocType->mNodeList.end();
4587 if ((*i)->nodeType() != mType)
4599UInt32 LIBXML2_NamedNodeMapDT::
4603 for (std::list<LIBXML2_Node*>::iterator i = mDocType->mNodeList.begin(); i != mDocType->mNodeList.end();
4605 if ((*i)->nodeType() != mType)
4612LIBXML2_Node* LIBXML2_NamedNodeMapDT::
4613getNamedItemNS(
const String& namespaceURI,
const String& localName)
4615 for (std::list<LIBXML2_Node*>::iterator i = mDocType->mNodeList.begin(); i != mDocType->mNodeList.end();
4617 if ((*i)->nodeType() != mType)
4619 if ((*i)->mNamespaceURI != namespaceURI)
4621 if ((*i)->mLocalName != localName)
4629LIBXML2_Node* LIBXML2_NamedNodeMapDT::
4630setNamedItemNS(LIBXML2_Node* arg)
4633 throw NotImplementedException(A_FUNCINFO);
4636LIBXML2_Node* LIBXML2_NamedNodeMapDT::
4637removeNamedItemNS(
const String& namespaceURI,
const String& localName)
4639 ARCANE_UNUSED(namespaceURI);
4640 ARCANE_UNUSED(localName);
4641 throw NotImplementedException(A_FUNCINFO);
4644String LIBXML2_CharacterData::
4650void LIBXML2_CharacterData::
4651Data(
const String& attr)
4656void LIBXML2_CharacterData::
4657nodeValue(
const String& attr)
4662UInt32 LIBXML2_CharacterData::
4665 return mNodeValue.
len();
4668String LIBXML2_CharacterData::
4669substringdata(UInt32 offset, UInt32 count)
4672 return mNodeValue.
substring(offset, count);
4674 catch (
const Arcane::dom::DOMException& ex) {
4675 cerr <<
"** EXCEPTION " << ex.code <<
'\n';
4680void LIBXML2_CharacterData::
4681appenddata(
const String& arg)
4683 mNodeValue = mNodeValue + arg;
4686void LIBXML2_CharacterData::
4687insertdata(UInt32 offset,
const String& arg)
4690 String t = mNodeValue.
substring(offset);
4691 mNodeValue = mNodeValue.
substring(0, offset);
4692 mNodeValue = mNodeValue + arg;
4693 mNodeValue = mNodeValue + t;
4695 catch (
const Arcane::dom::DOMException& ex) {
4696 cerr <<
"** EXCEPTION " << ex.code <<
'\n';
4701void LIBXML2_CharacterData::
4702deletedata(UInt32 offset, UInt32 count)
4705 String t = mNodeValue.
substring(offset + count);
4706 mNodeValue = mNodeValue.
substring(0, offset);
4707 mNodeValue = mNodeValue + t;
4709 catch (
const Arcane::dom::DOMException& ex) {
4710 cerr <<
"** EXCEPTION " << ex.code <<
'\n';
4715void LIBXML2_CharacterData::
4716replacedata(UInt32 offset, UInt32 count,
const String& arg)
4719 String t = mNodeValue.
substring(offset + count);
4720 mNodeValue = mNodeValue.
substring(0, offset);
4721 mNodeValue = mNodeValue + arg;
4722 mNodeValue = mNodeValue + t;
4724 catch (
const Arcane::dom::DOMException& ex) {
4725 cerr <<
"** EXCEPTION " << ex.code <<
'\n';
4730LIBXML2_Node* LIBXML2_Attr::
4731shallowCloneNode(LIBXML2_Document* aDoc)
4733 LIBXML2_Attr* attr =
new LIBXML2_Attr(aDoc);
4734 attr->mLocalName = mLocalName;
4735 attr->mNamespaceURI = mNamespaceURI;
4736 attr->mNodeName = mNodeName;
4737 attr->mNodeValue = mNodeValue;
4738 attr->mSpecified = mSpecified;
4742String LIBXML2_Attr::
4754String LIBXML2_Attr::
4761value(
const String& attr)
4767LIBXML2_Element* LIBXML2_Attr::
4770 LIBXML2_Element* el =
dynamic_cast<LIBXML2_Element*
>(mParent);
4777~LIBXML2_Element() {}
4779LIBXML2_Node* LIBXML2_Element::
4780shallowCloneNode(LIBXML2_Document* aDoc)
4782 LIBXML2_Element* el = LIBXML2_NewElement(aDoc, mNamespaceURI, mLocalName);
4783 el->mLocalName = mLocalName;
4784 el->mNamespaceURI = mNamespaceURI;
4785 el->mNodeName = mNodeName;
4786 el->mNodeValue = mNodeValue;
4788 for (std::map<QualifiedName, LIBXML2_Attr*>::iterator i = attributeMapNS.begin(); i != attributeMapNS.end();
4790 LIBXML2_Attr* at =
dynamic_cast<LIBXML2_Attr*
>((*i).second->shallowCloneNode(aDoc));
4791 LIBXML2_Attr* atTmp = el->setAttributeNodeNS(at);
4792 ARCANE_ASSERT(atTmp == NULL,
4793 (
"InternalError in LIBXML2_Element::shallowCloneNode(). The attribute is Null !"));
4798LIBXML2_NamedNodeMap* LIBXML2_Element::
4801 return new LIBXML2_NamedNodeMap(
this);
4804bool LIBXML2_Element::
4807 return !attributeMap.empty();
4810String LIBXML2_Element::
4816String LIBXML2_Element::
4817getAttribute(
const String& name)
4819 std::map<LocalName, LIBXML2_Attr*>::iterator i = attributeMap.find(LocalName(name));
4820 if (i == attributeMap.end())
4822 return (*i).second->value();
4825void LIBXML2_Element::
4826setAttribute(
const String& name,
const String& value)
4828 std::map<LocalName, LIBXML2_Attr*>::iterator i = attributeMap.find(LocalName(name));
4829 if (i == attributeMap.end()) {
4830 LIBXML2_Attr* a =
new LIBXML2_Attr(mDocument);
4832 throw Arcane::Exception::exception();
4833 a->mNodeValue = value;
4834 a->mNodeName = name;
4835 insertBeforePrivate(a, NULL)->release_ref();
4836 attributeMapNS.insert(std::pair<QualifiedName, LIBXML2_Attr*>(QualifiedName(String(), name), a));
4837 attributeMap.insert(std::pair<LocalName, LIBXML2_Attr*>(LocalName(name), a));
4840 String oldvalue = (*i).second->mNodeValue;
4841 (*i).second->mNodeValue = value;
4844void LIBXML2_Element::
4845removeAttribute(
const String& name)
4847 std::map<LocalName, LIBXML2_Attr*>::iterator i = attributeMap.find(LocalName(name));
4848 if (i == attributeMap.end()) {
4853 LIBXML2_Attr* at = (*i).second;
4854 removeChildPrivate(at)->release_ref();
4855 attributeMap.erase(i);
4856 std::map<QualifiedName, LIBXML2_Attr*>::iterator j;
4857 if (at->mLocalName != String())
4858 j = attributeMapNS.find(QualifiedName(at->mNamespaceURI, at->mLocalName));
4860 j = attributeMapNS.find(QualifiedName(at->mNamespaceURI, at->mNodeName));
4861 attributeMapNS.erase(j);
4864LIBXML2_Attr* LIBXML2_Element::
4865getAttributeNode(
const String& name)
4867 std::map<LocalName, LIBXML2_Attr*>::iterator i = attributeMap.find(LocalName(name));
4868 if (i == attributeMap.end())
4870 (*i).second->add_ref();
4874LIBXML2_Attr* LIBXML2_Element::
4875setAttributeNode(LIBXML2_Attr* newAttr)
4877 if (newAttr == NULL)
4878 throw Arcane::Exception::exception();
4879 String name = newAttr->name();
4880 std::map<LocalName, LIBXML2_Attr*>::iterator i = attributeMap.find(LocalName(name));
4881 std::map<QualifiedName, LIBXML2_Attr*>::iterator j = attributeMapNS.find(QualifiedName(String(), name));
4882 if (i == attributeMap.end()) {
4883 insertBeforePrivate(newAttr, NULL)->release_ref();
4884 attributeMap.insert(std::pair<LocalName, LIBXML2_Attr*>(name, newAttr));
4885 attributeMapNS.insert(std::pair<QualifiedName, LIBXML2_Attr*>(QualifiedName(String(), name), newAttr));
4888 LIBXML2_Attr* at = (*i).second;
4889 removeChildPrivate(at)->release_ref();
4890 attributeMap.erase(i);
4891 if (j != attributeMapNS.end()) {
4892 attributeMapNS.erase(j);
4894 insertBeforePrivate(newAttr, NULL)->release_ref();
4895 attributeMap.insert(std::pair<LocalName, LIBXML2_Attr*>(LocalName(name), newAttr));
4896 attributeMapNS.insert(std::pair<QualifiedName, LIBXML2_Attr*>(QualifiedName(String(), name), newAttr));
4900LIBXML2_Attr* LIBXML2_Element::
4901removeAttributeNode(LIBXML2_Attr* oldAttr)
4903 if (oldAttr == NULL)
4904 throw Arcane::Exception::exception();
4905 String name = oldAttr->name();
4906 String lname = oldAttr->localName();
4907 String nsuri = oldAttr->namespaceURI();
4908 std::map<LocalName, LIBXML2_Attr*>::iterator i = attributeMap.find(LocalName(name));
4909 if (i == attributeMap.end()) {
4910 throw Arcane::Exception::exception();
4912 LIBXML2_Attr* at = (*i).second;
4913 LocalName ln((*i).first);
4914 removeChildPrivate(at)->release_ref();
4915 attributeMap.erase(i);
4917 std::map<QualifiedName, LIBXML2_Attr*>::iterator j = attributeMapNS.find(QualifiedName(nsuri, lname));
4918 QualifiedName qn((*j).first);
4919 attributeMapNS.erase(j);
4923LIBXML2_NodeList* LIBXML2_Element::
4924getElementsByTagName(
const String& name)
4926 return new LIBXML2_NodeListDFSSearch(
this, name);
4929String LIBXML2_Element::
4930getAttributeNS(
const String& namespaceURI,
const String& localName)
4932 std::map<QualifiedName, LIBXML2_Attr*>::iterator i =
4933 attributeMapNS.find(QualifiedName(namespaceURI, localName));
4934 if (i == attributeMapNS.end())
4936 return (*i).second->value();
4939void LIBXML2_Element::
4940setAttributeNS(
const String& namespaceURI,
const String& qualifiedName,
const String& value)
4942 const XMLCh* cqname =
reinterpret_cast<const XMLCh*
>(qualifiedName.utf16().begin());
4943 const XMLCh* cpos = wcschr(cqname, L
':');
4949 String localName = String::fromUtf8(utf8_array);
4950 std::map<QualifiedName, LIBXML2_Attr*>::iterator i =
4951 attributeMapNS.find(QualifiedName(namespaceURI, localName));
4952 if (i == attributeMapNS.end()) {
4953 LIBXML2_Attr* a =
new LIBXML2_Attr(mDocument);
4955 throw Arcane::Exception::exception();
4957 a->mNodeName = qualifiedName;
4958 a->mLocalName = localName;
4959 a->mNamespaceURI = namespaceURI;
4960 insertBeforePrivate(a, NULL)->release_ref();
4961 attributeMapNS.insert(std::pair<QualifiedName, LIBXML2_Attr*>(QualifiedName(namespaceURI, localName), a));
4962 std::map<LocalName, LIBXML2_Attr*>::iterator j = attributeMap.find(LocalName(qualifiedName));
4963 if (j != attributeMap.end()) {
4964 attributeMap.erase(j);
4966 attributeMap.insert(std::pair<LocalName, LIBXML2_Attr*>(LocalName(qualifiedName), a));
4969 String oldValue = (*i).second->mNodeValue;
4970 (*i).second->mNodeValue = value;
4973void LIBXML2_Element::
4974removeAttributeNS(
const String& namespaceURI,
const String& localName)
4976 std::map<QualifiedName, LIBXML2_Attr*>::iterator i =
4977 attributeMapNS.find(QualifiedName(namespaceURI, localName));
4978 if (i == attributeMapNS.end()) {
4983 LIBXML2_Attr* at = (*i).second;
4984 removeChildPrivate(at)->release_ref();
4985 QualifiedName qn((*i).first);
4986 std::map<LocalName, LIBXML2_Attr*>::iterator j = attributeMap.find(LocalName((*i).second->mNodeName));
4987 attributeMapNS.erase(i);
4988 LocalName ln((*j).first);
4989 attributeMap.erase(j);
4992LIBXML2_Attr* LIBXML2_Element::
4993getAttributeNodeNS(
const String& namespaceURI,
const String& localName)
4995 std::map<QualifiedName, LIBXML2_Attr*>::iterator i =
4996 attributeMapNS.find(QualifiedName(namespaceURI, localName));
4997 if (i == attributeMapNS.end())
4999 (*i).second->add_ref();
5003LIBXML2_Attr* LIBXML2_Element::
5004setAttributeNodeNS(LIBXML2_Attr* newAttr)
5006 if (newAttr == NULL)
5007 throw Arcane::Exception::exception();
5008 if (newAttr->mLocalName == String())
5009 newAttr->mLocalName = newAttr->mNodeName;
5010 std::pair<String, String> p(newAttr->mNamespaceURI, newAttr->mLocalName);
5011 std::map<QualifiedName, LIBXML2_Attr*>::iterator i =
5012 attributeMapNS.find(QualifiedName(newAttr->mNamespaceURI, newAttr->mLocalName));
5013 if (i == attributeMapNS.end()) {
5014 insertBeforePrivate(newAttr, NULL)->release_ref();
5015 attributeMapNS.insert(std::pair<QualifiedName, LIBXML2_Attr*>(
5016 QualifiedName(newAttr->mNamespaceURI, newAttr->mLocalName), newAttr));
5017 attributeMap.insert(std::pair<LocalName, LIBXML2_Attr*>(LocalName(newAttr->mNodeName), newAttr));
5020 LIBXML2_Attr* at = (*i).second;
5021 QualifiedName qn((*i).first);
5022 removeChildPrivate(at)->release_ref();
5023 attributeMapNS.erase(i);
5024 std::map<LocalName, LIBXML2_Attr*>::iterator j = attributeMap.find(LocalName(at->mNodeName));
5025 LocalName ln((*j).first);
5026 attributeMap.erase(j);
5027 insertBeforePrivate(newAttr, NULL)->release_ref();
5028 attributeMapNS.insert(std::pair<QualifiedName, LIBXML2_Attr*>(
5029 QualifiedName(newAttr->mNamespaceURI, newAttr->mLocalName), newAttr));
5030 attributeMap.insert(std::pair<LocalName, LIBXML2_Attr*>(LocalName(at->mNodeName), newAttr));
5034LIBXML2_NodeList* LIBXML2_Element::
5035getElementsByTagNameNS(
const String& namespaceURI,
const String& localName)
5037 return new LIBXML2_NodeListDFSSearch(
this, namespaceURI, localName);
5040bool LIBXML2_Element::
5041hasAttribute(
const String& name)
5043 return attributeMap.find(LocalName(name)) != attributeMap.end();
5046bool LIBXML2_Element::
5047hasAttributeNS(
const String& namespaceURI,
const String& localName)
5049 return attributeMapNS.find(QualifiedName(namespaceURI, localName)) != attributeMapNS.end();
5052LIBXML2_Element* LIBXML2_Element::
5053searchForElementById(
const String& elementId)
5058 String ourId = getAttribute(
"id");
5059 if (ourId == String()) {
5060 String tmp = getAttribute(
"xml:id");
5061 if (tmp != String())
5064 if (ourId == elementId) {
5068 for (std::list<LIBXML2_Node*>::iterator i = mNodeList.begin(); i != mNodeList.end(); i++) {
5069 LIBXML2_Element* e = (*i)->searchForElementById(elementId);
5076LIBXML2_Text* LIBXML2_TextBase::
5077splitText(UInt32 offset)
5079 if (mParent == NULL)
5080 throw Arcane::Exception::exception();
5081 LIBXML2_TextBase* tb =
static_cast<LIBXML2_TextBase*
>(shallowCloneNode(mDocument));
5082 tb->mNodeValue = mNodeValue.
substring(offset);
5083 mNodeValue = mNodeValue.
substring(0, offset);
5084 LIBXML2_Node* n2 = nextSibling();
5085 mParent->insertBefore(tb, n2)->release_ref();
5087 return reinterpret_cast<LIBXML2_Text*
>(tb);
5090LIBXML2_Text* LIBXML2_CDATASection::
5091splitText(UInt32 offset)
5093 if (mParent == NULL)
5094 throw Arcane::Exception::exception();
5095 LIBXML2_TextBase* tb =
static_cast<LIBXML2_TextBase*
>(shallowCloneNode(mDocument));
5096 tb->mNodeValue = mNodeValue.
substring(offset);
5097 mNodeValue = mNodeValue.
substring(0, offset);
5098 LIBXML2_Node* n2 = nextSibling();
5099 mParent->insertBefore(tb, n2)->release_ref();
5101 return reinterpret_cast<LIBXML2_Text*
>(tb);
5104LIBXML2_Node* LIBXML2_Text::
5105shallowCloneNode(LIBXML2_Document* aDoc)
5107 LIBXML2_Text* txt =
new LIBXML2_Text(aDoc);
5109 throw Arcane::Exception::exception();
5110 txt->mLocalName = mLocalName;
5111 txt->mNamespaceURI = mNamespaceURI;
5112 txt->mNodeName = mNodeName;
5113 txt->mNodeValue = mNodeValue;
5117LIBXML2_Node* LIBXML2_Comment::
5118shallowCloneNode(LIBXML2_Document* aDoc)
5120 LIBXML2_Comment* com =
new LIBXML2_Comment(aDoc);
5122 throw Arcane::Exception::exception();
5123 com->mLocalName = mLocalName;
5124 com->mNamespaceURI = mNamespaceURI;
5125 com->mNodeName = mNodeName;
5126 com->mNodeValue = mNodeValue;
5130LIBXML2_Node* LIBXML2_CDATASection::
5131shallowCloneNode(LIBXML2_Document* aDoc)
5133 LIBXML2_CDATASection* cds =
new LIBXML2_CDATASection(aDoc);
5135 throw Arcane::Exception::exception();
5136 cds->mLocalName = mLocalName;
5137 cds->mNamespaceURI = mNamespaceURI;
5138 cds->mNodeName = mNodeName;
5139 cds->mNodeValue = mNodeValue;
5143LIBXML2_Node* LIBXML2_DocumentType::
5144shallowCloneNode(LIBXML2_Document* aDoc)
5146 LIBXML2_DocumentType* doctype =
new LIBXML2_DocumentType(aDoc, mNodeName, mPublicId, mSystemId);
5147 if (doctype == NULL)
5148 throw Arcane::Exception::exception();
5149 doctype->mLocalName = mLocalName;
5150 doctype->mNamespaceURI = mNamespaceURI;
5151 doctype->mNodeValue = mNodeValue;
5155String LIBXML2_DocumentType::
5161LIBXML2_NamedNodeMap* LIBXML2_DocumentType::
5164 return new LIBXML2_NamedNodeMapDT(
this, LIBXML2_Node::ENTITY_NODE);
5167LIBXML2_NamedNodeMap* LIBXML2_DocumentType::
5170 return new LIBXML2_NamedNodeMapDT(
this, LIBXML2_Node::NOTATION_NODE);
5173String LIBXML2_DocumentType::
5179String LIBXML2_DocumentType::
5185String LIBXML2_DocumentType::
5193LIBXML2_Node* LIBXML2_Notation::
5194shallowCloneNode(LIBXML2_Document* aDoc)
5196 LIBXML2_Notation* nota =
new LIBXML2_Notation(aDoc, mPublicId, mSystemId);
5198 throw Arcane::Exception::exception();
5199 nota->mLocalName = mLocalName;
5200 nota->mNamespaceURI = mNamespaceURI;
5201 nota->mNodeName = mNodeName;
5202 nota->mNodeValue = mNodeValue;
5206String LIBXML2_Notation::
5212String LIBXML2_Notation::
5220shallowCloneNode(LIBXML2_Document* aDoc)
5222 LIBXML2_Entity* ent =
new LIBXML2_Entity(aDoc, mPublicId, mSystemId, mNotationName);
5224 throw Arcane::Exception::exception();
5225 ent->mLocalName = mLocalName;
5226 ent->mNamespaceURI = mNamespaceURI;
5227 ent->mNodeName = mNodeName;
5228 ent->mNodeValue = mNodeValue;
5232String LIBXML2_Entity::
5238String LIBXML2_Entity::
5244String LIBXML2_Entity::
5247 return mNotationName;
5250LIBXML2_Node* LIBXML2_EntityReference::
5251shallowCloneNode(LIBXML2_Document* aDoc)
5253 LIBXML2_EntityReference* er =
new LIBXML2_EntityReference(aDoc);
5255 throw Arcane::Exception::exception();
5256 er->mLocalName = mLocalName;
5257 er->mNamespaceURI = mNamespaceURI;
5258 er->mNodeName = mNodeName;
5259 er->mNodeValue = mNodeValue;
5263LIBXML2_Node* LIBXML2_ProcessingInstruction::
5264shallowCloneNode(LIBXML2_Document* aDoc)
5266 LIBXML2_ProcessingInstruction* pi =
new LIBXML2_ProcessingInstruction(aDoc, mNodeName, mNodeValue);
5268 throw Arcane::Exception::exception();
5269 pi->mLocalName = mLocalName;
5270 pi->mNamespaceURI = mNamespaceURI;
5274String LIBXML2_ProcessingInstruction::
5280String LIBXML2_ProcessingInstruction::
5286void LIBXML2_ProcessingInstruction::
5287Data(
const String& attr)
5292LIBXML2_Node* LIBXML2_DocumentFragment::
5293shallowCloneNode(LIBXML2_Document* aDoc)
5295 LIBXML2_DocumentFragment* docfrag =
new LIBXML2_DocumentFragment(aDoc);
5296 if (docfrag == NULL)
5297 throw Arcane::Exception::exception();
5298 docfrag->mLocalName = mLocalName;
5299 docfrag->mNamespaceURI = mNamespaceURI;
5300 docfrag->mNodeName = mNodeName;
5301 docfrag->mNodeValue = mNodeValue;
5306LIBXML2_Document(
const String& namespaceURI,
const String& qualifiedName,
5307 LIBXML2_DocumentType* doctype)
5310 const XMLCh* cqname =
reinterpret_cast<const XMLCh*
>(qualifiedName.utf16().begin());
5311 const XMLCh* cpos = wcschr(cqname, L
':');
5317 String localName = String::fromUtf8(utf8_array);
5320 mDocumentIsAncestor =
true;
5321 mDocument->release_ref();
5322 if (doctype && doctype->mDocument != NULL)
5323 throw Arcane::Exception::exception();
5325 doctype->mDocument =
this;
5326 doctype->mDocumentIsAncestor =
false;
5327 doctype->mDocument->add_ref();
5329 if (doctype != NULL)
5330 insertBeforePrivate(doctype, NULL)->release_ref();
5331 LIBXML2_Element* docel = LIBXML2_NewElement(
this, namespaceURI, localName);
5333 throw Arcane::Exception::exception();
5334 docel->mNamespaceURI = namespaceURI;
5335 docel->mNodeName = qualifiedName;
5336 docel->mLocalName = localName;
5337 appendChild(docel)->release_ref();
5340LIBXML2_Text* LIBXML2_Document::
5343 for (std::list<LIBXML2_Node*>::iterator i = mNodeList.begin(); i != mNodeList.end(); i++)
5344 if ((*i)->nodeType() == LIBXML2_Node::DOCUMENT_TYPE_NODE) {
5345 LIBXML2_DocumentType* dt =
static_cast<LIBXML2_DocumentType*
>(*i);
5347 return dynamic_cast<LIBXML2_Text*
>(dt);
5352LIBXML2_DOMImplementation* LIBXML2_Document::
5355 LIBXML2_DOMImplementation::sDOMImplementation->add_ref();
5356 return LIBXML2_DOMImplementation::sDOMImplementation;
5359LIBXML2_Element* LIBXML2_Document::
5362 for (std::list<LIBXML2_Node*>::iterator i = mNodeList.begin(); i != mNodeList.end(); i++)
5363 if ((*i)->nodeType() == LIBXML2_Node::ELEMENT_NODE) {
5364 LIBXML2_Element* el =
static_cast<LIBXML2_Element*
>(*i);
5371LIBXML2_Element* LIBXML2_Document::
5372createElement(
const String& tagName)
5374 LIBXML2_Element* el = LIBXML2_NewElement(
this, String(), tagName);
5376 throw Arcane::Exception::exception();
5377 el->mNodeName = tagName;
5381LIBXML2_DocumentFragment* LIBXML2_Document::
5382createDocumentFragment()
5384 LIBXML2_DocumentFragment* df =
new LIBXML2_DocumentFragment(
this);
5386 throw Arcane::Exception::exception();
5390LIBXML2_Text* LIBXML2_Document::
5391createTextNode(
const String& data)
5393 LIBXML2_Text* tn =
new LIBXML2_Text(
this);
5395 throw Arcane::Exception::exception();
5396 tn->mNodeValue = data;
5400LIBXML2_Comment* LIBXML2_Document::
5401createComment(
const String& data)
5403 LIBXML2_Comment* com =
new LIBXML2_Comment(
this);
5405 throw Arcane::Exception::exception();
5406 com->mNodeValue = data;
5410LIBXML2_CDATASection* LIBXML2_Document::
5411createCDATASection(
const String& data)
5413 LIBXML2_CDATASection* cds =
new LIBXML2_CDATASection(
this);
5415 throw Arcane::Exception::exception();
5416 cds->mNodeValue = data;
5420LIBXML2_ProcessingInstruction* LIBXML2_Document::
5421createProcessingInstruction(
const String& target,
const String& data)
5423 return new LIBXML2_ProcessingInstruction(
this, target, data);
5426LIBXML2_Attr* LIBXML2_Document::
5427createAttribute(
const String& name)
5429 LIBXML2_Attr* at =
new LIBXML2_Attr(
this);
5431 throw Arcane::Exception::exception();
5432 at->mNodeName = name;
5436LIBXML2_EntityReference* LIBXML2_Document::
5437createEntityReference(
const String& name)
5439 LIBXML2_EntityReference* er =
new LIBXML2_EntityReference(
this);
5441 throw Arcane::Exception::exception();
5442 er->mNodeName = name;
5446LIBXML2_NodeList* LIBXML2_Document::
5447getElementsByTagName(
const String& tagname)
5449 LIBXML2_NodeList* nl =
new LIBXML2_NodeListDFSSearch(
this, tagname);
5451 throw Arcane::Exception::exception();
5455LIBXML2_Node* LIBXML2_Document::
5456importNode(LIBXML2_Node* importedNode,
bool deep)
5462 LIBXML2_Node* n = importedNode->cloneNode(deep);
5464 if (n->nodeType() == LIBXML2_Node::DOCUMENT_NODE)
5465 throw Arcane::Exception::exception();
5466 n->recursivelyChangeDocument(
this);
5471LIBXML2_Element* LIBXML2_Document::
5472createElementNS(
const String& namespaceURI,
const String& qualifiedName)
5474 const XMLCh* cqname =
reinterpret_cast<const XMLCh*
>(qualifiedName.utf16().begin());
5475 const XMLCh* cpos = wcschr(cqname, L
':');
5481 String localName = String::fromUtf8(utf8_array);
5482 LIBXML2_Element* el = LIBXML2_NewElement(
this, namespaceURI, localName);
5483 el->mNamespaceURI = namespaceURI;
5484 el->mNodeName = qualifiedName;
5485 el->mLocalName = localName;
5489LIBXML2_Attr* LIBXML2_Document::
5490createAttributeNS(
const String& namespaceURI,
const String& qualifiedName)
5492 LIBXML2_Attr* at =
new LIBXML2_Attr(mDocument);
5494 throw Arcane::Exception::exception();
5495 at->mNamespaceURI = namespaceURI;
5496 at->mNodeName = qualifiedName;
5497 const XMLCh* cqname =
reinterpret_cast<const XMLCh*
>(qualifiedName.utf16().begin());
5498 const XMLCh* cpos = wcschr(cqname, L
':');
5504 String localName = String::fromUtf8(utf8_array);
5505 at->mLocalName = localName;
5509LIBXML2_NodeList* LIBXML2_Document::
5510getElementsByTagNameNS(
const String& namespaceURI,
const String& localName)
5512 LIBXML2_NodeListDFSSearch* nlDFSS =
new LIBXML2_NodeListDFSSearch(
this, namespaceURI, localName);
5514 throw Arcane::Exception::exception();
5518LIBXML2_Element* LIBXML2_Document::
5519getElementById(
const String& elementId)
5521 return searchForElementById(elementId);
5524LIBXML2_Node* LIBXML2_Document::
5525shallowCloneNode(LIBXML2_Document* aDoc)
5528 LIBXML2_Document* Doc =
new LIBXML2_Document();
5530 throw Arcane::Exception::exception();
5531 Doc->mLocalName = mLocalName;
5532 Doc->mNodeValue = mNodeValue;
5536LIBXML2_Element* LIBXML2_Document::
5537searchForElementById(
const String& elementId)
5539 for (std::list<LIBXML2_Node*>::iterator i = mNodeList.begin(); i != mNodeList.end(); i++) {
5540 LIBXML2_Element* el = (*i)->searchForElementById(elementId);
5548static const XMLCh* kEntities[] = {
5549 U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""),
5550 U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""),
5551 U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
"&"),
5552 U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""),
5553 U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
"<"), U(
""), U(
">")
5555static const XMLCh* kAttrEntities[] = {
5556 U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""),
5557 U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""),
5558 U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
"""), U(
""), U(
""), U(
""), U(
"&"),
5559 U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""),
5560 U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
""), U(
"<"), U(
""), U(
">")
5564TranslateEntities(
const String& data,
bool isAttribute =
false)
5566 const XMLCh* Data =
reinterpret_cast<const XMLCh*
>(data.utf16().begin());
5567 const XMLCh** table;
5570 table = kAttrEntities;
5574 UInt32 i, l = data.len();
5576 for (i = 0; i < l; i++) {
5578 if (c > 62 || (table[c][0] == 0)) {
5584 const XMLCh* p = o.c_str();
5586 char* tp =
new char[l + 1];
5587 size_t w = wcstombs(tp, p, l);
5593 std::string ret(tp);
5599void LIBXML2_DOMWriter::
5600writeNode(LIBXML2_DOMNamespaceContext* dnc, LIBXML2_Node* n, StringBuilder& appendTo)
5602 UInt16 nt = n->nodeType();
5604#define NODETYPE_CODE(nt, ntn) \
5605 case LIBXML2_Node::nt##_NODE: { \
5606 LIBXML2_##ntn* t = dynamic_cast<LIBXML2_##ntn*>(n); \
5608 throw Arcane::Exception::exception(); \
5610 write##ntn(dnc, t, appendTo); \
5614 NODETYPE_CODE(ELEMENT, Element)
5615 NODETYPE_CODE(ATTRIBUTE, Attr)
5616 NODETYPE_CODE(TEXT, Text)
5617 NODETYPE_CODE(CDATA_SECTION, CDATASection)
5618 NODETYPE_CODE(ENTITY_REFERENCE, EntityReference)
5619 NODETYPE_CODE(ENTITY, Entity)
5620 NODETYPE_CODE(PROCESSING_INSTRUCTION, ProcessingInstruction)
5621 NODETYPE_CODE(COMMENT, Comment)
5622 NODETYPE_CODE(DOCUMENT, Document)
5623 NODETYPE_CODE(DOCUMENT_TYPE, DocumentType)
5624 NODETYPE_CODE(DOCUMENT_FRAGMENT, DocumentFragment)
5625 NODETYPE_CODE(NOTATION, Notation)
5629void LIBXML2_DOMWriter::
5630DoIndentation(
bool StartEnd, StringBuilder& appendTo)
5634 bool check = (DeepNode >= 1);
5635 if ((indent) && check) {
5636 if (!appendTo.toString().endsWith(
"\n")){
5643 for (
int i = 0; i + limite < DeepNode; i++)
5655 UInt32 l = elnl->length(), i;
5658 String elpr = el->prefix();
5659 String elns = el->namespaceURI();
5662 String existns = elementContext.findNamespaceForPrefix(elpr);
5663 if (existns ==
String()) {
5665 elementContext.recordPrefix(elpr, elns);
5666 }
else if (existns != elns) {
5668 if (elementContext.getDefaultNamespace() == elns)
5671 elpr = elementContext.findPrefixForNamespace(elns);
5674 elementContext.setDefaultNamespace(elns);
5682 if (elementContext.getDefaultNamespace() != elns) {
5685 elpr = elementContext.findPrefixForNamespace(elns);
5688 elementContext.setDefaultNamespace(elns);
5696 DoIndentation(
true, appendTo);
5703 String ln = el->localName();
5705 ln = el->nodeName();
5708 for (i = 0; i < l; i++) {
5714 String nsURI = at->namespaceURI();
5715 String ln = at->localName();
5717 ln = at->nodeName();
5718 if (nsURI ==
"http://www.w3.org/2000/xmlns/" ||
5720 (nsURI ==
String() && ln ==
"xmlns")) {
5721 String value = at->value();
5723 elementContext.setDefaultNamespace(value);
5725 elementContext.recordPrefix(ln, value);
5728 for (i = 0; i < l; i++) {
5734 String nsURI = at->namespaceURI();
5735 ln = at->localName();
5737 ln = at->nodeName();
5738 if (nsURI ==
"http://www.w3.org/2000/xmlns/")
5741 if (nsURI ==
String() && ln ==
"xmlns")
5744 String atpr = at->prefix();
5745 String atns = at->namespaceURI();
5750 String existpr = elementContext.findNamespaceForPrefix(atpr);
5751 if (existpr ==
String()) {
5753 elementContext.recordPrefix(atpr, atns);
5754 }
else if (existpr != atns) {
5757 atpr = elementContext.findPrefixForNamespace(atns);
5759 elementContext.possiblyInventPrefix(atns);
5765 atpr = elementContext.findPrefixForNamespace(atns);
5767 elementContext.possiblyInventPrefix(atns);
5770 elementContext.resolveOrInventPrefixes();
5771 elementContext.writeXMLNS(appendTo);
5773 for (i = 0; i < l; i++) {
5779 String nsURI = at->namespaceURI();
5780 String ln = at->localName();
5782 ln = at->nodeName();
5783 if (nsURI ==
"http://www.w3.org/2000/xmlns/")
5786 if (nsURI ==
String() && ln ==
"xmlns")
5789 writeAttr(&elementContext, at, appendTo);
5792 l = elcnl->length();
5800 for (i = 0; i < l; i++) {
5809 writeNode(&elementContext, n, appendTo);
5812 appendTo +=
"</" + qname +
">";
5814 DoIndentation(
false, appendTo);
5817void LIBXML2_DOMWriter::
5823 String atpr = at->prefix();
5824 String atns = at->namespaceURI();
5828 else if (atpr !=
String()) {
5829 String existpr = dnc->findNamespaceForPrefix(atpr);
5830 if (existpr != atns) {
5831 atpr = dnc->findPrefixForNamespace(atpr);
5835 atpr = dnc->findPrefixForNamespace(atns);
5836 if (atpr != String()) {
5840 String ln = at->localName();
5842 ln = at->nodeName();
5845 appendTo += TranslateEntities(at->value(),
true);
5849void LIBXML2_DOMWriter::
5850writeText(LIBXML2_DOMNamespaceContext* dnc, LIBXML2_Text* txt, StringBuilder& appendTo)
5853 appendTo += TranslateEntities(txt->Data());
5856void LIBXML2_DOMWriter::
5857writeCDATASection(LIBXML2_DOMNamespaceContext* dnc, LIBXML2_CDATASection* cds,
5858 StringBuilder& appendTo)
5861 appendTo +=
"<![CDATA[";
5862 appendTo += cds->Data();
5867void LIBXML2_DOMWriter::
5868writeEntity(LIBXML2_DOMNamespaceContext* dnc, LIBXML2_Entity* er, StringBuilder& appendTo)
5872 ARCANE_UNUSED(appendTo);
5873 throw NotImplementedException(A_FUNCINFO);
5876void LIBXML2_DOMWriter::
5877writeEntityReference(LIBXML2_DOMNamespaceContext* dnc, LIBXML2_EntityReference* er,
5878 StringBuilder& appendTo)
5882 ARCANE_UNUSED(appendTo);
5883 throw NotImplementedException(A_FUNCINFO);
5886void LIBXML2_DOMWriter::
5887writeProcessingInstruction(LIBXML2_DOMNamespaceContext* dnc,
5888 LIBXML2_ProcessingInstruction* proci, StringBuilder& appendTo)
5891 appendTo += proci->target();
5892 String data = proci->Data();
5894 appendTo +=
" " + data;
5900void LIBXML2_DOMWriter::
5901writeComment(LIBXML2_DOMNamespaceContext* dnc, LIBXML2_Comment* comment,
5902 StringBuilder& appendTo)
5905 appendTo += comment->Data();
5910void LIBXML2_DOMWriter::
5911writeDocument(LIBXML2_DOMNamespaceContext* dnc, LIBXML2_Document* doc,
5912 StringBuilder& appendTo)
5915 appendTo =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n";
5918 LIBXML2_NodeList* elnl = doc->childNodes();
5919 UInt32 l = elnl->length(), i;
5920 for (i = 0; i < l; i++) {
5921 LIBXML2_Node* n = elnl->item(i);
5924 writeNode(dnc, n, appendTo);
5928void LIBXML2_DOMWriter::
5929writeDocumentType(LIBXML2_DOMNamespaceContext* dnc, LIBXML2_DocumentType* dt,
5930 StringBuilder& appendTo)
5934 ARCANE_UNUSED(appendTo);
5935 throw NotImplementedException(A_FUNCINFO);
5938void LIBXML2_DOMWriter::
5939writeDocumentFragment(LIBXML2_DOMNamespaceContext* dnc, LIBXML2_DocumentFragment* df,
5940 StringBuilder& appendTo)
5942 LIBXML2_NodeList* elnl = df->childNodes();
5943 UInt32 l = elnl->length(), i;
5944 for (i = 0; i < l; i++) {
5945 LIBXML2_Node* n = elnl->item(i);
5948 writeNode(dnc, n, appendTo);
5952void LIBXML2_DOMWriter::
5953writeNotation(LIBXML2_DOMNamespaceContext* dnc, LIBXML2_Notation* nt,
5954 StringBuilder& appendTo)
5958 ARCANE_UNUSED(appendTo);
5959 throw NotImplementedException(A_FUNCINFO);
5962LIBXML2_DOMNamespaceContext::
5963LIBXML2_DOMNamespaceContext(LIBXML2_DOMNamespaceContext* aParent)
5965, mOverrideDefaultNamespace(false)
5968void LIBXML2_DOMNamespaceContext::
5969setDefaultNamespace(
const String& newNS)
5971 if (!mOverrideDefaultNamespace) {
5972 mOverrideDefaultNamespace =
true;
5973 mDefaultNamespace = newNS;
5977String LIBXML2_DOMNamespaceContext::
5978getDefaultNamespace()
5980 if (mOverrideDefaultNamespace)
5981 return mDefaultNamespace;
5982 if (mParent == NULL)
5984 return mParent->getDefaultNamespace();
5987String LIBXML2_DOMNamespaceContext::
5988findNamespaceForPrefix(
const String& prefix)
5990 std::map<String, String>::iterator i;
5991 i = mURIfromPrefix.find(prefix);
5992 if (i != mURIfromPrefix.end())
5994 if (mParent == NULL)
5996 return mParent->findNamespaceForPrefix(prefix);
5999String LIBXML2_DOMNamespaceContext::
6000findPrefixForNamespace(
const String& ns)
6002 std::map<String, String>::iterator i;
6003 i = mPrefixfromURI.find(ns);
6004 if (i != mPrefixfromURI.end())
6006 if (mParent == NULL) {
6008 if (ns ==
"http://www.w3.org/XML/1998/namespace")
6012 return mParent->findPrefixForNamespace(ns);
6015void LIBXML2_DOMNamespaceContext::
6016recordPrefix(
const String& prefix,
const String& ns)
6018 mURIfromPrefix.insert(std::pair<String, String>(prefix, ns));
6019 mPrefixfromURI.insert(std::pair<String, String>(ns, prefix));
6022void LIBXML2_DOMNamespaceContext::
6023possiblyInventPrefix(
const String& prefix)
6025 mNamespacesNeedingPrefixes.push_back(prefix);
6028void LIBXML2_DOMNamespaceContext::
6029resolveOrInventPrefixes()
6031 while (!mNamespacesNeedingPrefixes.empty()) {
6032 String nnp = mNamespacesNeedingPrefixes.back();
6033 mNamespacesNeedingPrefixes.pop_back();
6035 if (findPrefixForNamespace(nnp) != String())
6040 if (nnp ==
"http://www.w3.org/1999/xlink")
6041 suggestion =
"xlink";
6042 else if (nnp ==
"http://www.w3.org/1999/xhtml")
6043 suggestion =
"html";
6046 StringBuilder attempt = suggestion;
6048 while (findPrefixForNamespace(attempt) != String()) {
6049 attempt = suggestion;
6050 String buf = String::format(
"{0}", attemptCount++);
6054 recordPrefix(attempt, nnp);
6058void LIBXML2_DOMNamespaceContext::
6059writeXMLNS(StringBuilder& appendTo)
6061 std::map<String, String>::iterator i;
6063 if (mOverrideDefaultNamespace) {
6064 appendTo +=
" xmlns=\"" + TranslateEntities(mDefaultNamespace) +
"\"";
6066 for (i = mURIfromPrefix.begin(); i != mURIfromPrefix.end(); i++) {
6067 const String prefix = (*i).first;
6068 if (prefix ==
"xml")
6070 appendTo +=
" xmlns:" + prefix +
"=\"" + TranslateEntities((*i).second,
true) +
"\"";
6075WrapXML2Node(LIBXML2_Document* doc, xmlNode* x2node)
6077 LIBXML2_Document* docR;
6079 StringBuilder localname, namespaceURI;
6081 if (x2node->name != NULL) {
6082 localname =
reinterpret_cast<const char*
>(x2node->name);
6085 bool isNodeStructure =
false;
6086 switch (x2node->type) {
6087 case XML_ELEMENT_NODE: {
6089 if (x2node->ns && x2node->ns->href) {
6090 namespaceURI +=
reinterpret_cast<const char*
>(x2node->ns->href);
6092 isNodeStructure =
true;
6093 LIBXML2_Element* el = LIBXML2_NewElement(doc, namespaceURI, localname);
6095 throw Arcane::Exception::exception();
6097 for (xmlAttr* at = x2node->properties; at != NULL; at = at->next) {
6098 LIBXML2_Attr* cattr =
new LIBXML2_Attr(doc);
6100 throw Arcane::Exception::exception();
6101 String nsURI, prefix, localname;
6102 if (at->ns && at->ns->href) {
6103 nsURI =
reinterpret_cast<const char*
>(at->ns->href);
6104 prefix =
reinterpret_cast<const char*
>(at->ns->prefix);
6106 localname =
reinterpret_cast<const char*
>(at->name);
6108 cattr->mLocalName = localname;
6109 if (prefix != String())
6110 cattr->mNodeName = prefix +
":" + localname;
6112 cattr->mNodeName = localname;
6113 cattr->mNamespaceURI = nsURI;
6115 for (tmp = at->children; tmp != NULL; tmp = tmp->next) {
6116 LIBXML2_Node* nw = WrapXML2Node(doc, tmp);
6118 cattr->appendChild(nw)->release_ref();
6121 if (at->ns != NULL && at->ns->href != NULL)
6122 cattr->mNodeValue =
reinterpret_cast<const char*
>(xmlGetNsProp(at->parent, at->name, at->ns->href));
6124 cattr->mNodeValue =
reinterpret_cast<const char*
>(xmlGetNoNsProp(at->parent, at->name));
6125 el->attributeMapNS.insert(std::pair<LIBXML2_Element::QualifiedName, LIBXML2_Attr*>(
6126 LIBXML2_Element::QualifiedName(nsURI, localname), cattr));
6127 el->attributeMap.insert(std::pair<LIBXML2_Element::LocalName, LIBXML2_Attr*>(
6128 LIBXML2_Element::LocalName(cattr->mNodeName), cattr));
6129 el->insertBeforePrivate(cattr, NULL)->release_ref();
6132 for (xmlNs* nsd = x2node->nsDef; nsd != NULL; nsd = nsd->next) {
6133 LIBXML2_Attr* cattr =
new LIBXML2_Attr(doc);
6135 throw Arcane::Exception::exception();
6136 StringBuilder nsURI, prefix, localname;
6137 if (nsd->prefix && strcmp(
reinterpret_cast<const char*
>(nsd->prefix),
"")) {
6138 nsURI +=
"http://www.w3.org/2000/xmlns/";
6140 localname +=
reinterpret_cast<const char*
>(nsd->prefix);
6142 localname +=
"xmlns";
6143 cattr->mLocalName = localname;
6144 if (prefix != String()) {
6145 prefix +=
":" + localname;
6146 cattr->mNodeName = prefix;
6148 cattr->mNodeName = localname;
6149 cattr->mNamespaceURI = nsURI;
6151 cattr->mNodeValue =
reinterpret_cast<const char*
>(nsd->href);
6152 el->attributeMapNS.insert(std::pair<LIBXML2_Element::QualifiedName, LIBXML2_Attr*>(
6153 LIBXML2_Element::QualifiedName(nsURI, localname), cattr));
6154 el->attributeMap.insert(std::pair<LIBXML2_Element::LocalName, LIBXML2_Attr*>(
6155 LIBXML2_Element::LocalName(cattr->mNodeName), cattr));
6156 el->insertBeforePrivate(cattr, NULL)->release_ref();
6159 case XML_TEXT_NODE: {
6160 isNodeStructure =
true;
6161 n =
new LIBXML2_Text(doc);
6163 throw Arcane::Exception::exception();
6165 case XML_CDATA_SECTION_NODE: {
6166 isNodeStructure =
true;
6167 n =
new LIBXML2_CDATASection(doc);
6169 throw Arcane::Exception::exception();
6171 case XML_ENTITY_REF_NODE: {
6172 isNodeStructure =
true;
6173 n =
new LIBXML2_EntityReference(doc);
6175 throw Arcane::Exception::exception();
6177 case XML_ENTITY_NODE: {
6178 String notName, pubID, sysID;
6179 xmlEntity* se =
reinterpret_cast<xmlEntity*
>(x2node);
6180 notName =
reinterpret_cast<const char*
>(se->name);
6181 pubID =
reinterpret_cast<const char*
>(se->ExternalID);
6182 sysID =
reinterpret_cast<const char*
>(se->SystemID);
6183 n =
new LIBXML2_Entity(doc, pubID, sysID, notName);
6185 throw Arcane::Exception::exception();
6188 isNodeStructure =
true;
6189 n =
new LIBXML2_ProcessingInstruction(doc, String(), String());
6191 throw Arcane::Exception::exception();
6193 case XML_COMMENT_NODE: {
6194 isNodeStructure =
true;
6195 n =
new LIBXML2_Comment(doc);
6197 throw Arcane::Exception::exception();
6199 case XML_DOCUMENT_NODE:
6200#ifdef XML_DOCB_DOCUMENT_NODE
6201 case XML_DOCB_DOCUMENT_NODE:
6203#ifdef XML_HTML_DOCUMENT_NODE
6204 case XML_HTML_DOCUMENT_NODE:
6210 for (xmlNode* tnode = x2node->children; tnode; tnode = tnode->next) {
6211 if (tnode->type != XML_ELEMENT_NODE)
6213 if (tnode->ns == NULL || tnode->ns->href == NULL)
6215 rootNS =
reinterpret_cast<const char*
>(tnode->ns->href);
6218 docR = LIBXML2_NewDocument(rootNS);
6220 xmlDoc* sd =
reinterpret_cast<xmlDoc*
>(x2node);
6221 xmlDtd* dt = sd->intSubset;
6223 LIBXML2_Node* dtwrap = WrapXML2Node(doc,
reinterpret_cast<xmlNode*
>(dt));
6225 doc->insertBeforePrivate(dtwrap, NULL)->release_ref();
6229 case XML_DOCUMENT_TYPE_NODE: {
6230 String pubID, sysID;
6231 xmlDtd* dt =
reinterpret_cast<xmlDtd*
>(x2node);
6232 pubID =
reinterpret_cast<const char*
>(dt->ExternalID);
6233 sysID =
reinterpret_cast<const char*
>(dt->SystemID);
6234 n =
new LIBXML2_DocumentType(doc, localname, pubID, sysID);
6236 throw Arcane::Exception::exception();
6238 case XML_DOCUMENT_FRAG_NODE: {
6239 isNodeStructure =
true;
6240 n =
new LIBXML2_DocumentFragment(doc);
6242 throw Arcane::Exception::exception();
6245 case XML_ATTRIBUTE_NODE:
6247 case XML_NOTATION_NODE:
6252 if (isNodeStructure) {
6254 if (x2node->ns && x2node->ns->href) {
6255 namespaceURI =
reinterpret_cast<const char*
>(x2node->ns->href);
6258 n->mLocalName = localname;
6259 if (x2node->ns && x2node->ns->href) {
6260 n->mNamespaceURI = namespaceURI;
6262 if (x2node->ns && x2node->ns->prefix) {
6263 StringBuilder prefix;
6264 prefix =
reinterpret_cast<const char*
>(x2node->ns->prefix);
6265 prefix +=
":" + localname;
6266 n->mNodeName = prefix;
6268 n->mNodeName = localname;
6269 if (x2node->content) {
6270 n->mNodeValue =
reinterpret_cast<const char*
>(x2node->content);
6274 x2node = x2node->children;
6276 LIBXML2_Node* wn = WrapXML2Node(doc, x2node);
6278 n->insertBeforePrivate(wn, NULL)->release_ref();
6279 x2node = x2node->next;
6285void LIBXML2_DOMImplementation::
6286ProcessContextError(String& aErrorMessage, xmlParserCtxtPtr ctxt)
6288 xmlErrorPtr err = xmlCtxtGetLastError(ctxt);
6290 xmlFreeParserCtxt(ctxt);
6291 aErrorMessage =
"Could not fetch the error message.";
6294 ProcessXMLError(aErrorMessage, err);
6295 xmlFreeParserCtxt(ctxt);
6298void LIBXML2_DOMImplementation::
6299ProcessXMLError(String& aErrorMessage, xmlError* err)
6304 fname =
reinterpret_cast<const char*
>(err->file);
6307 msg =
reinterpret_cast<const char*
>(err->message);
6310 switch (err->code) {
6311 case XML_ERR_INTERNAL_ERROR:
6312 aErrorMessage =
"internalerror";
6314 case XML_ERR_NO_MEMORY:
6315 aErrorMessage =
"nomemory";
6317 case XML_ERR_DOCUMENT_START:
6318 case XML_ERR_DOCUMENT_EMPTY:
6319 case XML_ERR_DOCUMENT_END:
6320 case XML_ERR_INVALID_HEX_CHARREF:
6321 case XML_ERR_INVALID_DEC_CHARREF:
6322 case XML_ERR_INVALID_CHARREF:
6323 case XML_ERR_INVALID_CHAR:
6324 case XML_ERR_CHARREF_AT_EOF:
6325 case XML_ERR_CHARREF_IN_PROLOG:
6326 case XML_ERR_CHARREF_IN_EPILOG:
6327 case XML_ERR_CHARREF_IN_DTD:
6328 case XML_ERR_ENTITYREF_AT_EOF:
6329 case XML_ERR_ENTITYREF_IN_PROLOG:
6330 case XML_ERR_ENTITYREF_IN_EPILOG:
6331 case XML_ERR_ENTITYREF_IN_DTD:
6332 case XML_ERR_PEREF_AT_EOF:
6333 case XML_ERR_PEREF_IN_PROLOG:
6334 case XML_ERR_PEREF_IN_EPILOG:
6335 case XML_ERR_PEREF_IN_INT_SUBSET:
6336 case XML_ERR_ENTITYREF_NO_NAME:
6337 case XML_ERR_ENTITYREF_SEMICOL_MISSING:
6338 case XML_ERR_PEREF_NO_NAME:
6339 case XML_ERR_PEREF_SEMICOL_MISSING:
6340 case XML_ERR_UNDECLARED_ENTITY:
6341 case XML_WAR_UNDECLARED_ENTITY:
6342 case XML_ERR_UNPARSED_ENTITY:
6343 case XML_ERR_ENTITY_IS_EXTERNAL:
6344 case XML_ERR_ENTITY_IS_PARAMETER:
6345 case XML_ERR_UNKNOWN_ENCODING:
6346 case XML_ERR_UNSUPPORTED_ENCODING:
6347 case XML_ERR_STRING_NOT_STARTED:
6348 case XML_ERR_STRING_NOT_CLOSED:
6349 case XML_ERR_NS_DECL_ERROR:
6350 case XML_ERR_ENTITY_NOT_STARTED:
6351 case XML_ERR_ENTITY_NOT_FINISHED:
6352 case XML_ERR_LT_IN_ATTRIBUTE:
6353 case XML_ERR_ATTRIBUTE_NOT_STARTED:
6354 case XML_ERR_ATTRIBUTE_NOT_FINISHED:
6355 case XML_ERR_ATTRIBUTE_WITHOUT_VALUE:
6356 case XML_ERR_ATTRIBUTE_REDEFINED:
6357 case XML_ERR_LITERAL_NOT_STARTED:
6358 case XML_ERR_LITERAL_NOT_FINISHED:
6359 case XML_ERR_COMMENT_NOT_FINISHED:
6360 case XML_ERR_PI_NOT_STARTED:
6361 case XML_ERR_PI_NOT_FINISHED:
6362 case XML_ERR_NOTATION_NOT_STARTED:
6363 case XML_ERR_NOTATION_NOT_FINISHED:
6364 case XML_ERR_ATTLIST_NOT_STARTED:
6365 case XML_ERR_ATTLIST_NOT_FINISHED:
6366 case XML_ERR_MIXED_NOT_STARTED:
6367 case XML_ERR_MIXED_NOT_FINISHED:
6368 case XML_ERR_ELEMCONTENT_NOT_STARTED:
6369 case XML_ERR_ELEMCONTENT_NOT_FINISHED:
6370 case XML_ERR_XMLDECL_NOT_STARTED:
6371 case XML_ERR_XMLDECL_NOT_FINISHED:
6372 case XML_ERR_CONDSEC_NOT_STARTED:
6373 case XML_ERR_CONDSEC_NOT_FINISHED:
6374 case XML_ERR_EXT_SUBSET_NOT_FINISHED:
6375 case XML_ERR_DOCTYPE_NOT_FINISHED:
6376 case XML_ERR_MISPLACED_CDATA_END:
6377 case XML_ERR_CDATA_NOT_FINISHED:
6378 case XML_ERR_RESERVED_XML_NAME:
6379 case XML_ERR_SPACE_REQUIRED:
6380 case XML_ERR_SEPARATOR_REQUIRED:
6381 case XML_ERR_NMTOKEN_REQUIRED:
6382 case XML_ERR_NAME_REQUIRED:
6383 case XML_ERR_PCDATA_REQUIRED:
6384 case XML_ERR_URI_REQUIRED:
6385 case XML_ERR_PUBID_REQUIRED:
6386 case XML_ERR_LT_REQUIRED:
6387 case XML_ERR_GT_REQUIRED:
6388 case XML_ERR_LTSLASH_REQUIRED:
6389 case XML_ERR_EQUAL_REQUIRED:
6390 case XML_ERR_TAG_NAME_MISMATCH:
6391 case XML_ERR_TAG_NOT_FINISHED:
6392 case XML_ERR_STANDALONE_VALUE:
6393 case XML_ERR_ENCODING_NAME:
6394 case XML_ERR_HYPHEN_IN_COMMENT:
6395 case XML_ERR_INVALID_ENCODING:
6396 case XML_ERR_EXT_ENTITY_STANDALONE:
6397 case XML_ERR_CONDSEC_INVALID:
6398 case XML_ERR_VALUE_REQUIRED:
6399 case XML_ERR_NOT_WELL_BALANCED:
6400 case XML_ERR_EXTRA_CONTENT:
6401 case XML_ERR_ENTITY_CHAR_ERROR:
6402 case XML_ERR_ENTITY_PE_INTERNAL:
6403 case XML_ERR_ENTITY_LOOP:
6404 case XML_ERR_ENTITY_BOUNDARY:
6405#if LIBXML_VERSION > 20403
6406 case XML_WAR_CATALOG_PI:
6408#if LIBXML_VERSION > 20404
6409 case XML_ERR_NO_DTD:
6411 case XML_ERR_CONDSEC_INVALID_KEYWORD:
6412 case XML_ERR_VERSION_MISSING:
6413 case XML_WAR_UNKNOWN_VERSION:
6414 case XML_WAR_LANG_VALUE:
6415 case XML_WAR_NS_URI:
6416 case XML_WAR_NS_URI_RELATIVE:
6417 case XML_ERR_MISSING_ENCODING:
6418#if LIBXML_VERSION > 20616
6419 case XML_WAR_SPACE_VALUE:
6420 case XML_ERR_NOT_STANDALONE:
6421 case XML_ERR_ENTITY_PROCESSING:
6422 case XML_ERR_NOTATION_PROCESSING:
6423 case XML_WAR_NS_COLUMN:
6424 case XML_WAR_ENTITY_REDEFINED:
6426#if LIBXML_VERSION > 20600
6427 case XML_NS_ERR_UNDEFINED_NAMESPACE:
6428 case XML_NS_ERR_QNAME:
6429 case XML_NS_ERR_ATTRIBUTE_REDEFINED:
6431 case XML_NS_ERR_EMPTY:
6434 case XML_DTD_ATTRIBUTE_REDEFINED:
6435 case XML_DTD_ATTRIBUTE_VALUE:
6436 case XML_DTD_CONTENT_ERROR:
6437 case XML_DTD_CONTENT_MODEL:
6438 case XML_DTD_CONTENT_NOT_DETERMINIST:
6439 case XML_DTD_DIFFERENT_PREFIX:
6440 case XML_DTD_ELEM_DEFAULT_NAMESPACE:
6441 case XML_DTD_ELEM_NAMESPACE:
6442 case XML_DTD_ELEM_REDEFINED:
6443 case XML_DTD_EMPTY_NOTATION:
6444 case XML_DTD_ENTITY_TYPE:
6445 case XML_DTD_ID_FIXED:
6446 case XML_DTD_ID_REDEFINED:
6447 case XML_DTD_ID_SUBSET:
6448 case XML_DTD_INVALID_CHILD:
6449 case XML_DTD_INVALID_DEFAULT:
6450 case XML_DTD_LOAD_ERROR:
6451 case XML_DTD_MISSING_ATTRIBUTE:
6452 case XML_DTD_MIXED_CORRUPT:
6453 case XML_DTD_MULTIPLE_ID:
6454 case XML_DTD_NO_DOC:
6455 case XML_DTD_NO_DTD:
6456 case XML_DTD_NO_ELEM_NAME:
6457 case XML_DTD_NO_PREFIX:
6458 case XML_DTD_NO_ROOT:
6459 case XML_DTD_NOTATION_REDEFINED:
6460 case XML_DTD_NOTATION_VALUE:
6461 case XML_DTD_NOT_EMPTY:
6462 case XML_DTD_NOT_PCDATA:
6463 case XML_DTD_NOT_STANDALONE:
6464 case XML_DTD_ROOT_NAME:
6465 case XML_DTD_STANDALONE_WHITE_SPACE:
6466 case XML_DTD_UNKNOWN_ATTRIBUTE:
6467 case XML_DTD_UNKNOWN_ELEM:
6468 case XML_DTD_UNKNOWN_ENTITY:
6469 case XML_DTD_UNKNOWN_ID:
6470 case XML_DTD_UNKNOWN_NOTATION:
6471 case XML_DTD_STANDALONE_DEFAULTED:
6472 case XML_DTD_XMLID_VALUE:
6473 case XML_DTD_XMLID_TYPE:
6474 case XML_XINCLUDE_PARSE_VALUE:
6475 case XML_XINCLUDE_ENTITY_DEF_MISMATCH:
6476 case XML_XINCLUDE_NO_HREF:
6477 case XML_XINCLUDE_NO_FALLBACK:
6478 case XML_XINCLUDE_HREF_URI:
6479 case XML_XINCLUDE_TEXT_FRAGMENT:
6480 case XML_XINCLUDE_TEXT_DOCUMENT:
6481 case XML_XINCLUDE_INVALID_CHAR:
6482 case XML_XINCLUDE_BUILD_FAILED:
6483 case XML_XINCLUDE_UNKNOWN_ENCODING:
6484 case XML_XINCLUDE_MULTIPLE_ROOT:
6485 case XML_XINCLUDE_XPTR_FAILED:
6486 case XML_XINCLUDE_XPTR_RESULT:
6487 case XML_XINCLUDE_INCLUDE_IN_INCLUDE:
6488 case XML_XINCLUDE_FALLBACKS_IN_INCLUDE:
6489 case XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE:
6490 case XML_XINCLUDE_DEPRECATED_NS:
6491 case XML_XINCLUDE_FRAGMENT_ID:
6493 case XML_CATALOG_ENTRY_BROKEN:
6494 case XML_CATALOG_PREFER_VALUE:
6495 case XML_CATALOG_NOT_CATALOG:
6496 case XML_CATALOG_RECURSION:
6498 case XML_SCHEMAP_ATTRFORMDEFAULT_VALUE:
6499 case XML_SCHEMAP_ATTRGRP_NONAME_NOREF:
6500 case XML_SCHEMAP_ATTR_NONAME_NOREF:
6501 case XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF:
6502 case XML_SCHEMAP_ELEMFORMDEFAULT_VALUE:
6503 case XML_SCHEMAP_ELEM_NONAME_NOREF:
6504 case XML_SCHEMAP_EXTENSION_NO_BASE:
6505 case XML_SCHEMAP_FACET_NO_VALUE:
6506 case XML_SCHEMAP_FAILED_BUILD_IMPORT:
6507 case XML_SCHEMAP_GROUP_NONAME_NOREF:
6508 case XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI:
6509 case XML_SCHEMAP_IMPORT_REDEFINE_NSNAME:
6510 case XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI:
6511 case XML_SCHEMAP_INVALID_BOOLEAN:
6512 case XML_SCHEMAP_INVALID_ENUM:
6513 case XML_SCHEMAP_INVALID_FACET:
6514 case XML_SCHEMAP_INVALID_FACET_VALUE:
6515 case XML_SCHEMAP_INVALID_MAXOCCURS:
6516 case XML_SCHEMAP_INVALID_MINOCCURS:
6517 case XML_SCHEMAP_INVALID_REF_AND_SUBTYPE:
6518 case XML_SCHEMAP_INVALID_WHITE_SPACE:
6519 case XML_SCHEMAP_NOATTR_NOREF:
6520 case XML_SCHEMAP_NOTATION_NO_NAME:
6521 case XML_SCHEMAP_NOTYPE_NOREF:
6522 case XML_SCHEMAP_REF_AND_SUBTYPE:
6523 case XML_SCHEMAP_RESTRICTION_NONAME_NOREF:
6524 case XML_SCHEMAP_SIMPLETYPE_NONAME:
6525 case XML_SCHEMAP_TYPE_AND_SUBTYPE:
6526 case XML_SCHEMAP_UNKNOWN_ALL_CHILD:
6527 case XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD:
6528 case XML_SCHEMAP_UNKNOWN_ATTR_CHILD:
6529 case XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD:
6530 case XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP:
6531 case XML_SCHEMAP_UNKNOWN_BASE_TYPE:
6532 case XML_SCHEMAP_UNKNOWN_CHOICE_CHILD:
6533 case XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD:
6534 case XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD:
6535 case XML_SCHEMAP_UNKNOWN_ELEM_CHILD:
6536 case XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD:
6537 case XML_SCHEMAP_UNKNOWN_FACET_CHILD:
6538 case XML_SCHEMAP_UNKNOWN_FACET_TYPE:
6539 case XML_SCHEMAP_UNKNOWN_GROUP_CHILD:
6540 case XML_SCHEMAP_UNKNOWN_IMPORT_CHILD:
6541 case XML_SCHEMAP_UNKNOWN_LIST_CHILD:
6542 case XML_SCHEMAP_UNKNOWN_NOTATION_CHILD:
6543 case XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD:
6544 case XML_SCHEMAP_UNKNOWN_REF:
6545 case XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD:
6546 case XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD:
6547 case XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD:
6548 case XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD:
6549 case XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD:
6550 case XML_SCHEMAP_UNKNOWN_TYPE:
6551 case XML_SCHEMAP_UNKNOWN_UNION_CHILD:
6552 case XML_SCHEMAP_ELEM_DEFAULT_FIXED:
6553 case XML_SCHEMAP_REGEXP_INVALID:
6554 case XML_SCHEMAP_FAILED_LOAD:
6555 case XML_SCHEMAP_NOTHING_TO_PARSE:
6556 case XML_SCHEMAP_NOROOT:
6557 case XML_SCHEMAP_REDEFINED_GROUP:
6558 case XML_SCHEMAP_REDEFINED_TYPE:
6559 case XML_SCHEMAP_REDEFINED_ELEMENT:
6560 case XML_SCHEMAP_REDEFINED_ATTRGROUP:
6561 case XML_SCHEMAP_REDEFINED_ATTR:
6562 case XML_SCHEMAP_REDEFINED_NOTATION:
6563 case XML_SCHEMAP_FAILED_PARSE:
6564 case XML_SCHEMAP_UNKNOWN_PREFIX:
6565 case XML_SCHEMAP_DEF_AND_PREFIX:
6566 case XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD:
6567 case XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI:
6568 case XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI:
6569 case XML_SCHEMAP_NOT_SCHEMA:
6570 case XML_SCHEMAP_UNKNOWN_MEMBER_TYPE:
6571 case XML_SCHEMAP_INVALID_ATTR_USE:
6572 case XML_SCHEMAP_RECURSIVE:
6573 case XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE:
6574 case XML_SCHEMAP_INVALID_ATTR_COMBINATION:
6575 case XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION:
6576 case XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD:
6577 case XML_SCHEMAP_INVALID_ATTR_NAME:
6578 case XML_SCHEMAP_REF_AND_CONTENT:
6579 case XML_SCHEMAP_CT_PROPS_CORRECT_1:
6580 case XML_SCHEMAP_CT_PROPS_CORRECT_2:
6581 case XML_SCHEMAP_CT_PROPS_CORRECT_3:
6582 case XML_SCHEMAP_CT_PROPS_CORRECT_4:
6583 case XML_SCHEMAP_CT_PROPS_CORRECT_5:
6584 case XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1:
6585 case XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1:
6586 case XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2:
6587 case XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2:
6588 case XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3:
6589 case XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER:
6590 case XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE:
6591 case XML_SCHEMAP_UNION_NOT_EXPRESSIBLE:
6592 case XML_SCHEMAP_SRC_IMPORT_3_1:
6593 case XML_SCHEMAP_SRC_IMPORT_3_2:
6594 case XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1:
6595 case XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2:
6596 case XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3:
6597 case XML_SCHEMAP_COS_CT_EXTENDS_1_3:
6599 case XML_SCHEMAV_UNDECLAREDELEM:
6600 case XML_SCHEMAV_NOTTOPLEVEL:
6601 case XML_SCHEMAV_MISSING:
6602 case XML_SCHEMAV_WRONGELEM:
6603 case XML_SCHEMAV_NOTYPE:
6604 case XML_SCHEMAV_NOROLLBACK:
6605 case XML_SCHEMAV_ISABSTRACT:
6606 case XML_SCHEMAV_NOTEMPTY:
6607 case XML_SCHEMAV_ELEMCONT:
6608 case XML_SCHEMAV_HAVEDEFAULT:
6609 case XML_SCHEMAV_NOTNILLABLE:
6610 case XML_SCHEMAV_EXTRACONTENT:
6611 case XML_SCHEMAV_INVALIDATTR:
6612 case XML_SCHEMAV_INVALIDELEM:
6613 case XML_SCHEMAV_NOTDETERMINIST:
6614 case XML_SCHEMAV_CONSTRUCT:
6615 case XML_SCHEMAV_INTERNAL:
6616 case XML_SCHEMAV_NOTSIMPLE:
6617 case XML_SCHEMAV_ATTRUNKNOWN:
6618 case XML_SCHEMAV_ATTRINVALID:
6619 case XML_SCHEMAV_VALUE:
6620 case XML_SCHEMAV_FACET:
6621 case XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1:
6622 case XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2:
6623 case XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3:
6624 case XML_SCHEMAV_CVC_TYPE_3_1_1:
6625 case XML_SCHEMAV_CVC_TYPE_3_1_2:
6626 case XML_SCHEMAV_CVC_FACET_VALID:
6627 case XML_SCHEMAV_CVC_LENGTH_VALID:
6628 case XML_SCHEMAV_CVC_MINLENGTH_VALID:
6629 case XML_SCHEMAV_CVC_MAXLENGTH_VALID:
6630 case XML_SCHEMAV_CVC_MININCLUSIVE_VALID:
6631 case XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID:
6632 case XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID:
6633 case XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID:
6634 case XML_SCHEMAV_CVC_TOTALDIGITS_VALID:
6635 case XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID:
6636 case XML_SCHEMAV_CVC_PATTERN_VALID:
6637 case XML_SCHEMAV_CVC_ENUMERATION_VALID:
6638 case XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1:
6639 case XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2:
6640 case XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3:
6641 case XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4:
6642 case XML_SCHEMAV_CVC_ELT_1:
6643 case XML_SCHEMAV_CVC_ELT_2:
6644 case XML_SCHEMAV_CVC_ELT_3_1:
6645 case XML_SCHEMAV_CVC_ELT_3_2_1:
6646 case XML_SCHEMAV_CVC_ELT_3_2_2:
6647 case XML_SCHEMAV_CVC_ELT_4_1:
6648 case XML_SCHEMAV_CVC_ELT_4_2:
6649 case XML_SCHEMAV_CVC_ELT_4_3:
6650 case XML_SCHEMAV_CVC_ELT_5_1_1:
6651 case XML_SCHEMAV_CVC_ELT_5_1_2:
6652 case XML_SCHEMAV_CVC_ELT_5_2_1:
6653 case XML_SCHEMAV_CVC_ELT_5_2_2_1:
6654 case XML_SCHEMAV_CVC_ELT_5_2_2_2_1:
6655 case XML_SCHEMAV_CVC_ELT_5_2_2_2_2:
6656 case XML_SCHEMAV_CVC_ELT_6:
6657 case XML_SCHEMAV_CVC_ELT_7:
6658 case XML_SCHEMAV_CVC_ATTRIBUTE_1:
6659 case XML_SCHEMAV_CVC_ATTRIBUTE_2:
6660 case XML_SCHEMAV_CVC_ATTRIBUTE_3:
6661 case XML_SCHEMAV_CVC_ATTRIBUTE_4:
6662 case XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1:
6663 case XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1:
6664 case XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2:
6665 case XML_SCHEMAV_CVC_COMPLEX_TYPE_4:
6666 case XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1:
6667 case XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2:
6668 case XML_SCHEMAV_ELEMENT_CONTENT:
6669 case XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING:
6670 case XML_SCHEMAV_CVC_COMPLEX_TYPE_1:
6671 case XML_SCHEMAV_CVC_AU:
6672 case XML_SCHEMAV_CVC_TYPE_1:
6673 case XML_SCHEMAV_CVC_TYPE_2:
6674#if LIBXML_VERSION > 20616
6675 case XML_SCHEMAV_CVC_IDC:
6676 case XML_SCHEMAV_CVC_WILDCARD:
6679 case XML_XPTR_CHILDSEQ_START:
6680 case XML_XPTR_EVAL_FAILED:
6681 case XML_XPTR_EXTRA_OBJECTS:
6683 case XML_C14N_REQUIRES_UTF8:
6684 case XML_C14N_CREATE_STACK:
6685 case XML_C14N_INVALID_NODE:
6686#if LIBXML_VERSION > 20616
6687 case XML_C14N_UNKNOW_NODE:
6688 case XML_C14N_RELATIVE_NAMESPACE:
6690 case XML_SCHEMAP_SRC_SIMPLE_TYPE_2:
6691 case XML_SCHEMAP_SRC_SIMPLE_TYPE_3:
6692 case XML_SCHEMAP_SRC_SIMPLE_TYPE_4:
6693 case XML_SCHEMAP_SRC_RESOLVE:
6694 case XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE:
6695 case XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE:
6696 case XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES:
6697 case XML_SCHEMAP_ST_PROPS_CORRECT_1:
6698 case XML_SCHEMAP_ST_PROPS_CORRECT_2:
6699 case XML_SCHEMAP_ST_PROPS_CORRECT_3:
6700 case XML_SCHEMAP_COS_ST_RESTRICTS_1_1:
6701 case XML_SCHEMAP_COS_ST_RESTRICTS_1_2:
6702 case XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1:
6703 case XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2:
6704 case XML_SCHEMAP_COS_ST_RESTRICTS_2_1:
6705 case XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1:
6706 case XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2:
6707 case XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1:
6708 case XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2:
6709 case XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3:
6710 case XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4:
6711 case XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5:
6712 case XML_SCHEMAP_COS_ST_RESTRICTS_3_1:
6713 case XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1:
6714 case XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2:
6715 case XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2:
6716 case XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1:
6717 case XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3:
6718 case XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4:
6719 case XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5:
6720 case XML_SCHEMAP_COS_ST_DERIVED_OK_2_1:
6721 case XML_SCHEMAP_COS_ST_DERIVED_OK_2_2:
6722 case XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED:
6723 case XML_SCHEMAP_S4S_ELEM_MISSING:
6724 case XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED:
6725 case XML_SCHEMAP_S4S_ATTR_MISSING:
6726 case XML_SCHEMAP_S4S_ATTR_INVALID_VALUE:
6727 case XML_SCHEMAP_SRC_ELEMENT_1:
6728 case XML_SCHEMAP_SRC_ELEMENT_2_1:
6729 case XML_SCHEMAP_SRC_ELEMENT_2_2:
6730 case XML_SCHEMAP_SRC_ELEMENT_3:
6731 case XML_SCHEMAP_P_PROPS_CORRECT_1:
6732 case XML_SCHEMAP_P_PROPS_CORRECT_2_1:
6733 case XML_SCHEMAP_P_PROPS_CORRECT_2_2:
6734 case XML_SCHEMAP_E_PROPS_CORRECT_2:
6735 case XML_SCHEMAP_E_PROPS_CORRECT_3:
6736 case XML_SCHEMAP_E_PROPS_CORRECT_4:
6737 case XML_SCHEMAP_E_PROPS_CORRECT_5:
6738 case XML_SCHEMAP_E_PROPS_CORRECT_6:
6739 case XML_SCHEMAP_SRC_INCLUDE:
6740 case XML_SCHEMAP_SRC_ATTRIBUTE_1:
6741 case XML_SCHEMAP_SRC_ATTRIBUTE_2:
6742 case XML_SCHEMAP_SRC_ATTRIBUTE_3_1:
6743 case XML_SCHEMAP_SRC_ATTRIBUTE_3_2:
6744 case XML_SCHEMAP_SRC_ATTRIBUTE_4:
6745 case XML_SCHEMAP_NO_XMLNS:
6746 case XML_SCHEMAP_NO_XSI:
6747 case XML_SCHEMAP_COS_VALID_DEFAULT_1:
6748 case XML_SCHEMAP_COS_VALID_DEFAULT_2_1:
6749 case XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1:
6750 case XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2:
6751 case XML_SCHEMAP_CVC_SIMPLE_TYPE:
6752 case XML_SCHEMAP_COS_CT_EXTENDS_1_1:
6753 case XML_SCHEMAP_SRC_IMPORT_1_1:
6754 case XML_SCHEMAP_SRC_IMPORT_1_2:
6755 case XML_SCHEMAP_SRC_IMPORT_2:
6756 case XML_SCHEMAP_SRC_IMPORT_2_1:
6757 case XML_SCHEMAP_SRC_IMPORT_2_2:
6758 case XML_SCHEMAP_INTERNAL:
6759 case XML_SCHEMAP_NOT_DETERMINISTIC:
6760 case XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1:
6761 case XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2:
6762 case XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3:
6763 case XML_SCHEMAP_MG_PROPS_CORRECT_1:
6764 case XML_SCHEMAP_MG_PROPS_CORRECT_2:
6765 case XML_SCHEMAP_SRC_CT_1:
6766 case XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3:
6767 case XML_SCHEMAP_AU_PROPS_CORRECT_2:
6768 case XML_SCHEMAP_A_PROPS_CORRECT_2:
6769#if XML_VERSION > 20616
6770 case XML_SCHEMAP_C_PROPS_CORRECT:
6771 case XML_SCHEMAP_SRC_REDEFINE:
6772#if XML_VERSION > 20621
6773 case XML_SCHEMAP_SRC_IMPORT:
6774 case XML_SCHEMAP_WARN_SKIP_SCHEMA:
6775 case XML_SCHEMAP_WARN_UNLOCATED_SCHEMA:
6776 case XML_SCHEMAP_WARN_ATTR_REDECL_PROH:
6777 case XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH:
6778 case XML_SCHEMAP_AG_PROPS_CORRECT:
6779 case XML_SCHEMAP_COS_CT_EXTENDS_1_2:
6780 case XML_SCHEMAP_AU_PROPS_CORRECT:
6781 case XML_SCHEMAP_A_PROPS_CORRECT_3:
6782 case XML_SCHEMAP_COS_ALL_LIMITED:
6784 case XML_MODULE_OPEN:
6785 case XML_MODULE_CLOSE:
6787 case XML_CHECK_FOUND_ATTRIBUTE:
6788 case XML_CHECK_FOUND_TEXT:
6789 case XML_CHECK_FOUND_CDATA:
6790 case XML_CHECK_FOUND_ENTITYREF:
6791 case XML_CHECK_FOUND_ENTITY:
6792 case XML_CHECK_FOUND_PI:
6793 case XML_CHECK_FOUND_COMMENT:
6794 case XML_CHECK_FOUND_DOCTYPE:
6795 case XML_CHECK_FOUND_FRAGMENT:
6796 case XML_CHECK_FOUND_NOTATION:
6797 case XML_CHECK_UNKNOWN_NODE:
6798 case XML_CHECK_ENTITY_TYPE:
6799 case XML_CHECK_NO_PARENT:
6800 case XML_CHECK_NO_DOC:
6801 case XML_CHECK_NO_NAME:
6802 case XML_CHECK_NO_ELEM:
6803 case XML_CHECK_WRONG_DOC:
6804 case XML_CHECK_NO_PREV:
6805 case XML_CHECK_WRONG_PREV:
6806 case XML_CHECK_NO_NEXT:
6807 case XML_CHECK_WRONG_NEXT:
6808 case XML_CHECK_NOT_DTD:
6809 case XML_CHECK_NOT_ATTR:
6810 case XML_CHECK_NOT_ATTR_DECL:
6811 case XML_CHECK_NOT_ELEM_DECL:
6812 case XML_CHECK_NOT_ENTITY_DECL:
6813 case XML_CHECK_NOT_NS_DECL:
6814 case XML_CHECK_NO_HREF:
6815 case XML_CHECK_WRONG_PARENT:
6816 case XML_CHECK_NS_SCOPE:
6817 case XML_CHECK_NS_ANCESTOR:
6818 case XML_CHECK_NOT_UTF8:
6819 case XML_CHECK_NO_DICT:
6820 case XML_CHECK_NOT_NCNAME:
6821 case XML_CHECK_OUTSIDE_DICT:
6822 case XML_CHECK_WRONG_NAME:
6823 case XML_CHECK_NAME_NOT_NULL:
6824#if LIBXML_VERSION > 20616
6825 case XML_I18N_NO_HANDLER:
6826 case XML_I18N_EXCESS_HANDLER:
6827 case XML_I18N_CONV_FAILED:
6828 case XML_I18N_NO_OUTPUT:
6830 aErrorMessage =
"badxml/";
6831 buf = String::format(
"{0}", err->line);
6832 aErrorMessage = aErrorMessage + buf;
6833 aErrorMessage = aErrorMessage +
"/0/";
6834 aErrorMessage = aErrorMessage + fname +
"/";
6835 aErrorMessage = aErrorMessage + msg;
6837 case XML_IO_ENCODER:
6840 case XML_IO_BUFFER_FULL:
6841 case XML_IO_LOAD_ERROR:
6842 aErrorMessage =
"servererror";
6845 aErrorMessage =
"servererror/EACCESS";
6848 aErrorMessage =
"servererror/AGAIN";
6851 aErrorMessage =
"servererror/BADF";
6853 case XML_IO_EBADMSG:
6854 aErrorMessage =
"servererror/BADMSG";
6857 aErrorMessage =
"servererror/BUSY";
6859 case XML_IO_ECANCELED:
6860 aErrorMessage =
"servererror/CANCELED";
6863 aErrorMessage =
"servererror/CHILD";
6865 case XML_IO_EDEADLK:
6866 aErrorMessage =
"servererror/DEADLK";
6869 aErrorMessage =
"servererror/DOM";
6872 aErrorMessage =
"servererror/EXIST";
6875 aErrorMessage =
"servererror/FAULT";
6878 aErrorMessage =
"servererror/FBIG";
6880 case XML_IO_EINPROGRESS:
6881 aErrorMessage =
"servererror/INPROGRESS";
6884 aErrorMessage =
"servererror/INTR";
6887 aErrorMessage =
"servererror/INVAL";
6890 aErrorMessage =
"servererror/IO";
6893 aErrorMessage =
"servererror/ISDIR";
6896 aErrorMessage =
"servererror/MFILE";
6899 aErrorMessage =
"servererror/MLINK";
6901 case XML_IO_EMSGSIZE:
6902 aErrorMessage =
"servererror/MSGSIZE";
6904 case XML_IO_ENAMETOOLONG:
6905 aErrorMessage =
"servererror/NAMETOOLONG";
6908 aErrorMessage =
"servererror/NFILE";
6911 aErrorMessage =
"servererror/NODEV";
6914 aErrorMessage =
"servererror/NOENT";
6916 case XML_IO_ENOEXEC:
6917 aErrorMessage =
"servererror/NOEXEC";
6920 aErrorMessage =
"servererror/NOLCK";
6923 aErrorMessage =
"servererror/NOMEM";
6926 aErrorMessage =
"servererror/NOSPC";
6929 aErrorMessage =
"servererror/NOSYS";
6931 case XML_IO_ENOTDIR:
6932 aErrorMessage =
"servererror/NOTDIR";
6934 case XML_IO_ENOTEMPTY:
6935 aErrorMessage =
"servererror/NOTEMPTY";
6937 case XML_IO_ENOTSUP:
6938 aErrorMessage =
"servererror/NOTSUP";
6941 aErrorMessage =
"servererror/NOTTY";
6944 aErrorMessage =
"servererror/NXIO";
6947 aErrorMessage =
"servererror/PERM";
6950 aErrorMessage =
"servererror/PIPE";
6953 aErrorMessage =
"servererror/RANGE";
6956 aErrorMessage =
"servererror/ROFS";
6959 aErrorMessage =
"servererror/SPIPE";
6962 aErrorMessage =
"servererror/SRCH";
6964 case XML_IO_ETIMEDOUT:
6965 aErrorMessage =
"servererror/TIMEDOUT";
6968 aErrorMessage =
"servererror/XDEV";
6970 case XML_IO_NO_INPUT:
6971 aErrorMessage =
"servererror/NOINPUT";
6973 case XML_IO_ENOTSOCK:
6974 aErrorMessage =
"servererror/NOTSOCK";
6976 case XML_IO_EISCONN:
6977 aErrorMessage =
"servererror/ISCONN";
6979 case XML_IO_ECONNREFUSED:
6980 aErrorMessage =
"servererror/CONNREFUSED";
6982 case XML_IO_ENETUNREACH:
6983 aErrorMessage =
"servererror/NETUNREACHABLE";
6985 case XML_IO_EADDRINUSE:
6986 aErrorMessage =
"servererror/ADDRINUSE";
6988 case XML_IO_EALREADY:
6989 aErrorMessage =
"servererror/ALREADY";
6991 case XML_IO_EAFNOSUPPORT:
6992 aErrorMessage =
"servererror/AFNOSUPPORT";
6994 case XML_FTP_EPSV_ANSWER:
6995 aErrorMessage =
"servererror/EPSV_ANSWER";
6998 aErrorMessage =
"servererror/FTPACCOUNT";
7000 case XML_HTTP_USE_IP:
7001 aErrorMessage =
"servererror/USE_IP";
7003 case XML_HTTP_UNKNOWN_HOST:
7004 aErrorMessage =
"servererror/UNKNOWNHOST";
7006 case XML_ERR_INVALID_URI:
7007 case XML_ERR_URI_FRAGMENT:
7008#if LIBXML_VERSION > 20616
7009 case XML_FTP_URL_SYNTAX:
7011 aErrorMessage =
"badurl";
7013 case XML_IO_NETWORK_ATTEMPT:
7014 aErrorMessage =
"noperm";
7017 aErrorMessage =
"unexpectedxml2error";
7021ARCANE_END_NAMESPACE_DOM
Déclarations des types utilisés dans Arcane.
IXmlDocumentHolder * _load(const String &fname, ITraceMng *msg, const String &schemaname)
IXmlDocumentHolder * _newDocument()
Les méthodes suivantes sont internes à Arcane.
Gestionnaire d'un document DOM.
void writeElement(LIBXML2_DOMNamespaceContext *dnc, LIBXML2_Element *el, StringBuilder &appendTo)
NodePrv * m_p
Implémentation de la classe.
virtual XmlNode documentNode()
Noeud document. Ce noeud est nul si le document n'existe pas.
Exception liées aux fichiers XML.
Classe de base des vecteurs 1D de données.
void add(ConstReferenceType val)
Ajoute l'élément val à la fin du tableau.
Vue constante d'un tableau de type T.
constexpr bool empty() const noexcept
true si le tableau est vide (size()==0)
constexpr const_iterator begin() const noexcept
Itérateur sur le premier élément du tableau.
constexpr Integer size() const noexcept
Nombre d'éléments du tableau.
Interface du gestionnaire de traces.
virtual TraceMessage info()=0
Flot pour un message d'information.
Constructeur de chaîne de caractère unicode.
Chaîne de caractères unicode.
ConstArrayView< UChar > utf16() const
Retourne la conversion de l'instance dans l'encodage UTF-16.
bool empty() const
Vrai si la chaîne est vide (nulle ou "")
Integer len() const
Retourne la longueur de la chaîne en 32 bits.
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.
String substring(Int64 pos) const
Sous-chaîne commençant à la position pos.
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.
void arcaneNullPointerError()
Signalue l'utilisation d'un pointeur nul.
bool operator<(const Item &item1, const Item &item2)
Compare deux entités.
UniqueArray< Byte > ByteUniqueArray
Tableau dynamique à une dimension de caractères.
ConstArrayView< Byte > ByteConstArrayView
Equivalent C d'un tableau à une dimension de caractères.
unsigned short UInt16
Type d'un Int16 non signé
std::uint32_t UInt32
Type entier non signé sur 32 bits.