exception when parsing xml file content using DOM Parser

When i parse a String which contains xml file content using dom parser , jdk 5.0 throws java.net.MalformedURLException: no protocol: <?xml version='1.0(my xml content). .can anyone help me
[206 byte] By [JavaHeroPrincea] at [2007-11-27 6:09:12]
# 1
> <?xml version='1.0(my xml content). .Well, the above line doesn't look very xml-ish to me ... so how about you fix that?
thomas.behra at 2007-7-12 17:12:42 > top of Java-index,Java Essentials,Java Programming...
# 2
just for comment i typed lik that. (my xml file) is my valid xml file. imy xml file word is not in my file. just for short i typed lik that ;)
JavaHeroPrincea at 2007-7-12 17:12:42 > top of Java-index,Java Essentials,Java Programming...
# 3
Here's how to parse an xml file using w3c, which is now a part of the JREDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();DocumentBuilder builder = factory.newDocumentBuilder();Document document = builder.parse(f);
tjacobs01a at 2007-7-12 17:12:42 > top of Java-index,Java Essentials,Java Programming...
# 4
> just for comment i typed lik that. (my xml file) is> my valid xml file. imy xml file word is not in my> file. just for short i typed lik that ;)How about you show us the actual xml then. It's kinda hard to figure out the problem otherwise.
hunter9000a at 2007-7-12 17:12:42 > top of Java-index,Java Essentials,Java Programming...
# 5
actually i have the xml content in a string instance. so i can directly parse the string as the argument to parse method.:)
JavaHeroPrincea at 2007-7-12 17:12:42 > top of Java-index,Java Essentials,Java Programming...
# 6

this is the exception hero,

java.net.MalformedURLException: no protocol: <?xml version='1.0' encoding='ISO-8859-1' ?><autnresponse xmlns:autn='http://schemas.autonomy.com/aci/'><action>QUERY</action><response>SUCCESS</response><responsedata><autn:numhits>10</autn:numhits><autn:totalhits>48</autn:totalhits><autn:hit><autn:reference>6196</autn:reference><autn:id>6298</autn:id><autn:section>0</autn:section><autn:weight>95.20</autn:weight><autn:links>CLEAR</autn:links><autn:database>sprint</autn:database><autn:title>Master Clear / Reset All</autn:title><autn:summary>What is It: Not to be confused with Master Reset, Master Clear erases all user-entered information stored in a Nextel phone's memory, including phonebook and datebook entries. In some Falcon (3-digit series) phones this feature is called 'Reset All.' </autn:summary><autn:content><DRE-DOCUMENT><SECTION>0</SECTION><DOCUMENTID>6196</DOCUMENTID></DRE-DOCUMENT></autn:content></autn:hit><autn:hit><autn:reference>5939</autn:reference><autn:id>6181</autn:id><autn:section>0</autn:section><autn:weight>95.20</autn:weight><autn:links>CLEAR</autn:links><autn:database>sprint</autn:database><autn:title>BlackBerry Web Browsing (WSSC)</autn:title><autn:summary>What is it: Web browsing on BlackBerry devices. Important: Only customers who purchase BlackBerry Enterprise Server (BES) receive BlackBerry browser. This document includes: Set Browser Configuration </autn:summary><autn:content><DRE-DOCUMENT><SECTION>0</SECTION><DOCUMENTID>5939</DOCUMENTID></DRE-DOCUMENT></autn:content></autn:hit><autn:hit><autn:reference>5899</autn:reference><autn:id>6183</autn:id><autn:section>0</autn:section><autn:weight>93.56</autn:weight><autn:links>CLEAR</autn:links><autn:database>sprint</autn:database><autn:title>BlackBerry Web Browsing (SS)</autn:title><autn:summary>What is It: Steps for managing and using the Web browsing features and options of the BlackBerry 6510 and BlackBerry 7510 from Nextel (BlackBerry). Availability: All markets, all BlackBerry customers Details: </autn:summary><autn:content><DRE-DOCUMENT><SECTION>0</SECTION><DOCUMENTID>5899</DOCUMENTID></DRE-DOCUMENT></autn:content></autn:hit><autn:hit><autn:reference>3671</autn:reference><autn:id>14617</autn:id><autn:section>0</autn:section><autn:weight>87.13</autn:weight><autn:links>CLEAR</autn:links><autn:database>sprint</autn:database><autn:title>How do I clear cookies on my phone?</autn:title><autn:summary>To clear cookies on your phone, perform the following steps: Launch the mini browser. From Standby mode, press OK . Scroll to and select Web , and then press OK . If the Web Guard appears, select Connect and press OK . From the </autn:summary><autn:content><DRE-DOCUMENT><SECTION>0</SECTION><DOCUMENTID>3671</DOCUMENTID></DRE-DOCUMENT></autn:content></autn:hit><autn:hit><autn:reference>3645</autn:reference><autn:id>14612</autn:id><autn:section>0</autn:section><autn:weight>87.13</autn:weight><autn:links>CLEAR</autn:links><autn:database>sprint</autn:database><autn:title>How do I clear the voicemail icon?</autn:title><autn:summary>To clear the voicemail icon, perform the following steps: Note : Your phone may temporarily continue to display the icon after you have checked your voicemail messages. Press Menu (left softkey). Using the down navigational arrow scroll down an </autn:summary><autn:content><DRE-DOCUMENT><SECTION>0</SECTION><DOCUMENTID>3645</DOCUMENTID></DRE-DOCUMENT></autn:content></autn:hit><autn:hit><autn:reference>4951</autn:reference><autn:id>6973</autn:id><autn:section>0</autn:section><autn:weight>87.13</autn:weight><autn:links>CLEAR</autn:links><autn:database>sprint</autn:database><autn:title>What happens if someone sends me a Call Alert?</autn:title><autn:summary>When you receive a Call Alert, your phone will emit an intermittent chirp and will display the Nextel Walkie-Talkie number or caller's name (if stored). You can either answer, queue, or clear the Call Alert. To answer the Call Alert, pres </autn:summary><autn:content><DRE-DOCUMENT><SECTION>0</SECTION><DOCUMENTID>4951</DOCUMENTID></DRE-DOCUMENT></autn:content></autn:hit><autn:hit><autn:reference>5996</autn:reference><autn:id>6582</autn:id><autn:section>0</autn:section><autn:weight>87.13</autn:weight><autn:links>CLEAR</autn:links><autn:database>sprint</autn:database><autn:title>How do I use Direct Send?</autn:title><autn:summary>For information on using Direct Send, refer to the following links: Text options Setting sending options To set sending options, select from the following links: </autn:summary><autn:content><DRE-DOCUMENT><SECTION>0</SECTION><DOCUMENTID>5996</DOCUMENTID></DRE-DOCUMENT></autn:content></autn:hit><autn:hit><autn:reference>5587</autn:reference><autn:id>2546</autn:id><autn:section>0</autn:section><autn:weight>87.13</autn:weight><autn:links>CLEAR</autn:links><autn:database>sprint</autn:database><autn:title>How do I delete files and clear history in my Internet Explorer browser?</autn:title><autn:summary>To delete files and clear history in your Internet Explorer browser, perform the following steps: 1 From the Start menu, tap Internet Explorer . Image of the Sprint PPC6601, showing the Start menu, highlighting Internet Explorer. </autn:summary><autn:content><DRE-DOCUMENT><SECTION>0</SECTION><DOCUMENTID>5587</DOCUMENTID></DRE-DOCUMENT></autn:content></autn:hit><autn:hit><autn:reference>3816</autn:reference><autn:id>14542</autn:id><autn:section>0</autn:section><autn:weight>85.49</autn:weight><autn:links>CLEAR</autn:links><autn:database>sprint</autn:database><autn:title>How do I clear cookies on my phone?</autn:title><autn:summary>Cookies are files that are placed and used by a web site to perform various functions such as identifying users or storing passwords. To clear cookies on your phone, perform the following steps: Launch the MiniBrowser. Press the Web key (may require </autn:summary><autn:content><DRE-DOCUMENT><SECTION>0</SECTION><DOCUMENTID>3816</DOCUMENTID></DRE-DOCUMENT></autn:content></autn:hit><autn:hit><autn:reference>3599</autn:reference><autn:id>14491</autn:id><autn:section>0</autn:section><autn:weight>85.49</autn:weight><autn:links>CLEAR</autn:links><autn:database>sprint</autn:database><autn:title>What can I do if I recieve the message "Error C1" or "Error C2" while uploading or sharing a photo?</autn:title><autn:summary>If you receive the message "Error C1" or "Error C2" while uploading or sharing a photo, retry the function. If after multiple attempts the errors continue, you will need to clear the token. To clear the token, perform the following steps: From the </autn:summary><autn:content><DRE-DOCUMENT><SECTION>0</SECTION><DOCUMENTID>3599</DOCUMENTID></DRE-DOCUMENT></autn:content></autn:hit></responsedata></autnresponse>

JavaHeroPrincea at 2007-7-12 17:12:42 > top of Java-index,Java Essentials,Java Programming...
# 7
fair enough. The code I posted should work for parsing a valid xml file though
tjacobs01a at 2007-7-12 17:12:42 > top of Java-index,Java Essentials,Java Programming...
# 8

> actually i have the xml content in a string instance.

> so i can directly parse the string as the argument to

> parse method.:)

You can parse a String with DocumentBuilder:

db.parse(new InputSource(new StringReader(theXmlString)));

hunter9000a at 2007-7-12 17:12:42 > top of Java-index,Java Essentials,Java Programming...
# 9
Are you sure you're not opening the file and passing the parser the XML text, when it's expecting the filename of the XML file?
kevjavaa at 2007-7-12 17:12:42 > top of Java-index,Java Essentials,Java Programming...