[ htmlunit-Bugs-1496491 ] XMLPage is not namespace awared

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ htmlunit-Bugs-1496491 ] XMLPage is not namespace awared

SourceForge.net
Bugs item #1496491, was opened at 2006-05-28 19:53
Message generated for change (Comment added) made by mguillem
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1496491&group_id=47038

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: 1.8
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: maomao (maomaode)
>Assigned to: Marc Guillemot (mguillem)
Summary: XMLPage is not namespace awared

Initial Comment:
method buildDocument() in class
com.gargoylesoftware.htmlunit.xml.XmlUtil
has the following problem:
1. It might not be encoding-friedly, the following
usage :new InputSource(new
StringReader(webResponse.getContentAsString()));
might cause junk character if the host encoding is
different from the xml encoding.
  SUGGESTION: use webResponse.getContentAsStream()
insteadof getContentAsString()

2. The return Document is not namespace awared.
   SUGGESTION: add factory.setNamespaceAware(true)

----------------------------------------------------------------------

>Comment By: Marc Guillemot (mguillem)
Date: 2006-09-17 22:06

Message:
Logged In: YES
user_id=402164

According to Jaxen FAQ, you have to configure yourself the
namespace on the XPath object:
http://jaxen.org/faq.html#How_do_I_write_a_query_for_namespace_qualified_elements_attributes_in_Jaxen_

----------------------------------------------------------------------

Comment By: maomao (maomaode)
Date: 2006-05-31 04:54

Message:
Logged In: YES
user_id=1048358

I think it's just the quiest way to fix the problem. And you
can't ask user to do anything for you. To write a unit test
with the testcase i provide and alone with the comments i
made before, is not a big challenge.

Anyway, i like htmlunit, and i want imporve the quality of
the project, as you can see, i use "suggestion" in the
comment, since you also a programmer, it's easy for you to
evaluate if the "sugguestions" are right or wrong simply
through reading the code.

There are no needs to reply the comment, and i'm also off
the thread, it's just waste our time.

Thanks for your understanding.

----------------------------------------------------------------------

Comment By: Marc Guillemot (mguillem)
Date: 2006-05-30 15:18

Message:
Logged In: YES
user_id=402164

I don't see why you need commit rights at all (which you
surely won't become this way) and absolutely don't see why
it would take more time.

A committer could surely take your explaination to write a
unit test. Nevertheless in this case the probability to see
the problem quickly fixed is really smaller than if the
committer can spend all their available time on fixing the
problem (or just applying a patch having the right quality).

----------------------------------------------------------------------

Comment By: maomao (maomaode)
Date: 2006-05-30 05:26

Message:
Logged In: YES
user_id=1048358

Yes, i can provide a unit test for the snag as long as i
have the commit rights, otherwise it will take too much
time. and i think the testcase which i gave is quit enough
for the commiter to add a unit test. i tried with the fix,
it do solve the problem.

Cheers,
James.

----------------------------------------------------------------------

Comment By: Marc Guillemot (mguillem)
Date: 2006-05-29 19:43

Message:
Logged In: YES
user_id=402164

Isn't it obvious, that a obvious problems should have a unit
test? ;-)

factory.setNamespaceAware(true) is now used (in CVS) but
it isn't enough to make your xpath working (it solves other
problems). I suppose that jaxen needs to be informed of
namespaces.

----------------------------------------------------------------------

Comment By: maomao (maomaode)
Date: 2006-05-29 12:38

Message:
Logged In: YES
user_id=1048358

Try the attached rss feed file with the xpath expression
bellow: /rss/channel/sns:index/sns:text/text(). you got null.
to fix this problem, you need add
factory.setNamespaceAware(true) in the method
com.gargoylesoftware.htmlunit.xml.XmlUtil.buildDocument().

I think the problem is obvious ;)

----------------------------------------------------------------------

Comment By: Marc Guillemot (mguillem)
Date: 2006-05-29 09:10

Message:
Logged In: YES
user_id=402164

ok for the 2 points. To avoid reintroducting the problem,
can you provide tests illustrating the current wrong handling?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1496491&group_id=47038

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop