repr-io.cpp revision 76a95a959dea0f85eb8cc1f158527f0b9896e189
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews * Dirty DOM-like tree
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews * Lauris Kaplinski <lauris@kaplinski.com>
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews * bulia byak <buliabyak@users.sf.net>
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews * Copyright (C) 1999-2002 Lauris Kaplinski
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews * Released under GNU GPL, read the file 'COPYING' for more information
0e507dbb816575e6220fe309e8ada68897ffcdbeMark AndrewsDocument *sp_repr_do_read (xmlDocPtr doc, const gchar *default_ns);
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrewsstatic Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gchar *default_ns, GHashTable *prefix_map);
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrewsstatic gint sp_repr_qualified_name (gchar *p, gint len, xmlNsPtr ns, const xmlChar *name, const gchar *default_ns, GHashTable *prefix_map);
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrewsstatic void sp_repr_write_stream_root_element (Node *repr, Writer &out, bool add_whitespace, gchar const *default_ns, int inlineattrs, int indent);
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrewsstatic void sp_repr_write_stream_element (Node *repr, Writer &out, gint indent_level, bool add_whitespace, Glib::QueryQuark elide_prefix, List<AttributeRecord const> attributes, int inlineattrs, int indent);
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrewsstatic xmlDocPtr sp_wmf_convert (const char * file_name);
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrewsstatic char * sp_wmf_image_name (void * context);
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews#endif /* HAVE_LIBWMF */
class XmlSource
: filename(0),
encoding(0),
fp(0),
firstFewLen(0),
instr(0),
gzin(0)
virtual ~XmlSource()
close();
if ( encoding ) {
encoding = 0;
int close();
const char* filename;
char* encoding;
int firstFewLen;
if ( fp ) {
if ( fp ) {
fp = 0;
some = 0;
int single = 0;
if ( single >= 0 ) {
int encSkip = 0;
} else if ( (some >= 3) && (firstFew[0] == 0xef) && (firstFew[1] == 0xbb) && (firstFew[2] == 0xbf) ) {
if ( encSkip ) {
return retVal;
if ( context ) {
return retVal;
if ( context ) {
int retVal = 0;
if ( firstFewLen > 0 ) {
} else if ( gzin ) {
int single = 0;
if ( single >= 0 ) {
return retVal;
if ( gzin ) {
delete gzin;
gzin = 0;
if ( instr ) {
fp = 0;
delete instr;
instr = 0;
if ( fp ) {
fp = 0;
Document *
#ifdef HAVE_LIBWMF
if ( !doc ) {
&src,
if ( doc ) {
if ( localFilename ) {
return rdoc;
Document *
if (doc) {
return rdoc;
Document *
namespace Inkscape {
struct compare_quark_ids {
if (prefix_end) {
return prefix;
return GQuark(0);
Document *
return NULL;
return NULL;
if (!root) {
return rdoc;
sp_repr_qualified_name (gchar *p, gint len, xmlNsPtr ns, const xmlChar *name, const gchar */*default_ns*/, GHashTable *prefix_map)
prefix = reinterpret_cast<const xmlChar*>( sp_xml_ns_uri_prefix(reinterpret_cast<const gchar*>(ns->href),
if (prefix) {
static Node *
sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gchar *default_ns, GHashTable *prefix_map)
xmlChar *p;
return NULL;
if (crepr) {
return repr;
if (str) {
return buf;
Inkscape::IO::OutputStreamWriter *out = compress ? new Inkscape::IO::OutputStreamWriter( *gout ) : new Inkscape::IO::OutputStreamWriter( bout );
delete out;
delete gout;
return FALSE;
bool compress;
return FALSE;
return FALSE;
return TRUE;
if (val) {
switch (*val) {
static void repr_write_comment( Writer &out, const gchar * val, bool addWhitespace, gint indentLevel, int indent )
if (val) {
if (addWhitespace) {
typedef std::map<Glib::QueryQuark, Inkscape::Util::ptr_shared<char>, Inkscape::compare_quark_ids> NSMap;
if (prefix_end) {
return name_string;
if (uri) {
sp_repr_write_stream_root_element (Node *repr, Writer &out, bool add_whitespace, gchar const *default_ns,
return sp_repr_write_stream_element(repr, out, 0, add_whitespace, elide_prefix, attributes, inlineattrs, indent);
bool add_whitespace,
bool loose;
if (!inlineattrs) {
if (indent) {
sp_repr_write_stream (child, out, (loose) ? (indent_level + 1) : 0, add_whitespace, elide_prefix, inlineattrs, indent);