Robot Framework Integrated Development Environment (RIDE)
xmlwriter.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 from robotide.lib.robot.utils import XmlWriter, get_timestamp
17 
18 
20 
21  def write(self, libdoc, outfile):
22  writer = XmlWriter(outfile)
23  writer.start('keywordspec', {'name': libdoc.name, 'type': libdoc.type,
24  'format': libdoc.doc_format,
25  'generated': get_timestamp(millissep=None)})
26  writer.element('version', libdoc.version)
27  writer.element('scope', libdoc.scope)
28  writer.element('namedargs', 'yes' if libdoc.named_args else 'no')
29  writer.element('doc', libdoc.doc)
30  self._write_keywords_write_keywords('init', libdoc.inits, writer)
31  self._write_keywords_write_keywords('kw', libdoc.keywords, writer)
32  writer.end('keywordspec')
33  writer.close()
34 
35  def _write_keywords(self, type, keywords, writer):
36  for kw in keywords:
37  writer.start(type, {'name': kw.name} if type == 'kw' else {})
38  writer.start('arguments')
39  for arg in kw.args:
40  writer.element('arg', arg)
41  writer.end('arguments')
42  writer.element('doc', kw.doc)
43  writer.start('tags')
44  for tag in kw.tags:
45  writer.element('tag', tag)
46  writer.end('tags')
47  writer.end(type)
def _write_keywords(self, type, keywords, writer)
Definition: xmlwriter.py:35
def get_timestamp(daysep='', daytimesep=' ', timesep=':', millissep='.')
Definition: robottime.py:296