Esempio n. 1
0
    def publication(self, publication_id):
        """Creates an instance of myanimelist.Publication with the given ID.

        :type publication_id: int
        :param publication_id: The desired publication's ID.

        :rtype: :class:`myanimelist.publication.Publication`
        :return: A new Publication instance with the given ID.

        """
        return publication.Publication(self, publication_id)
Esempio n. 2
0
import json
from xml.dom import pulldom
import publication

main_nodes = ["article", "inproceedings", "incollection"]

if __name__ == "__main__":

    doc = pulldom.parse('dblp.xml')

    with open('parse_xml.json', 'w') as f:

        for event, node in doc:
            if event == pulldom.START_ELEMENT and node.tagName in main_nodes:
                doc.expandNode(node)
                pb = publication.Publication(node)
                pb.exec_node()

                f.write(json.dumps(pb.serialize()) + ' \n')
    f.close()