summaryrefslogtreecommitdiff
path: root/storage/connect/domdoc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'storage/connect/domdoc.cpp')
-rw-r--r--storage/connect/domdoc.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/storage/connect/domdoc.cpp b/storage/connect/domdoc.cpp
index 64a0a172956..eb9660b439d 100644
--- a/storage/connect/domdoc.cpp
+++ b/storage/connect/domdoc.cpp
@@ -89,30 +89,43 @@ DOMDOC::DOMDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
/******************************************************************/
/* Initialize XML parser and check library compatibility. */
/******************************************************************/
-bool DOMDOC::Initialize(PGLOBAL g)
- {
- if (TestHr(g, CoInitialize(NULL)))
+bool DOMDOC::Initialize(PGLOBAL g, char *entry, bool zipped)
+{
+ if (zipped && InitZip(g, entry))
+ return true;
+
+ if (TestHr(g, CoInitialize(NULL)))
return true;
if (TestHr(g, Docp.CreateInstance("msxml2.domdocument")))
return true;
return MakeNSlist(g);
- } // end of Initialize
+} // end of Initialize
/******************************************************************/
/* Parse the XML file and construct node tree in memory. */
/******************************************************************/
-bool DOMDOC::ParseFile(char *fn)
- {
- // Load the document
+bool DOMDOC::ParseFile(PGLOBAL g, char *fn)
+{
+ bool b;
+
Docp->async = false;
- if (!(bool)Docp->load((_bstr_t)fn))
+ if (zip) {
+ // Parse an in memory document
+ char *xdoc = GetMemDoc(g, fn);
+
+ b = (xdoc) ? (bool)Docp->loadXML((_bstr_t)xdoc) : false;
+ } else
+ // Load the document
+ b = (bool)Docp->load((_bstr_t)fn);
+
+ if (!b)
return true;
return false;
- } // end of ParseFile
+} // end of ParseFile
/******************************************************************/
/* Create or reuse an Xblock for this document. */
@@ -239,6 +252,7 @@ int DOMDOC::DumpDoc(PGLOBAL g, char *ofn)
void DOMDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
{
CloseXMLFile(g, xp, false);
+ CloseZip();
} // end of Close
/* ----------------------- class DOMNODE ------------------------ */
@@ -616,13 +630,13 @@ PXNODE DOMNODELIST::GetItem(PGLOBAL g, int n, PXNODE np)
/* Reset the pointer on the deleted item. */
/******************************************************************/
bool DOMNODELIST::DropItem(PGLOBAL g, int n)
- {
- if (Listp == NULL || Listp->length <= n)
- return true;
+{
+ if (Listp == NULL || Listp->length < n)
+ return true;
//Listp->item[n] = NULL; La propriété n'a pas de méthode 'set'
return false;
- } // end of DeleteItem
+} // end of DeleteItem
/* ----------------------- class DOMATTR ------------------------ */