1 /** \file
2 * A few non-inline functions of the C facade to Inkscape::XML::Node.
3 */
5 /*
6 * Authors:
7 * Lauris Kaplinski <lauris@kaplinski.com>
8 * MenTaLguY <mental@rydia.net>
9 *
10 * Copyright (C) 1999-2003 authors
11 * Copyright (C) 2000-2002 Ximian, Inc.
12 * g++ port Copyright (C) 2003 Nathan Hurst
13 *
14 * Released under GNU GPL, read the file 'COPYING' for more information
15 */
17 #define noREPR_VERBOSE
19 #ifdef HAVE_CONFIG_H
20 # include "config.h"
21 #endif
23 #include <cstring>
25 #include "xml/repr.h"
26 #include "xml/text-node.h"
27 #include "xml/element-node.h"
28 #include "xml/comment-node.h"
29 #include "xml/simple-document.h"
31 using Inkscape::Util::share_string;
33 /// Returns new document having as first child a node named rootname.
34 Inkscape::XML::Document *
35 sp_repr_document_new(char const *rootname)
36 {
37 Inkscape::XML::Document *doc = new Inkscape::XML::SimpleDocument();
38 if (!strcmp(rootname, "svg:svg")) {
39 doc->setAttribute("version", "1.0");
40 doc->setAttribute("standalone", "no");
41 Inkscape::XML::Node *comment = doc->createComment(" Created with Inkscape (http://www.inkscape.org/) ");
42 doc->appendChild(comment);
43 Inkscape::GC::release(comment);
44 }
46 Inkscape::XML::Node *root = doc->createElement(rootname);
47 doc->appendChild(root);
48 Inkscape::GC::release(root);
50 return doc;
51 }
53 /*
54 Local Variables:
55 mode:c++
56 c-file-style:"stroustrup"
57 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
58 indent-tabs-mode:nil
59 fill-column:99
60 End:
61 */
62 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :