Re: malformed URL exception exception in saxbuilder.build due to unreachable URL

Rolf Lear <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
Hi Cliff.

That would be a mystery, but my suspicion is that it has not worked at
all... if it *did* work then there are other problems ... ;-)

I suspect that everything has been failing - maybe the first record from
the database had an xmlns, and it has been a red-herring for you.

I did run some test code through, and it causes similar errors regardless
of the actual XML content.

I wonder if it would help if we put a validation process in the
SAXBuilder.build(String) method that inspected the string, and if the first
non-white character is '<' it throws an exception.... that should catch all
instances where XML content is supplied to the method, since '<' is never
valid in a URI..... and it is always the first character in any valid XML
document.....

getting an exception:  MalformedURLException: "SAXBuilder.build(String)
expects a String URI not XML Content" would be a whole lot easier to manage
than the exception you have....

Rolf

On Fri, 10 Feb 2012 07:35:43 -0500, cliff palmer <[email protected]>
wrote:
> Rolf, that worked - it's mysterious that the version in my code
> (passing the string) worked until there was a URL, but I can live with
> mysteries in light of working code :).
> Thanks!
> Cliff
> 
> On Thu, Feb 9, 2012 at 6:44 PM, Rolf Lear <[email protected]> wrote:
>> Hi Cliff.
>>
>> I think the problem is that the content of the column 'xml_contents' of
>> the
>> table 'xml_table' is actual XML data.... not a file name/URI.
>>
>>
>> I think what you want to do is:
>>
>>    String xmlcontent = rs.getString(2);
>>    StringReader reader = new StringReader(xmlcontent);
>>    xmlDoc = saxBuilder.build(reader);
>>
>> See http://jdom.org/docs/faq.html#a0210
>>
>> Rolf
>>

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.