<span style="display:none"><menu type='ServerMenu' id="EE18_ViewSelectorMenu" CompactMode="true"><ie:menuitem id="EE19_DefaultView" type="option" onMenuClick="window.location = '/Lists/Promo 2015/1A.aspx';" text="1A" menuGroupId="100"></ie:menuitem><ie:menuitem id="EE20_View1" type="option" onMenuClick="window.location = '/Lists/Promo 2015/1ACPGEATS.aspx';" text="1A.CPGE-ATS" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE21_View2" type="option" onMenuClick="window.location = '/Lists/Promo 2015/1ADUTGE.aspx';" text="1A.DUT-GE" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE22_View3" type="option" onMenuClick="window.location = '/Lists/Promo 2015/1ADUTGI.aspx';" text="1A.DUT-GI" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE23_View4" type="option" onMenuClick="window.location = '/Lists/Promo 2015/2A.aspx';" text="2A" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE24_View5" type="option" onMenuClick="window.location = '/Lists/Promo 2015/2AVaASR.aspx';" text="2A.Va.ASR" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE25_View6" type="option" onMenuClick="window.location = '/Lists/Promo 2015/2AVaMSE.aspx';" text="2A.Va.MSE" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE26_View7" type="option" onMenuClick="window.location = '/Lists/Promo 2015/2AVaTSI.aspx';" text="2A.Va.TSI" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE27_View8" type="option" onMenuClick="window.location = '/Lists/Promo 2015/3A.aspx';" text="3A" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE28_View9" type="option" onMenuClick="window.location = '/Lists/Promo 2015/3ADADc_Cloud.aspx';" text="3A.DA.Dc_Cloud" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE29_View10" type="option" onMenuClick="window.location = '/Lists/Promo 2015/3ADAScurit.aspx';" text="3A.DA.Sécurité" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE30_View11" type="option" onMenuClick="window.location = '/Lists/Promo 2015/3ADASI_Cloud.aspx';" text="3A.DA.SI_Cloud" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE31_View12" type="option" onMenuClick="window.location = '/Lists/Promo 2015/3ADASI_Sante.aspx';" text="3A.DA.SI_Santé" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE32_View13" type="option" onMenuClick="window.location = '/Lists/Promo 2015/3ADATransport.aspx';" text="3A.DA.Transport" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE33_View14" type="option" onMenuClick="window.location = '/Lists/Promo 2015/calendar.aspx';" text="Calendrier" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE34_View15" type="option" onMenuClick="window.location = '/Lists/Promo 2015/MyItems.aspx';" text="Événements actuels" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE35_View16" type="option" onMenuClick="window.location = '/Lists/Promo 2015/Export.aspx';" text="Export" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE36_View17" type="option" onMenuClick="window.location = '/Lists/Promo 2015/RssView1.aspx';" text="RssView" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE37_View18" type="option" onMenuClick="window.location = '/Lists/Promo 2015/Salles.aspx';" text="Salles" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE38_View19" type="option" onMenuClick="window.location = '/Lists/Promo 2015/AllItems.aspx';" text="Tous les événements" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE39_View20" type="option" onMenuClick="window.location = '/Lists/Promo 2015/Video.aspx';" text="Video" menuGroupId="300"></ie:menuitem><ie:menuitem id="EE40_CreateView" type="option" iconSrc="/_layouts/images/createview.gif" onMenuClick="window.location = '/_layouts/ViewType.aspx?';" text="Créer un affichage" menuGroupId="400"></ie:menuitem></menu></span>
我怎样才能获得所有信息以&#34; onMenuClick =&#34; window.location&#34; ?
我使用此代码&#34; Elements links3 = doc.select(&#34; menu [id = zz18_ViewSelectorMenu]&#34;);&#34;进入菜单,但我无法进入menuitem。
答案 0 :(得分:1)
使用Jsoup库for android JSOUP
try {
if (SDK_INT >= 10) {
ThreadPolicy tp = ThreadPolicy.LAX;
StrictMode.setThreadPolicy(tp);
}
Document doc = Jsoup
.parse("<span style=\"display:none\"><menu type='ServerMenu' id=\"zz18_ViewSelectorMenu\" CompactMode=\"true\"><ie:menuitem id=\"zz19_DefaultView\" type=\"option\" onMenuClick=\"window.location = '/etudes/Portal/edt/Lists/Promo 2015/1A.aspx';\" text=\"1A\" menuGroupId=\"100\"></ie:menuitem>");
String requiredaspxpage = doc.select("menu#zz18_ViewSelectorMenu")
.get(0).children().get(0).attr("onMenuClick");
} catch (Exception ex) {
ex.printStackTrace();
}