• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作業部屋の使い方を試しています。


Commit MetaInfo

Révision143 (tree)
l'heure2016-05-17 21:24:54
Auteurtuna_p

Message de Log

(empty log message)

Change Summary

Modification

--- branches/b4/webScraping/src/webScraping/core/AttributeDat.java (revision 142)
+++ branches/b4/webScraping/src/webScraping/core/AttributeDat.java (nonexistent)
@@ -1,164 +0,0 @@
1-/*
2- * Copyright (C) 2014 kgto.
3- *
4- * This library is free software; you can redistribute it and/or
5- * modify it under the terms of the GNU Lesser General Public
6- * License as published by the Free Software Foundation; either
7- * version 2.1 of the License, or (at your option) any later version.
8- *
9- * This library is distributed in the hope that it will be useful,
10- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12- * Lesser General Public License for more details.
13- *
14- * You should have received a copy of the GNU Lesser General Public
15- * License along with this library; if not, write to the Free Software
16- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17- * MA 02110-1301 USA
18- */
19-/*
20- * $Id: AttributeData.java 132 2015-03-31 02:44:57Z tuna_p $
21- */
22-
23-package webScraping.core;
24-
25-import java.util.ArrayList;
26-import java.util.Enumeration;
27-import javax.swing.text.MutableAttributeSet;
28-import javax.swing.text.html.HTML;
29-
30-/**
31- * HTMLタグの属性情報を保持する.
32- * @author kgto
33- */
34-public class AttributeDat {
35-
36- public AttributeDat() {
37- AttrList = new ArrayList();
38- size = 0;
39- }
40-
41- /**
42- * 属性情報追加.
43- * @param tag
44- * @param attr
45- */
46- public void add(HTML.Tag tag, MutableAttributeSet attr) {
47-
48- int tagcount = tagcnt(tag);
49- ++tagcount;
50-
51- Enumeration e = attr.getAttributeNames();
52- while(e.hasMoreElements()) {
53- Object obj = e.nextElement();
54-
55- AttrData a = new AttrData();
56- a.tag = tag;
57- a.count = tagcount;
58- a.attrname = obj.toString();
59- a.attrvalue = attr.getAttribute(obj).toString();
60-
61- AttrList.add(a);
62- size = AttrList.size();
63- }
64-
65- }
66-
67- /**
68- * 属性情報検索.
69- * @param tag
70- * @param attrname
71- * @param attrvalue
72- * @return
73- */
74- public boolean search(HTML.Tag tag, String attrname, String attrvalue) {
75- boolean ret = false;
76- for (Object AttrList1 : AttrList) {
77- AttrData a = (AttrData)AttrList1;
78- if(a.tag == tag) {
79- //if(a.attrname.equals(attrname) && a.attrvalue.equals(attrvalue)) {
80- if(a.attrname.equals(attrname) && a.attrvalue.startsWith(attrvalue)) {
81- ret = true;
82- }
83- }
84- }
85- return ret;
86- }
87-
88- public boolean searchId(HTML.Tag tag, String attrvalue) {
89- return search(tag, "id", attrvalue);
90- }
91-
92- public boolean searchClass(HTML.Tag tag, String attrvalue) {
93- return search(tag, "class", attrvalue);
94- }
95-
96- /**
97- * 属性の値を取得する.
98- * @param tag
99- * @param attrname
100- * @return
101- */
102- public ArrayList getvale(HTML.Tag tag, String attrname) {
103- ArrayList ret = new ArrayList();
104- for (Object AttrList1 : AttrList) {
105- AttrData a = (AttrData)AttrList1;
106- if(a.tag == tag) {
107- if(a.attrname.equals(attrname)) {
108- ret.add(a.attrvalue);
109- }
110- }
111- }
112- return ret;
113- }
114-
115- /**
116- * 引数で渡されたTAGの最新カウント数を返す.
117- * @param tag
118- * @return
119- */
120- private int tagcnt(HTML.Tag tag) {
121- int wkcnt = 0;
122- for (Object AttrList1 : AttrList) {
123- AttrData a = (AttrData)AttrList1;
124- if(a.tag == tag) {
125- if(wkcnt < a.count) {
126- wkcnt = a.count;
127- }
128- }
129- }
130- return wkcnt;
131- }
132-
133- // AttrList の内容を返すメソッド
134- public HTML.Tag gettag(int i) {
135- AttrData a = (AttrData)AttrList.get(i);
136- return a.tag;
137- }
138-
139- public int getcount(int i) {
140- AttrData a = (AttrData)AttrList.get(i);
141- return a.count;
142- }
143-
144- public String getattrname(int i) {
145- AttrData a = (AttrData)AttrList.get(i);
146- return a.attrname;
147- }
148-
149- public String getattrvalue(int i) {
150- AttrData a = (AttrData)AttrList.get(i);
151- return a.attrvalue;
152- }
153-
154- // フィールド変数
155- public class AttrData {
156- public HTML.Tag tag;
157- public int count;
158- public String attrname;
159- public String attrvalue;
160- }
161- public ArrayList AttrList;
162- public int size; // AttrListのサイズ
163-
164-}
--- branches/b4/webScraping/src/webScraping/core/DebugProcess.java (revision 142)
+++ branches/b4/webScraping/src/webScraping/core/DebugProcess.java (revision 143)
@@ -117,7 +117,7 @@
117117 // 属性情報
118118 if(attr != null) {
119119 if(attr.getAttributeCount() != 0) {
120- AttributeDat handleAttrData = new AttributeDat();
120+ AttributeData handleAttrData = new AttributeData();
121121 handleAttrData.add(tag, attr);
122122 for(int i = 0; i < handleAttrData.size; i++) {
123123 strBuf.append(" [");
--- branches/b4/webScraping/src/webScraping/core/AttributeData.java (nonexistent)
+++ branches/b4/webScraping/src/webScraping/core/AttributeData.java (revision 143)
@@ -0,0 +1,164 @@
1+/*
2+ * Copyright (C) 2014 kgto.
3+ *
4+ * This library is free software; you can redistribute it and/or
5+ * modify it under the terms of the GNU Lesser General Public
6+ * License as published by the Free Software Foundation; either
7+ * version 2.1 of the License, or (at your option) any later version.
8+ *
9+ * This library is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+ * Lesser General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU Lesser General Public
15+ * License along with this library; if not, write to the Free Software
16+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17+ * MA 02110-1301 USA
18+ */
19+/*
20+ * $Id: AttributeData.java 132 2015-03-31 02:44:57Z tuna_p $
21+ */
22+
23+package webScraping.core;
24+
25+import java.util.ArrayList;
26+import java.util.Enumeration;
27+import javax.swing.text.MutableAttributeSet;
28+import javax.swing.text.html.HTML;
29+
30+/**
31+ * HTMLタグの属性情報を保持する.
32+ * @author kgto
33+ */
34+public class AttributeData {
35+
36+ public AttributeData() {
37+ AttrList = new ArrayList();
38+ size = 0;
39+ }
40+
41+ /**
42+ * 属性情報追加.
43+ * @param tag
44+ * @param attr
45+ */
46+ public void add(HTML.Tag tag, MutableAttributeSet attr) {
47+
48+ int tagcount = tagcnt(tag);
49+ ++tagcount;
50+
51+ Enumeration e = attr.getAttributeNames();
52+ while(e.hasMoreElements()) {
53+ Object obj = e.nextElement();
54+
55+ AttrData a = new AttrData();
56+ a.tag = tag;
57+ a.count = tagcount;
58+ a.attrname = obj.toString();
59+ a.attrvalue = attr.getAttribute(obj).toString();
60+
61+ AttrList.add(a);
62+ size = AttrList.size();
63+ }
64+
65+ }
66+
67+ /**
68+ * 属性情報検索.
69+ * @param tag
70+ * @param attrname
71+ * @param attrvalue
72+ * @return
73+ */
74+ public boolean search(HTML.Tag tag, String attrname, String attrvalue) {
75+ boolean ret = false;
76+ for (Object AttrList1 : AttrList) {
77+ AttrData a = (AttrData)AttrList1;
78+ if(a.tag == tag) {
79+ //if(a.attrname.equals(attrname) && a.attrvalue.equals(attrvalue)) {
80+ if(a.attrname.equals(attrname) && a.attrvalue.startsWith(attrvalue)) {
81+ ret = true;
82+ }
83+ }
84+ }
85+ return ret;
86+ }
87+
88+ public boolean searchId(HTML.Tag tag, String attrvalue) {
89+ return search(tag, "id", attrvalue);
90+ }
91+
92+ public boolean searchClass(HTML.Tag tag, String attrvalue) {
93+ return search(tag, "class", attrvalue);
94+ }
95+
96+ /**
97+ * 属性の値を取得する.
98+ * @param tag
99+ * @param attrname
100+ * @return
101+ */
102+ public ArrayList getvale(HTML.Tag tag, String attrname) {
103+ ArrayList ret = new ArrayList();
104+ for (Object AttrList1 : AttrList) {
105+ AttrData a = (AttrData)AttrList1;
106+ if(a.tag == tag) {
107+ if(a.attrname.equals(attrname)) {
108+ ret.add(a.attrvalue);
109+ }
110+ }
111+ }
112+ return ret;
113+ }
114+
115+ /**
116+ * 引数で渡されたTAGの最新カウント数を返す.
117+ * @param tag
118+ * @return
119+ */
120+ private int tagcnt(HTML.Tag tag) {
121+ int wkcnt = 0;
122+ for (Object AttrList1 : AttrList) {
123+ AttrData a = (AttrData)AttrList1;
124+ if(a.tag == tag) {
125+ if(wkcnt < a.count) {
126+ wkcnt = a.count;
127+ }
128+ }
129+ }
130+ return wkcnt;
131+ }
132+
133+ // AttrList の内容を返すメソッド
134+ public HTML.Tag gettag(int i) {
135+ AttrData a = (AttrData)AttrList.get(i);
136+ return a.tag;
137+ }
138+
139+ public int getcount(int i) {
140+ AttrData a = (AttrData)AttrList.get(i);
141+ return a.count;
142+ }
143+
144+ public String getattrname(int i) {
145+ AttrData a = (AttrData)AttrList.get(i);
146+ return a.attrname;
147+ }
148+
149+ public String getattrvalue(int i) {
150+ AttrData a = (AttrData)AttrList.get(i);
151+ return a.attrvalue;
152+ }
153+
154+ // フィールド変数
155+ public class AttrData {
156+ public HTML.Tag tag;
157+ public int count;
158+ public String attrname;
159+ public String attrvalue;
160+ }
161+ public ArrayList AttrList;
162+ public int size; // AttrListのサイズ
163+
164+}
--- branches/b4/webScraping/src/webScraping/core/HtmlParserCallback.java (revision 142)
+++ branches/b4/webScraping/src/webScraping/core/HtmlParserCallback.java (revision 143)
@@ -54,7 +54,7 @@
5454 ArrayList sData;
5555
5656 // 属性データ
57- AttributeDat attrdata;
57+ AttributeData attrdata;
5858
5959 /* ---------------------------------------------------------------------- *
6060 * コンストラクタ
@@ -90,7 +90,7 @@
9090 tagMap.put(tag, count);
9191
9292 // 属性解析
93- AttributeDat handleStartattrdata = new AttributeDat();
93+ AttributeData handleStartattrdata = new AttributeData();
9494 handleStartattrdata.add(tag, attr);
9595
9696 DebugProcess.htmlinfo(tag, attr, "handleStartTag", count);
@@ -101,7 +101,7 @@
101101 if(serachAttribute(tag, handleStartattrdata)) {
102102 bufCount = count;
103103 bufTag = tag;
104- attrdata = new AttributeDat();
104+ attrdata = new AttributeData();
105105 bufText = new StringBuilder();
106106 }
107107 }
@@ -202,7 +202,7 @@
202202 * @param attrdata
203203 * @return boolean 検索キーと一致の時、true
204204 */
205- boolean serachAttribute(HTML.Tag tag, AttributeDat attrdata) {
205+ boolean serachAttribute(HTML.Tag tag, AttributeData attrdata) {
206206 // ID と CLASS の両方にキー入力有りの場合
207207 if(keyid.isEmpty() == false && keyclass.isEmpty() == false) {
208208 if(attrdata.searchId(tag, keyid) && attrdata.searchClass(tag, keyclass)) {