56d8108b031eed5e12386c0d9f10d1503e0c7342
1 /**
2 * Phoebe DOM Implementation.
3 *
4 * This is a C++ approximation of the W3C DOM model, which follows
5 * fairly closely the specifications in the various .idl files, copies of
6 * which are provided for reference. Most important is this one:
7 *
8 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
9 *
10 * Authors:
11 * Bob Jamison
12 *
13 * Copyright (C) 2005-2008 Bob Jamison
14 *
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
32 #include "svgreader.h"
33 #include "lsimpl.h"
35 using namespace org::w3c::dom;
38 bool doTest(char *fileName)
39 {
41 printf("######## PARSE ######################################\n");
42 svg::SVGReader parser;
43 svg::SVGDocumentPtr doc = parser.parseFile(fileName);
45 if (!doc)
46 {
47 printf("parsing failed\n");
48 return 0;
49 }
51 //### OUTPUT
52 printf("######## SERIALIZE ##################################\n");
53 ls::DOMImplementationLSImpl domImpl;
54 ls::LSSerializer &serializer = domImpl.createLSSerializer();
55 ls::LSOutput output = domImpl.createLSOutput();
56 io::StdWriter writer;
57 output.setCharacterStream(&writer);
58 serializer.write(doc, output);
61 return 1;
62 }
68 int main(int argc, char **argv)
69 {
70 if (argc!=2)
71 {
72 printf("usage: %s xmlfile\n", argv[0]);
73 return 0;
74 }
75 doTest(argv[1]);
76 return 0;
77 }