bug in url.e

Loïc Le Guyader <[email protected]> Thu, 14 Dec 2006 19:49:18 +0100
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Message-ID <[email protected]>
Hi,

It looks like it's only possible to open one url at a time !

The following try to parse on online xml file. If like this, it will
fail while it try to download the dtd. If you uncomment the two ios.read_line,
it will skip the xml header and the dtd declaration and everything goes fine.

Here is the complicated code to do test that:
class TESTXML

inherit
	XML_CALLBACKS

creation
	make

feature
	parser:XML_PARSER
	nb_node: INTEGER

	make is
		local
         	 	ios: INPUT_STREAM
			url: URL
		do
			create parser.make
		        create url.set_url("http://l.leguyader.free.fr/board/remote.xml")
			url.connect
			if url.is_connected then
	 			ios := url.input
				---- skip the xml header and dtd
				--ios.read_line
				--ios.read_line
				----
				load(ios)
				url.disconnect
				io.put_string("nb node: " + nb_node.to_string + "%N")
			end
		end

	load (stream: INPUT_STREAM) is
		do
			parser.connect_to(stream)
			parser.parse(Current)
		end

	open_node (node_name: STRING; line, column: INTEGER) is
		do
			nb_node := nb_node + 1
			current_node := node_name
		end
        
	current_node: STRING

	close_node (node_name: STRING; line, column: INTEGER) is
		do
		end

	open_close_node (node_name: STRING; line, column: INTEGER) is
                do
                        open_node(node_name, line, column)
                        close_node(node_name, line, column)
                end

	with_attribute (attribute_name, attribute_value: STRING; line, column: INTEGER) is
		do
		end

        data (a_data: STRING; line, column: INTEGER) is
		do
		end

	xml_header (line, column: INTEGER) is
		do
		end

	entity (a_entity: STRING; line, column: INTEGER): STRING is
		do
			Result := a_entity
		end

	at_error: BOOLEAN 

	parse_error(line, column: INTEGER) is
		do
			at_error := True
			io.put_string("Error in parsing%N")
		end
end


Cheers.

--