it's me again.=.=
In my small opinion,may be
I will try.....
step1:identify the tag's name is 'a'
step2:check the attribute of "href";and assign the attribute value to a variable(attributehref)
step3:comparison between attributehref and
(1)null
(2)http://www.yzu.edu.tw
(3)http://
Does it make sense?...@@.
Any positive suggestion is welcome.Did I miss something important?.....@@.
thank you
May goodness be with you all
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
it's me again.=.=
sorry....it doesn't work well.
I will try another way.
step1:identify the tag's name is 'a'
step2:check the attribute of "href";and assign the attribute value to a variable(attributehref)
step3:comparison between attributehref and
it's me again.=.=
The following way is ok.=.=
----------------------------------------------------------------------------------------------------
code
----------------------------------------------------------------------------------------------------
if(tag instanceof LinkTag){
else if(LinkTagsrc.startsWith("http")){
tag.setAttribute("href",tag.getAttribute("href"));
}
else{
tag.setAttribute("href","http://www.yzu.edu.tw"+tag.getAttribute("href"));
}
}
----------------------------------------------------------------------------------------------------
code
----------------------------------------------------------------------------------------------------
thank you for your patient reply and instructions.^^
thank you
May goodness be with you all
----------------------------------------------------------------------------------------------------
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
regards:
it's me again.=.=
substitute relative href into absolute href.
followings is my design codes.
----------------------------------------------------------------------------------------------------
code
----------------------------------------------------------------------------------------------------
if(tag instanceof LinkTag){
String LinkTagsrc=((LinkTag)tag).getLinkText();
if(LinkTagsrc.startsWith("null")){
tag.setAttribute("href",tag.getAttribute("href"));
}
else if(LinkTagsrc.startsWith("http://www.yzu.edu.tw")){
tag.setAttribute("href",tag.getAttribute("href"));
}
else if(LinkTagsrc.startsWith("http")){
tag.setAttribute("href",tag.getAttribute("href"));
}
else{
tag.setAttribute("href","http://www.yzu.edu.tw"+tag.getAttribute("href"));
----------------------------------------------------------------------------------------------------
code
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
unexpected output
----------------------------------------------------------------------------------------------------
<p>
<a href="http://www.yzu.edu.tw/bb/email.htm?PHPSESSID=edb89fb07665da94de90524c7dc93ba5">電子郵件</a><br>
<a href="http://www.yzu.edu.twhttp://isdna1.yzu.edu.tw/Cnstdsel/default.aspx" target="_blank">選課系統</a>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
</p>
----------------------------------------------------------------------------------------------------
"^^^^^^^^" part is unexpected output.
Any positive suggestion is welcome.Did I miss something important?.....@@.
thank you
May goodness be with you all
sorry...topic should be
=.=
substitute relative href with absolute href.
thank you
May goodness be with you all
regards:
<a href="http://www.yzu.edu.twhttp://isdna1.yzu.edu.tw/.....omitted.....
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
</p>
"^^^^^^^^"
part is unexpected output.
I think it should be
<href="http://isdna1.yzu.edu.tw/Cnstdsel/default.aspx" target="_blank">
I want to check that if attribute of a href tag is a absolute hyperlink or "null",
then make no changes.
if attribute of a href tag is a relative hyperlink,
then add a String "http://www.yzu.edu.tw" ahead of the relative hyperlink.
Did I miss something important?.....@@.
Any positive suggestion is welcome.
thank you
May goodness be with you all
getLinkText() is used to get the contents of the link, i.e. between <a> and </a>, not the URL. You probably want getLink().
regards:
it's me again.=.=
In my small opinion,may be
I will try.....
step1:identify the tag's name is 'a'
step2:check the attribute of "href";and assign the attribute value to a variable(attributehref)
step3:comparison between attributehref and
(1)null
(2)http://www.yzu.edu.tw
(3)http://
Does it make sense?...@@.
Any positive suggestion is welcome.Did I miss something important?.....@@.
thank you
May goodness be with you all
regards:
it's me again.=.=
sorry....it doesn't work well.
I will try another way.
step1:identify the tag's name is 'a'
step2:check the attribute of "href";and assign the attribute value to a variable(attributehref)
step3:comparison between attributehref and
(1)null
(2)http://www.yzu.edu.tw
(3)http://
----------------------------------------------------------------------------------------------------
thank you for your patient reply and instructions.^^
thank you
May goodness be with you all
----------------------------------------------------------------------------------------------------
regards:
dear Derrick Oswald
it's me again.=.=
The following way is ok.=.=
----------------------------------------------------------------------------------------------------
code
----------------------------------------------------------------------------------------------------
if(tag instanceof LinkTag){
String LinkTagsrc=tag.getAttribute("href");
// ((LinkTag)tag).getLinkText();
if(LinkTagsrc.startsWith("null")){
tag.setAttribute("href",tag.getAttribute("href"));
}
else if(LinkTagsrc.startsWith("http://www.yzu.edu.tw")){
tag.setAttribute("href",tag.getAttribute("href"));
}
else if(LinkTagsrc.startsWith("http")){
tag.setAttribute("href",tag.getAttribute("href"));
}
else{
tag.setAttribute("href","http://www.yzu.edu.tw"+tag.getAttribute("href"));
}
}
----------------------------------------------------------------------------------------------------
code
----------------------------------------------------------------------------------------------------
thank you for your patient reply and instructions.^^
thank you
May goodness be with you all
----------------------------------------------------------------------------------------------------