3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 from __future__
import print_function
15 class ContentHandler(xml
.sax
.handler
.ContentHandler
):
19 def startDocument(self
):
21 #include "ooxml/resourceids.hxx"
22 #include "ooxml/QNameToString.hxx"
24 namespace writerfilter
27 void QNameToString::init()
29 #ifdef DEBUG_WRITERFILTER
33 def endDocument(self
):
40 def startElement(self
, name
, attrs
):
41 for k
, v
in list(attrs
.items()):
43 if v
.startswith("ooxml:"):
44 token
= v
.replace('ooxml:', '')
45 if token
not in self
.tokens
:
46 print(""" mMap[NS_ooxml::LN_%s] = "ooxml:%s";""" % (token
, token
))
47 self
.tokens
.append(token
)
50 parser
= xml
.sax
.make_parser()
51 parser
.setContentHandler(ContentHandler())
52 parser
.parse(sys
.argv
[1])
54 # vim:set shiftwidth=4 softtabstop=4 expandtab: