6 this file is part of the project scolasync
8 Copyright (C) 2012 Georges Khaznadar <georgesk@ofset.org>
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 import xml.dom.minidom
38 if type(file)==type(
""):
41 file=open(file,
"r", encoding="iso-8859-1")
55 for el
in self.nullTexts.keys():
61 for e
in el.childNodes:
62 if e.nodeType==e.TEXT_NODE
and e.data.strip()==
"":
79 if el.nodeName.lower()==
"structure":
80 if el.getElementsByTagName(
"TYPE_STRUCTURE")[0].firstChild.data==
"D":
81 self.classes.add(el.getElementsByTagName(
"CODE_STRUCTURE")[0].firstChild.data)
94 for e
in el.childNodes:
98 return self.donnees.toprettyxml(indent=
" ",encoding=
"utf-8")
101 if __name__==
"__main__":
103 print (s.collectClasses())
def collectNullTexts(self, el)
def makeCompact(self)
removes useless thext nodes containing only spaces.
def __init__(self, file)
Le constructeur.
def collectOneClass(self, el)
Une classe pour travailler avec des données Sconet.
def elementsWalk(self, el, proc)
implemente un parcour des éléments d'un arbre, pour y appliquer une procédure