Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
gnumeric
Commits
7e63f4fc
Commit
7e63f4fc
authored
Aug 13, 1998
by
Daniel Veillard
Browse files
Adapted xml-io to version 0.2 of gnome-xml, Daniel.
parent
a52c1166
Changes
5
Hide whitespace changes
Inline
Side-by-side
ChangeLog-1999-07-09
View file @
7e63f4fc
Thu Aug 13 00:02:23 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* src/xml-io.c : adapated to the new version 0.2 of the xml lib
1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_event): Call
...
...
ChangeLog-2000-02-23
View file @
7e63f4fc
Thu Aug 13 00:02:23 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* src/xml-io.c : adapated to the new version 0.2 of the xml lib
1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_event): Call
...
...
OChangeLog-1999-07-09
View file @
7e63f4fc
Thu Aug 13 00:02:23 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* src/xml-io.c : adapated to the new version 0.2 of the xml lib
1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_event): Call
...
...
OChangeLog-2000-02-23
View file @
7e63f4fc
Thu Aug 13 00:02:23 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* src/xml-io.c : adapated to the new version 0.2 of the xml lib
1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_event): Call
...
...
src/xml-io.c
View file @
7e63f4fc
...
...
@@ -10,8 +10,8 @@
#include <stdio.h>
#include <gnome.h>
#include "gnumeric.h"
#include "
xml_
tree.h"
#include "
xml_
parser.h"
#include "tree.h"
#include "parser.h"
#include "xml-io.h"
...
...
@@ -20,13 +20,12 @@
*/
typedef
struct
parseXmlContext
{
xmlDocPtr
doc
;
/* Xml document */
xml
Dtd
Ptr
ns
;
/* Main name space */
xml
Ns
Ptr
ns
;
/* Main name space */
xmlNodePtr
parent
;
/* used only for g_hash_table_foreach callbacks */
GHashTable
*
nameTable
;
/* to reproduce multiple refs with HREFs */
int
fontIdx
;
/* for Font refs names ... */
}
parseXmlContext
,
*
parseXmlContextPtr
;
static
xmlDtdPtr
xmlGetNamespace
(
xmlDocPtr
xml
,
const
char
*
href
);
static
Sheet
*
readXmlSheet
(
parseXmlContextPtr
ctxt
,
xmlNodePtr
tree
);
static
xmlNodePtr
writeXmlSheet
(
parseXmlContextPtr
ctxt
,
Sheet
*
sheet
);
static
Workbook
*
readXmlWorkbook
(
parseXmlContextPtr
ctxt
,
xmlNodePtr
tree
);
...
...
@@ -51,7 +50,7 @@ static void nameFree (gpointer key, gpointer value, gpointer user
Sheet
*
gnumericReadXmlSheet
(
const
char
*
filename
)
{
Sheet
*
sheet
;
xmlDocPtr
res
;
xml
Dtd
Ptr
gmr
;
xml
Ns
Ptr
gmr
;
parseXmlContext
ctxt
;
/*
...
...
@@ -68,7 +67,7 @@ Sheet *gnumericReadXmlSheet(const char *filename) {
/*
* Do a bit of checking, get the namespaces, and chech the top elem.
*/
gmr
=
xml
GetNamespace
(
res
,
"http://www.gnome.org/gnumeric/"
);
gmr
=
xml
SearchNs
(
res
,
res
->
root
,
"http://www.gnome.org/gnumeric/"
);
if
(
strcmp
(
res
->
root
->
name
,
"Sheet"
)
||
(
gmr
==
NULL
))
{
fprintf
(
stderr
,
"gnumericReadXmlSheet %s: not an Sheet file
\n
"
,
filename
);
...
...
@@ -97,7 +96,7 @@ Sheet *gnumericReadXmlSheet(const char *filename) {
int
gnumericWriteXmlSheet
(
Sheet
*
sheet
,
const
char
*
filename
)
{
FILE
*
output
;
xmlDocPtr
xml
;
xml
Dtd
Ptr
gmr
;
xml
Ns
Ptr
gmr
;
parseXmlContext
ctxt
;
/*
...
...
@@ -119,7 +118,7 @@ int gnumericWriteXmlSheet(Sheet *sheet, const char *filename) {
fclose
(
output
);
return
(
-
1
);
}
gmr
=
xmlNew
Dtd
(
xml
,
"http://www.gnome.org/gnumeric/"
,
"gmr"
);
gmr
=
xmlNew
GlobalNs
(
xml
,
"http://www.gnome.org/gnumeric/"
,
"gmr"
);
ctxt
.
doc
=
xml
;
ctxt
.
ns
=
gmr
;
ctxt
.
nameTable
=
g_hash_table_new
(
ptrHash
,
ptrCompare
);
...
...
@@ -146,7 +145,7 @@ int gnumericWriteXmlSheet(Sheet *sheet, const char *filename) {
Workbook
*
gnumericReadXmlWorkbook
(
const
char
*
filename
)
{
Workbook
*
sheet
;
xmlDocPtr
res
;
xml
Dtd
Ptr
gmr
;
xml
Ns
Ptr
gmr
;
parseXmlContext
ctxt
;
/*
...
...
@@ -163,7 +162,7 @@ Workbook *gnumericReadXmlWorkbook(const char *filename) {
/*
* Do a bit of checking, get the namespaces, and chech the top elem.
*/
gmr
=
xml
GetNamespace
(
res
,
"http://www.gnome.org/gnumeric/"
);
gmr
=
xml
SearchNs
(
res
,
res
->
root
,
"http://www.gnome.org/gnumeric/"
);
if
(
strcmp
(
res
->
root
->
name
,
"Workbook"
)
||
(
gmr
==
NULL
))
{
fprintf
(
stderr
,
"gnumericReadXmlWorkbook %s: not an Workbook file
\n
"
,
filename
);
...
...
@@ -192,7 +191,7 @@ Workbook *gnumericReadXmlWorkbook(const char *filename) {
int
gnumericWriteXmlWorkbook
(
Workbook
*
sheet
,
const
char
*
filename
)
{
FILE
*
output
;
xmlDocPtr
xml
;
xml
Dtd
Ptr
gmr
;
xml
Ns
Ptr
gmr
;
parseXmlContext
ctxt
;
/*
...
...
@@ -214,7 +213,7 @@ int gnumericWriteXmlWorkbook(Workbook *sheet, const char *filename) {
fclose
(
output
);
return
(
-
1
);
}
gmr
=
xmlNew
Dtd
(
xml
,
"http://www.gnome.org/gnumeric/"
,
"gmr"
);
gmr
=
xmlNew
GlobalNs
(
xml
,
"http://www.gnome.org/gnumeric/"
,
"gmr"
);
ctxt
.
doc
=
xml
;
ctxt
.
ns
=
gmr
;
ctxt
.
nameTable
=
g_hash_table_new
(
ptrHash
,
ptrCompare
);
...
...
@@ -273,22 +272,6 @@ static gint ptrCompare(gconstpointer a, gconstpointer b)
return
1
;
}
/*
* Get a namespace associated to an XML name.
* !!! This should be made public in the libxml lib actually ...
*/
static
xmlDtdPtr
xmlGetNamespace
(
xmlDocPtr
xml
,
const
char
*
href
)
{
xmlDtdPtr
dtd
;
dtd
=
xml
->
dtds
;
while
(
dtd
!=
NULL
)
{
if
(
!
strcmp
(
dtd
->
href
,
href
))
return
(
dtd
);
dtd
=
dtd
->
next
;
}
return
(
NULL
);
}
/*
* Create an XML subtree of doc equivalent to the given StyleBorder.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment