Example #1
0
 def test_entities(self):
     # test that a paragraph can have a "&"
     # TODO: write a proper test
     self.failUnless(parse_string(file("entities.rml", 'r').read()))
Example #2
0
        return help()

    input_filename = args[0]
    output_filename = args[1]

    if not os.path.exists(input_filename):
        print 'input file does not exist'
        sys.exit(0)

    input_file = None
    try:
        input_file = open(input_filename, 'r')
        input_data = input_file.read()
    except IOError, e:
        print 'failed to open input file %s' % input_filename
        sys.exit(0)
    finally:
        if input_file:
            input_file.close()

    try:
        write_to_output(output_filename,
                        parse_string(input_data, encoding=options.encoding))
    except ParserError, e:
        print 'parsing rml failed with the following error'
        print e


if __name__ == "__main__":
    main()
Example #3
0
    if len(args) < 2:
        return help()

    input_filename = args[0]
    output_filename = args[1]

    if not os.path.exists(input_filename):
        print 'input file does not exist'
        sys.exit(0)

    input_file = None
    try:
        input_file = open(input_filename, 'r')
        input_data = input_file.read()
    except IOError, e:
        print 'failed to open input file %s' % input_filename
        sys.exit(0)
    finally:
        if input_file:
            input_file.close()

    try:
        write_to_output(output_filename, parse_string(input_data, encoding=options.encoding))
    except ParserError, e:
        print 'parsing rml failed with the following error'
        print e


if __name__ == "__main__":
    main()
Example #4
0
    if len(args) < 2:
        return help()

    input_filename = args[0]
    output_filename = args[1]

    if not os.path.exists(input_filename):
        print 'input file does not exist'
        sys.exit(0)

    input_file = None
    try:
        input_file = open(input_filename, 'r')
        input_data = input_file.read()
    except IOError, e:
        print 'failed to open input file %s' % input_filename
        sys.exit(0)
    finally:
        if input_file:
            input_file.close()

    try:
        write_to_output(output_filename, parse_string(input_data))
    except ParserError, e:
        print 'parsing rml failed with the following error'
        print e


if __name__ == "__main__":
    main()
Example #5
0
 def test_entities(self):
     # test that a paragraph can have a "&amp;"
     # TODO: write a proper test
     self.failUnless(parse_string(file("entities.rml", 'r').read()))