• 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

Revision102 (tree)
Time2014-12-07 19:28:43
Authortuna_p

Log Message

trunk/HtmlTest2 → b3/WebScraping

Change Summary

Incremental Difference

--- branches/b3/WebScraping/src/Form/SearchDataRW.java (nonexistent)
+++ branches/b3/WebScraping/src/Form/SearchDataRW.java (revision 102)
@@ -0,0 +1,508 @@
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$
21+ */
22+
23+package Form;
24+
25+import WebScraping.SearchData;
26+import java.io.BufferedReader;
27+import java.io.BufferedWriter;
28+import java.io.File;
29+import java.io.FileInputStream;
30+import java.io.FileNotFoundException;
31+import java.io.FileOutputStream;
32+import java.io.IOException;
33+import java.io.InputStreamReader;
34+import java.io.OutputStreamWriter;
35+import java.util.ArrayList;
36+import java.util.logging.Level;
37+import java.util.logging.Logger;
38+import javax.xml.parsers.DocumentBuilder;
39+import javax.xml.parsers.DocumentBuilderFactory;
40+import javax.xml.parsers.ParserConfigurationException;
41+import javax.xml.transform.Transformer;
42+import javax.xml.transform.TransformerConfigurationException;
43+import javax.xml.transform.TransformerException;
44+import javax.xml.transform.TransformerFactory;
45+import javax.xml.transform.dom.DOMSource;
46+import javax.xml.transform.stream.StreamResult;
47+import org.w3c.dom.DOMImplementation;
48+import org.w3c.dom.Document;
49+import org.w3c.dom.Element;
50+import org.w3c.dom.Node;
51+import org.w3c.dom.NodeList;
52+import org.xml.sax.SAXException;
53+
54+/**
55+ *
56+ * @author kgto
57+ */
58+public class SearchDataRW {
59+
60+ DocumentBuilder builder;
61+ public Document document;
62+ Element root;
63+
64+ private final String splitchar = "\t";
65+
66+ private String UrlAdress;
67+ private ArrayList slist;
68+
69+ public SearchDataRW() {
70+ try {
71+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
72+ builder = factory.newDocumentBuilder();
73+
74+ } catch (ParserConfigurationException ex) {
75+ Logger.getLogger(SearchDataRW.class.getName()).log(Level.SEVERE, null, ex);
76+ }
77+ }
78+
79+ public void seturl(String UrlAdress) {
80+ this.UrlAdress = UrlAdress;
81+ }
82+
83+ public void setslist(ArrayList slist) {
84+ this.slist = slist;
85+ }
86+
87+ public String geturl() {
88+ return UrlAdress;
89+ }
90+
91+ public ArrayList getslist() {
92+ return slist;
93+ }
94+
95+ /**
96+ * 保存.
97+ * @param file
98+ */
99+ public void save(File file) {
100+ //saveCsv(file);
101+ //saveXml(file);
102+
103+ saveUrl(UrlAdress);
104+ saveSearchList(slist);
105+ write(file);
106+ }
107+
108+ /**
109+ * 読込.
110+ * @param file
111+ */
112+ public void load(File file) {
113+ //loadCsv(file);
114+ //loadXml(file);
115+
116+ read(file);
117+ UrlAdress = loadUrl();
118+ slist = loadSearchList();
119+ }
120+
121+ /* ---------------------------------------------------------------------- */
122+ /**
123+ * 保存(CSV形式).
124+ * @param file
125+ */
126+ public void saveCsv(File file) {
127+
128+ try {
129+ //空のファイルを作成
130+ file.createNewFile();
131+
132+ FileOutputStream fileoutputstream = new FileOutputStream(file);
133+ OutputStreamWriter outputstreamwriter = new OutputStreamWriter(fileoutputstream, "UTF-8");
134+ BufferedWriter bufferedwriter = new BufferedWriter(outputstreamwriter);
135+
136+ // URL
137+ bufferedwriter.write(UrlAdress);
138+ bufferedwriter.write("\n");
139+ // 検索情報
140+ for (Object slist1 : slist) {
141+ SearchData sdat = (SearchData) slist1;
142+ StringBuilder str = new StringBuilder();
143+ str.append(sdat.getitem()).append(splitchar);
144+ str.append(sdat.getHtmltag()).append(splitchar);
145+ str.append(sdat.getHtmlid()).append(splitchar);
146+ str.append(sdat.getHtmlclass()).append(splitchar);
147+ str.append(sdat.getaround()).append(splitchar);
148+ str.append(sdat.getregexp()).append("\n");
149+
150+ bufferedwriter.write(str.toString());
151+ }
152+ bufferedwriter.close();
153+
154+ } catch(IOException ex) {
155+ Logger.getLogger(SearchDataRW.class.getName()).log(Level.SEVERE, null, ex);
156+ }
157+ }
158+
159+ /**
160+ * 読込(CSV形式).
161+ * @param file
162+ */
163+ public void loadCsv(File file) {
164+ slist = new ArrayList();
165+
166+ try {
167+ FileInputStream fileinputstream = new FileInputStream(file);
168+ InputStreamReader inputstreamreader = new InputStreamReader(fileinputstream, "UTF-8");
169+ BufferedReader bufferedreader = new BufferedReader(inputstreamreader);
170+
171+ String rec;
172+
173+ // URL
174+ UrlAdress = bufferedreader.readLine();
175+ // 検索情報
176+ while((rec = bufferedreader.readLine()) != null) {
177+ String[] recary = rec.split(splitchar, -1);
178+ SearchData sdat = new SearchData();
179+ sdat.setitem(recary[0]);
180+ sdat.setHtmltag(recary[1]);
181+ sdat.setHtmlid(recary[2]);
182+ sdat.setHtmlclass(recary[3]);
183+ sdat.setaround(recary[4]);
184+ sdat.setregexp(recary[5]);
185+
186+ slist.add(sdat);
187+ }
188+ bufferedreader.close();
189+
190+ } catch(IOException ex) {
191+ Logger.getLogger(SearchDataRW.class.getName()).log(Level.SEVERE, null, ex);
192+ }
193+
194+ }
195+
196+ /* ---------------------------------------------------------------------- */
197+ /**
198+ * 保存(XML形式).
199+ * @param file
200+ */
201+ public void saveXml(File file) {
202+ try {
203+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
204+ DocumentBuilder builder = factory.newDocumentBuilder();
205+ DOMImplementation domImpl = builder.getDOMImplementation();
206+
207+ Document document = domImpl.createDocument("","searchdata",null);
208+ Element root = document.getDocumentElement();
209+
210+ // URL
211+ Element url = document.createElement("url");
212+ url.appendChild(document.createTextNode(UrlAdress));
213+ root.appendChild(url);
214+
215+ // 検索情報
216+ for (Object slist1 : slist) {
217+ SearchData sdat = (SearchData) slist1;
218+
219+ Element cslist = document.createElement("searchlist");
220+ Element item = document.createElement("item");
221+ Element htmltag = document.createElement("htmltag");
222+ Element htmlid = document.createElement("htmlid");
223+ Element htmlclass = document.createElement("htmlclass");
224+ Element around = document.createElement("around");
225+ Element regexp = document.createElement("regexp");
226+
227+ item.appendChild(document.createTextNode(sdat.getitem()));
228+ htmltag.appendChild(document.createTextNode(sdat.getHtmltag()));
229+ htmlid.appendChild(document.createTextNode(sdat.getHtmlid()));
230+ htmlclass.appendChild(document.createTextNode(sdat.getHtmlclass()));
231+ around.appendChild(document.createTextNode(sdat.getaround()));
232+ regexp.appendChild(document.createTextNode(sdat.getregexp()));
233+
234+ cslist.appendChild(item);
235+ cslist.appendChild(htmltag);
236+ cslist.appendChild(htmlid);
237+ cslist.appendChild(htmlclass);
238+ cslist.appendChild(around);
239+ cslist.appendChild(regexp);
240+
241+ root.appendChild(cslist);
242+ }
243+ // 出力
244+ TransformerFactory transFactory = TransformerFactory.newInstance();
245+ Transformer transformer = transFactory.newTransformer();
246+
247+ DOMSource source = new DOMSource(document);
248+ FileOutputStream os = new FileOutputStream(file);
249+ StreamResult result = new StreamResult(os);
250+ transformer.transform(source, result);
251+
252+ } catch (ParserConfigurationException | FileNotFoundException ex) {
253+ Logger.getLogger(SearchDataRW.class.getName()).log(Level.SEVERE, null, ex);
254+ } catch (TransformerConfigurationException ex) {
255+ Logger.getLogger(SearchDataRW.class.getName()).log(Level.SEVERE, null, ex);
256+ } catch (TransformerException ex) {
257+ Logger.getLogger(SearchDataRW.class.getName()).log(Level.SEVERE, null, ex);
258+ }
259+ }
260+
261+ /**
262+ * 読込(XML形式).
263+ * @param file
264+ */
265+ public void loadXml(File file) {
266+ slist = new ArrayList();
267+
268+ try {
269+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
270+ DocumentBuilder builder = factory.newDocumentBuilder();
271+ Document doc = builder.parse(file);
272+
273+ // ルート要素の取得
274+ Element root = doc.getDocumentElement();
275+
276+ // URL
277+ NodeList url = root.getElementsByTagName("url");
278+ Node urlnode = url.item(0);
279+ UrlAdress = urlnode.getFirstChild().getNodeValue();
280+
281+ // 検索情報
282+ NodeList cslist = root.getElementsByTagName("searchlist");
283+ for(int i = 0; i < cslist.getLength(); i++) {
284+ SearchData sdat = new SearchData();
285+
286+ Node slistnode = cslist.item(i);
287+ Node child;
288+ for (child = slistnode.getFirstChild(); child != null; child = child.getNextSibling()) {
289+ if(child.getNodeType() == Node.ELEMENT_NODE) {
290+
291+ String tag = child.getNodeName();
292+ String rtn = "";
293+ if(child.getFirstChild() != null) {
294+ rtn = child.getFirstChild().getNodeValue();
295+ }
296+
297+ switch (tag) {
298+ case "item" :
299+ sdat.setitem(rtn);
300+ break;
301+ case "htmltag" :
302+ sdat.setHtmltag(rtn);
303+ break;
304+ case "htmlid" :
305+ sdat.setHtmlid(rtn);
306+ break;
307+ case "htmlclass" :
308+ sdat.setHtmlclass(rtn);
309+ break;
310+ case "around" :
311+ sdat.setaround(rtn);
312+ break;
313+ case "regexp" :
314+ sdat.setregexp(rtn);
315+ break;
316+ }
317+ }
318+ }
319+ slist.add(sdat);
320+ }
321+
322+ } catch (ParserConfigurationException | SAXException | IOException ex) {
323+ Logger.getLogger(SearchDataRW.class.getName()).log(Level.SEVERE, null, ex);
324+ }
325+ }
326+
327+ /* ---------------------------------------------------------------------- */
328+
329+ public String loadUrl() {
330+ String urladdress;
331+
332+ NodeList nodelist = root.getElementsByTagName("url");
333+ Node node = nodelist.item(0);
334+ urladdress = node.getFirstChild().getNodeValue();
335+
336+ return urladdress;
337+ }
338+
339+ public ArrayList<SearchData> loadSearchList() {
340+ ArrayList<SearchData> slist = new ArrayList<>();
341+
342+ NodeList nodelist = root.getElementsByTagName("searchlist");
343+ for(int i = 0; i < nodelist.getLength(); i++) {
344+ Node childnode = nodelist.item(i);
345+
346+ boolean sdatflg = false;
347+ SearchData sdat = new SearchData();
348+
349+ //NodeList childnodelist = childnode.getChildNodes();
350+ //for(int j = 0; j < childnodelist.getLength(); j++) {
351+ // Node child = childnodelist.item(j);
352+
353+ for (Node child = childnode.getFirstChild();
354+ child != null; child = child.getNextSibling()) {
355+
356+ if(child.getNodeType() == Node.ELEMENT_NODE) {
357+
358+ String tag = child.getNodeName();
359+ String rtn = "";
360+ if(child.getFirstChild() != null) {
361+ rtn = child.getFirstChild().getNodeValue();
362+ }
363+
364+ switch (tag) {
365+ case "item" :
366+ sdat.setitem(rtn);
367+ sdatflg = true;
368+ break;
369+ case "htmltag" :
370+ sdat.setHtmltag(rtn);
371+ sdatflg = true;
372+ break;
373+ case "htmlid" :
374+ sdat.setHtmlid(rtn);
375+ sdatflg = true;
376+ break;
377+ case "htmlclass" :
378+ sdat.setHtmlclass(rtn);
379+ sdatflg = true;
380+ break;
381+ case "around" :
382+ sdat.setaround(rtn);
383+ sdatflg = true;
384+ break;
385+ case "regexp" :
386+ sdat.setregexp(rtn);
387+ sdatflg = true;
388+ break;
389+ }
390+ }
391+ }
392+ if(sdatflg) slist.add(sdat);
393+ }
394+ return slist;
395+ }
396+
397+ public Element loadElement(String elementTagName) {
398+ NodeList nodelist = root.getElementsByTagName(elementTagName);
399+ Element element = (Element)nodelist.item(0);
400+
401+ return element;
402+ }
403+
404+ public void saveUrl(String urladdress) {
405+ checkdoc();
406+ removeElement("url"); // 既にElementが存在してた場合、一度削除
407+
408+ Element url = document.createElement("url");
409+ url.appendChild(document.createTextNode(urladdress));
410+ root.appendChild(url);
411+ }
412+
413+ public void saveSearchList(ArrayList slist) {
414+ checkdoc();
415+ removeElement("searchlist"); // 既にElementが存在してた場合、一度削除
416+
417+ for (Object slist1 : slist) {
418+ SearchData sdat = (SearchData) slist1;
419+
420+ Element cslist = document.createElement("searchlist");
421+
422+ addChild(cslist, "item", sdat.getitem());
423+ addChild(cslist, "htmltag", sdat.getHtmltag());
424+ addChild(cslist, "htmlid", sdat.getHtmlid());
425+ addChild(cslist, "htmlclass", sdat.getHtmlclass());
426+ addChild(cslist, "around", sdat.getaround());
427+ addChild(cslist, "regexp", sdat.getregexp());
428+
429+ root.appendChild(cslist);
430+ }
431+ }
432+
433+ public void saveElement(Element element) {
434+ checkdoc();
435+ removeElement(element.getTagName()); // 既にElementが存在してた場合、一度削除
436+
437+ root.appendChild(element);
438+ }
439+
440+ private void addChild(Element cslist, String keyword, String data) {
441+ if(!data.isEmpty()) {
442+ Element element = document.createElement(keyword);
443+ element.appendChild(document.createTextNode(data));
444+ cslist.appendChild(element);
445+ }
446+ }
447+
448+ private void removeElement(String elementTagName) {
449+ int nodeSize;
450+ do {
451+ NodeList nodelist = document.getElementsByTagName(elementTagName);
452+ nodeSize = nodelist.getLength();
453+ for(int i = 0; i < nodelist.getLength(); i++) {
454+ Node node = nodelist.item(i);
455+ root.removeChild(node);
456+ }
457+ } while(nodeSize > 0);
458+ }
459+
460+ /**
461+ * ドキュメントチェック.
462+ * 新規の場合やXMLファイルの読込みが行われていない状態時、新たにルートエレメントを作成する。
463+ * 既読の場合、ルートエレメントの取得を行う。
464+ */
465+ public void checkdoc() {
466+ if(document == null) {
467+ DOMImplementation domImpl = builder.getDOMImplementation();
468+ document = domImpl.createDocument("","searchdata",null);
469+ }
470+ root = document.getDocumentElement();
471+ }
472+
473+ /**
474+ * XML読込み.
475+ * @param file
476+ */
477+ public void read(File file) {
478+ try {
479+ document = builder.parse(file);
480+ root = document.getDocumentElement();
481+
482+ } catch (SAXException | IOException ex) {
483+ Logger.getLogger(SearchDataRW.class.getName()).log(Level.SEVERE, null, ex);
484+ }
485+ }
486+
487+ /**
488+ * XML書込み.
489+ * @param file
490+ */
491+ public void write(File file) {
492+ try {
493+ TransformerFactory transFactory = TransformerFactory.newInstance();
494+ Transformer transformer = transFactory.newTransformer();
495+
496+ DOMSource source = new DOMSource(document);
497+ FileOutputStream os = new FileOutputStream(file);
498+ StreamResult result = new StreamResult(os);
499+ transformer.transform(source, result);
500+
501+ } catch (TransformerConfigurationException ex) {
502+ Logger.getLogger(SearchDataRW.class.getName()).log(Level.SEVERE, null, ex);
503+ } catch (FileNotFoundException | TransformerException ex) {
504+ Logger.getLogger(SearchDataRW.class.getName()).log(Level.SEVERE, null, ex);
505+ }
506+ }
507+
508+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- branches/b3/WebScraping/src/Form/HtmlSearch.java (nonexistent)
+++ branches/b3/WebScraping/src/Form/HtmlSearch.java (revision 102)
@@ -0,0 +1,454 @@
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$
21+ */
22+package Form;
23+
24+import WebScraping.HtmlParser;
25+import WebScraping.SearchData;
26+import java.awt.Desktop;
27+import java.io.File;
28+import java.io.IOException;
29+import java.net.URI;
30+import java.net.URISyntaxException;
31+import java.util.*;
32+import java.util.logging.Level;
33+import java.util.logging.Logger;
34+import javax.swing.JFileChooser;
35+import javax.swing.filechooser.FileFilter;
36+import javax.swing.filechooser.FileNameExtensionFilter;
37+import org.jdesktop.observablecollections.ObservableCollections;
38+
39+/**
40+ * HTMLページ上の特定の項目を検索し、その項目内容の値を取得する.
41+ * @author kgto
42+ */
43+public class HtmlSearch extends javax.swing.JFrame {
44+
45+ private final SearchDataRW sio = new SearchDataRW();
46+
47+ private ArrayList slist = new ArrayList();
48+ private List serachDataList = ObservableCollections.observableList(slist);
49+
50+ /**
51+ * Creates new form Frame1
52+ */
53+ public HtmlSearch() {
54+ initComponents();
55+
56+ // カレントディレクトリ取得
57+ String dir = System.getProperty("user.dir");
58+ File file = new java.io.File(dir + "\\data");
59+ jFileChooser1.setCurrentDirectory(file);
60+
61+ FileFilter filter1 = new FileNameExtensionFilter("XMLファイル", "xml");
62+ FileFilter filter2 = new FileNameExtensionFilter("TEXTファイル", "txt");
63+ jFileChooser1.addChoosableFileFilter(filter1);
64+ jFileChooser1.addChoosableFileFilter(filter2);
65+ jFileChooser1.setFileFilter(filter1);
66+ }
67+
68+ public List getSerachDataList() {
69+ return this.serachDataList;
70+ }
71+
72+ public void setSerachDataList(List serachDataList) {
73+ this.serachDataList = serachDataList;
74+ }
75+
76+ /**
77+ * This method is called from within the constructor to initialize the form.
78+ * WARNING: Do NOT modify this code. The content of this method is always
79+ * regenerated by the Form Editor.
80+ */
81+ @SuppressWarnings("unchecked")
82+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
83+ private void initComponents() {
84+ bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
85+
86+ jFileChooser1 = new javax.swing.JFileChooser();
87+ jLabel1 = new javax.swing.JLabel();
88+ jTxtUrl = new javax.swing.JTextField();
89+ jBtnSearch = new javax.swing.JButton();
90+ jPanel1 = new javax.swing.JPanel();
91+ jScrollPane1 = new javax.swing.JScrollPane();
92+ jTable1 = new javax.swing.JTable();
93+ jBtnRowIns = new javax.swing.JButton();
94+ jBtnRowDel = new javax.swing.JButton();
95+ jBtnRowCpy = new javax.swing.JButton();
96+ jPanel2 = new javax.swing.JPanel();
97+ jScrollPane2 = new javax.swing.JScrollPane();
98+ jTxtRtn = new javax.swing.JTextArea();
99+ jMenuBar1 = new javax.swing.JMenuBar();
100+ jMenu1 = new javax.swing.JMenu();
101+ jMenuLoad = new javax.swing.JMenuItem();
102+ jMenuSave = new javax.swing.JMenuItem();
103+ jMenu3 = new javax.swing.JMenu();
104+ jMenuItem1 = new javax.swing.JMenuItem();
105+ jMenu2 = new javax.swing.JMenu();
106+
107+ jFileChooser1.setCurrentDirectory(null);
108+ jFileChooser1.setDialogTitle("");
109+
110+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
111+ setTitle("タグ検索");
112+
113+ jLabel1.setText(" URL:");
114+
115+ jBtnSearch.setText("検索");
116+ jBtnSearch.addActionListener(new java.awt.event.ActionListener() {
117+ public void actionPerformed(java.awt.event.ActionEvent evt) {
118+ jBtnSearchActionPerformed(evt);
119+ }
120+ });
121+
122+ jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("検索情報"));
123+
124+ jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
125+ jTable1.getTableHeader().setReorderingAllowed(false);
126+
127+ org.jdesktop.beansbinding.ELProperty eLProperty = org.jdesktop.beansbinding.ELProperty.create("${serachDataList}");
128+ org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, eLProperty, jTable1);
129+ org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${item}"));
130+ columnBinding.setColumnName("項目名");
131+ columnBinding.setColumnClass(String.class);
132+ columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${htmltag}"));
133+ columnBinding.setColumnName("タグ");
134+ columnBinding.setColumnClass(String.class);
135+ columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${htmlid}"));
136+ columnBinding.setColumnName("ID");
137+ columnBinding.setColumnClass(String.class);
138+ columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${htmlclass}"));
139+ columnBinding.setColumnName("クラス");
140+ columnBinding.setColumnClass(String.class);
141+ columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${around}"));
142+ columnBinding.setColumnName("位置");
143+ columnBinding.setColumnClass(String.class);
144+ columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${regexp}"));
145+ columnBinding.setColumnName("抽出条件");
146+ columnBinding.setColumnClass(String.class);
147+ bindingGroup.addBinding(jTableBinding);
148+ jTableBinding.bind();
149+ jScrollPane1.setViewportView(jTable1);
150+
151+ jBtnRowIns.setText("行挿入");
152+ jBtnRowIns.addActionListener(new java.awt.event.ActionListener() {
153+ public void actionPerformed(java.awt.event.ActionEvent evt) {
154+ jBtnRowInsActionPerformed(evt);
155+ }
156+ });
157+
158+ jBtnRowDel.setText("行削除");
159+ jBtnRowDel.addActionListener(new java.awt.event.ActionListener() {
160+ public void actionPerformed(java.awt.event.ActionEvent evt) {
161+ jBtnRowDelActionPerformed(evt);
162+ }
163+ });
164+
165+ jBtnRowCpy.setText("行コピー");
166+ jBtnRowCpy.addActionListener(new java.awt.event.ActionListener() {
167+ public void actionPerformed(java.awt.event.ActionEvent evt) {
168+ jBtnRowCpyActionPerformed(evt);
169+ }
170+ });
171+
172+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
173+ jPanel1.setLayout(jPanel1Layout);
174+ jPanel1Layout.setHorizontalGroup(
175+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
176+ .addGroup(jPanel1Layout.createSequentialGroup()
177+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
178+ .addComponent(jBtnRowCpy)
179+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
180+ .addComponent(jBtnRowDel)
181+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
182+ .addComponent(jBtnRowIns))
183+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
184+ );
185+ jPanel1Layout.setVerticalGroup(
186+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
187+ .addGroup(jPanel1Layout.createSequentialGroup()
188+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
189+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
190+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
191+ .addComponent(jBtnRowDel)
192+ .addComponent(jBtnRowIns)
193+ .addComponent(jBtnRowCpy)))
194+ );
195+
196+ jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("検索結果"));
197+
198+ jTxtRtn.setColumns(20);
199+ jTxtRtn.setRows(5);
200+ jScrollPane2.setViewportView(jTxtRtn);
201+
202+ javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
203+ jPanel2.setLayout(jPanel2Layout);
204+ jPanel2Layout.setHorizontalGroup(
205+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
206+ .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
207+ );
208+ jPanel2Layout.setVerticalGroup(
209+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
210+ .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
211+ );
212+
213+ jMenu1.setText("ファイル");
214+
215+ jMenuLoad.setText("LOAD");
216+ jMenuLoad.addActionListener(new java.awt.event.ActionListener() {
217+ public void actionPerformed(java.awt.event.ActionEvent evt) {
218+ jMenuLoadActionPerformed(evt);
219+ }
220+ });
221+ jMenu1.add(jMenuLoad);
222+
223+ jMenuSave.setText("SAVE");
224+ jMenuSave.addActionListener(new java.awt.event.ActionListener() {
225+ public void actionPerformed(java.awt.event.ActionEvent evt) {
226+ jMenuSaveActionPerformed(evt);
227+ }
228+ });
229+ jMenu1.add(jMenuSave);
230+
231+ jMenuBar1.add(jMenu1);
232+
233+ jMenu3.setText("ツール");
234+
235+ jMenuItem1.setText("ブラウザで表示");
236+ jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
237+ public void actionPerformed(java.awt.event.ActionEvent evt) {
238+ jMenuItem1ActionPerformed(evt);
239+ }
240+ });
241+ jMenu3.add(jMenuItem1);
242+
243+ jMenuBar1.add(jMenu3);
244+
245+ jMenu2.setText("検索");
246+ jMenu2.addMouseListener(new java.awt.event.MouseAdapter() {
247+ public void mouseClicked(java.awt.event.MouseEvent evt) {
248+ jMenu2MouseClicked(evt);
249+ }
250+ });
251+ jMenuBar1.add(jMenu2);
252+
253+ setJMenuBar(jMenuBar1);
254+
255+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
256+ getContentPane().setLayout(layout);
257+ layout.setHorizontalGroup(
258+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
259+ .addGroup(layout.createSequentialGroup()
260+ .addComponent(jLabel1)
261+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
262+ .addComponent(jTxtUrl)
263+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
264+ .addComponent(jBtnSearch))
265+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
266+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
267+ );
268+ layout.setVerticalGroup(
269+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
270+ .addGroup(layout.createSequentialGroup()
271+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
272+ .addComponent(jLabel1)
273+ .addComponent(jTxtUrl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
274+ .addComponent(jBtnSearch))
275+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
276+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
277+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
278+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
279+ );
280+
281+ bindingGroup.bind();
282+
283+ pack();
284+ }// </editor-fold>//GEN-END:initComponents
285+
286+ private void jBtnRowInsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnRowInsActionPerformed
287+ int SelectedRow = jTable1.getSelectedRow();
288+ SearchData sdat = new SearchData();
289+
290+ if(SelectedRow >= 0) {
291+ this.serachDataList.add(SelectedRow, sdat);
292+ } else {
293+ this.serachDataList.add(sdat);
294+ }
295+ }//GEN-LAST:event_jBtnRowInsActionPerformed
296+
297+ private void jBtnRowDelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnRowDelActionPerformed
298+ int SelectedRow = jTable1.getSelectedRow();
299+ if(!(SelectedRow < 0)) {
300+ this.serachDataList.remove(SelectedRow);
301+ }
302+ }//GEN-LAST:event_jBtnRowDelActionPerformed
303+
304+ private void jMenuLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuLoadActionPerformed
305+ jFileChooser1.setDialogTitle("読込");
306+ int selected = jFileChooser1.showOpenDialog(this);
307+ if (selected == JFileChooser.APPROVE_OPTION) {
308+ File file = jFileChooser1.getSelectedFile();
309+ serachDataList.clear();
310+ sio.load(file);
311+ jTxtUrl.setText(sio.geturl());
312+ serachDataList.addAll(sio.getslist());
313+ }
314+ }//GEN-LAST:event_jMenuLoadActionPerformed
315+
316+ private void jMenuSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuSaveActionPerformed
317+ jFileChooser1.setDialogTitle("保存");
318+ int selected = jFileChooser1.showSaveDialog(this);
319+ if (selected == JFileChooser.APPROVE_OPTION) {
320+ File file = jFileChooser1.getSelectedFile();
321+ sio.seturl(jTxtUrl.getText());
322+ sio.setslist(slist);
323+ sio.save(file);
324+ }
325+ }//GEN-LAST:event_jMenuSaveActionPerformed
326+
327+ private void jMenu2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu2MouseClicked
328+ jTxtRtn.setText(null);
329+ HtmlParser par = new HtmlParser(jTxtUrl.getText());
330+
331+ String strdata = par.getStringPageData();
332+ String strsearch = "一致する銘柄は見つかりませんでした";
333+ if(check404(strdata, strsearch)) {
334+ jTxtRtn.append(strsearch);
335+ return;
336+ }
337+
338+ for (Object slist1 : slist) {
339+ SearchData sdata = (SearchData)slist1;
340+ String ans = sdata.getitem();
341+ String rtn = par.search(sdata);
342+ jTxtRtn.append(ans + "\t" + rtn + "\r\n");
343+ }
344+ jTxtRtn.setCaretPosition(0);
345+ }//GEN-LAST:event_jMenu2MouseClicked
346+
347+ private void jBtnRowCpyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnRowCpyActionPerformed
348+ int SelectedRow = jTable1.getSelectedRow();
349+ if(SelectedRow >= 0) {
350+ SearchData SelectData = (SearchData)slist.get(SelectedRow);
351+ SearchData Cpydata = new SearchData(SelectData);
352+ this.serachDataList.add(SelectedRow, Cpydata);
353+ }
354+ }//GEN-LAST:event_jBtnRowCpyActionPerformed
355+
356+ private void jBtnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSearchActionPerformed
357+ jTxtRtn.setText(null);
358+ HtmlParser par = new HtmlParser(jTxtUrl.getText());
359+
360+ String strdata = par.getStringPageData();
361+ String strsearch = "一致する銘柄は見つかりませんでした";
362+ if(check404(strdata, strsearch)) {
363+ jTxtRtn.append(strsearch);
364+ return;
365+ }
366+
367+ for (Object slist1 : slist) {
368+ SearchData sdata = (SearchData)slist1;
369+ String ans = sdata.getitem();
370+ String rtn = par.search(sdata);
371+ jTxtRtn.append(ans + "\t" + rtn + "\r\n");
372+ }
373+ jTxtRtn.setCaretPosition(0);
374+ }//GEN-LAST:event_jBtnSearchActionPerformed
375+
376+ private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
377+ Desktop desktop = Desktop.getDesktop();
378+ String uriString = jTxtUrl.getText();
379+ try {
380+ URI uri = new URI(uriString);
381+ desktop.browse(uri);
382+
383+ } catch (URISyntaxException | IOException ex) {
384+ Logger.getLogger(HtmlSearch.class.getName()).log(Level.SEVERE, null, ex);
385+ }
386+ }//GEN-LAST:event_jMenuItem1ActionPerformed
387+
388+ boolean check404(String strdata, String strsearch) {
389+ if(strdata.contains(strsearch)) {
390+ return true;
391+ }
392+ return false;
393+ }
394+
395+ /**
396+ * @param args the command line arguments
397+ */
398+ public static void main(String args[]) {
399+ /* Set the Nimbus look and feel */
400+ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
401+ /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
402+ * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
403+ */
404+ try {
405+ for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
406+ if ("Nimbus".equals(info.getName())) {
407+ javax.swing.UIManager.setLookAndFeel(info.getClassName());
408+ break;
409+ }
410+ }
411+ } catch (ClassNotFoundException ex) {
412+ java.util.logging.Logger.getLogger(HtmlSearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
413+ } catch (InstantiationException ex) {
414+ java.util.logging.Logger.getLogger(HtmlSearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
415+ } catch (IllegalAccessException ex) {
416+ java.util.logging.Logger.getLogger(HtmlSearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
417+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
418+ java.util.logging.Logger.getLogger(HtmlSearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
419+ }
420+ //</editor-fold>
421+
422+ /* Create and display the form */
423+ java.awt.EventQueue.invokeLater(new Runnable() {
424+ @Override
425+ public void run() {
426+ new HtmlSearch().setVisible(true);
427+ }
428+ });
429+ }
430+
431+ // Variables declaration - do not modify//GEN-BEGIN:variables
432+ private javax.swing.JButton jBtnRowCpy;
433+ private javax.swing.JButton jBtnRowDel;
434+ private javax.swing.JButton jBtnRowIns;
435+ private javax.swing.JButton jBtnSearch;
436+ private javax.swing.JFileChooser jFileChooser1;
437+ private javax.swing.JLabel jLabel1;
438+ private javax.swing.JMenu jMenu1;
439+ private javax.swing.JMenu jMenu2;
440+ private javax.swing.JMenu jMenu3;
441+ private javax.swing.JMenuBar jMenuBar1;
442+ private javax.swing.JMenuItem jMenuItem1;
443+ private javax.swing.JMenuItem jMenuLoad;
444+ private javax.swing.JMenuItem jMenuSave;
445+ private javax.swing.JPanel jPanel1;
446+ private javax.swing.JPanel jPanel2;
447+ private javax.swing.JScrollPane jScrollPane1;
448+ private javax.swing.JScrollPane jScrollPane2;
449+ private javax.swing.JTable jTable1;
450+ private javax.swing.JTextArea jTxtRtn;
451+ private javax.swing.JTextField jTxtUrl;
452+ private org.jdesktop.beansbinding.BindingGroup bindingGroup;
453+ // End of variables declaration//GEN-END:variables
454+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- branches/b3/WebScraping/src/WebScraping/HtmlParser.java (nonexistent)
+++ branches/b3/WebScraping/src/WebScraping/HtmlParser.java (revision 102)
@@ -0,0 +1,255 @@
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$
21+ */
22+
23+package WebScraping;
24+
25+import java.io.*;
26+import java.net.*;
27+import java.util.ArrayList;
28+import java.util.logging.Level;
29+import java.util.logging.Logger;
30+import java.util.regex.Matcher;
31+import java.util.regex.Pattern;
32+import javax.swing.text.html.parser.ParserDelegator;
33+
34+/**
35+ *
36+ * @author kgto
37+ */
38+public class HtmlParser {
39+
40+ URL url;
41+ String pageData;
42+ ArrayList sData;
43+
44+ // 作業ワーク
45+ String htmltag;
46+ String htmlid;
47+ String htmlclass;
48+
49+ public HtmlParser(URL UrlAdress) {
50+ DebugProcess.debuglog_set();
51+ this.url = UrlAdress;
52+ getPageData();
53+ }
54+
55+ public HtmlParser(String UrlAdress) {
56+ DebugProcess.debuglog_set();
57+ try {
58+ url = new URL(UrlAdress);
59+ getPageData();
60+
61+ } catch (MalformedURLException ex) {
62+ Logger.getLogger(HtmlParser.class.getName()).log(Level.SEVERE, null, ex);
63+ }
64+ }
65+
66+ public HtmlParser() {
67+ DebugProcess.debuglog_set();
68+ url = null;
69+ }
70+
71+ public String getStringPageData() {
72+ return pageData;
73+ }
74+
75+ public void seturl(URL UrlAdress) {
76+ this.url = UrlAdress;
77+ getPageData();
78+ }
79+
80+ public void seturl(String UrlAdress) {
81+ try {
82+ url = new URL(UrlAdress);
83+ getPageData();
84+
85+ } catch (MalformedURLException ex) {
86+ Logger.getLogger(HtmlParser.class.getName()).log(Level.SEVERE, null, ex);
87+ }
88+ }
89+
90+ /**
91+ * HTMLページ内検索.
92+ * 検索キーとして渡されたタグ,ID,クラスから、対象となるタグを探し出し、
93+ * around(タグ位置)として指定された箇所の文字列をregexp(正規表現)で指定された整形を
94+ * 行った結果を返す。<br>
95+ * aroundの初期値:0 検索キーとして未指定(未入力)の場合、最初(0)の文字列。<br>
96+ * regexpが指定(入力)ありの場合、正規表現にて整形を行う。<br>
97+ * 渡された検索キーに一致するタグが存在しなかった場合、NULLを返す。
98+ * @param skey 検索キーデータ(SearchData)
99+ * @return String 検索キーに一致するデータの文字列
100+ */
101+ public String search(SearchData skey) {
102+
103+ // htmlページ内を検索
104+ if(isHtmlkeyEq(skey) == false) {
105+ searchPageData(skey);
106+ }
107+ /*
108+ around 出現位置指定 入力有り:指定された位置の情報のみ返す。
109+ 入力無し:取得した全ての情報を返す。
110+ */
111+ String regexp = skey.getregexp();
112+ if(skey.getaround().length() > 0) {
113+ int wkAround = Integer.parseInt(skey.getaround()); // 検索位置を数値変換
114+ if(wkAround < sData.size()) {
115+ String str = (String)sData.get(wkAround);
116+ String rtn = RegularExpression(str, regexp);
117+ return rtn;
118+ }
119+ } else {
120+ StringBuilder strbuf = new StringBuilder();
121+ for (Object sData1 : sData) {
122+ String str = (String)sData1;
123+ String rtn = RegularExpression(str, regexp);
124+ if(strbuf.length() > 0) {
125+ strbuf.append("\t");
126+ }
127+ strbuf.append(rtn);
128+ }
129+ return strbuf.toString();
130+ }
131+ return null;
132+ }
133+
134+ /**
135+ * 直近のHTMLタグ/ID/CLASS値と引数の値を比較する.
136+ * @param skey HTMLタグ/ID/CLASSが格納された検索キー
137+ * @return boolean HTMLタグ/ID/CLASS値が一致する時、true
138+ */
139+ boolean isHtmlkeyEq(SearchData skey) {
140+
141+ String stag = skey.getHtmltag();
142+ String sid = skey.getHtmlid();
143+ String sclass = skey.getHtmlclass();
144+
145+ boolean rtn = true;
146+
147+ // htmltag
148+ if(htmltag == null) {
149+ rtn = false;
150+ } else {
151+ if(htmltag.equals(stag) == false) {
152+ rtn = false;
153+ }
154+ }
155+
156+ // htmlid
157+ if(htmlid == null) {
158+ rtn = false;
159+ } else {
160+ if(htmlid.equals(sid) == false) {
161+ rtn = false;
162+ }
163+ }
164+
165+ // htmlclass
166+ if(htmlclass == null) {
167+ rtn = false;
168+ } else {
169+ if(htmlclass.equals(sclass) == false) {
170+ rtn = false;
171+ }
172+ }
173+
174+ if(!rtn) {
175+ htmltag = stag;
176+ htmlid = sid;
177+ htmlclass = sclass;
178+ }
179+
180+ return rtn;
181+ }
182+
183+ /**
184+ * 正規表現検索.
185+ * @param strdata
186+ * @param regexp
187+ * @return
188+ */
189+ String RegularExpression(String strdata, String regexp) {
190+ String expdata = null;
191+
192+ //regexpのチェック
193+ if(regexp.isEmpty()) {
194+ expdata = strdata;
195+ return expdata;
196+ }
197+
198+ //正規表現検索
199+ Pattern ptn = Pattern.compile(regexp);
200+ Matcher matchdata = ptn.matcher(strdata);
201+ if (matchdata.find()) {
202+ if(matchdata.groupCount() >= 1) {
203+ expdata = matchdata.group(1);
204+ }
205+ }
206+ return expdata;
207+ }
208+
209+ /**
210+ * インターネット接続.
211+ */
212+ private void getPageData() {
213+ try {
214+ //URL url = new URL(UrlAdress);
215+ HttpURLConnection con = (HttpURLConnection)url.openConnection();
216+ con.setRequestMethod("GET");
217+ BufferedReader reader = new BufferedReader(
218+ new InputStreamReader(con.getInputStream(), "utf-8"));
219+ String wkline;
220+ StringBuilder sb = new StringBuilder();
221+ while((wkline = reader.readLine()) != null) {
222+ sb.append(wkline).append("\n");
223+ }
224+ pageData = sb.toString();
225+
226+ con.disconnect();
227+ }
228+ catch(IOException ex) {
229+ Logger.getLogger(HtmlParser.class.getName()).log(Level.SEVERE, null, ex);
230+ }
231+ }
232+
233+ /**
234+ * HTMLパーサ.
235+ * @param skey
236+ */
237+ private void searchPageData(SearchData skey) {
238+
239+ DebugProcess.searchDatainfo(skey);
240+
241+ Reader reader;
242+ try {
243+ reader = new BufferedReader(new StringReader(pageData));
244+ HtmlParserCallback cb = new HtmlParserCallback(skey);
245+ ParserDelegator pd = new ParserDelegator();
246+ pd.parse(reader, cb, true);
247+ reader.close();
248+
249+ sData = cb.getrtnData();
250+
251+ } catch (IOException ex) {
252+ Logger.getLogger(HtmlParser.class.getName()).log(Level.SEVERE, null, ex);
253+ }
254+ }
255+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- branches/b3/WebScraping/src/WebScraping/SearchData.java (nonexistent)
+++ branches/b3/WebScraping/src/WebScraping/SearchData.java (revision 102)
@@ -0,0 +1,113 @@
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$
21+ */
22+
23+package WebScraping;
24+
25+/**
26+ * 検索データ.
27+ * @author kgto
28+ */
29+public class SearchData {
30+
31+ private String item;
32+ private String htmltag;
33+ private String htmlid;
34+ private String htmlclass;
35+ private String around;
36+ private String regexp;
37+
38+ public SearchData() {
39+ initialize();
40+ }
41+
42+ public SearchData(SearchData dat) {
43+ this.item = dat.getitem();
44+ this.htmltag = dat.getHtmltag();
45+ this.htmlid = dat.getHtmlid();
46+ this.htmlclass = dat.getHtmlclass();
47+ this.around = dat.getaround();
48+ this.regexp = dat.getregexp();
49+ }
50+
51+ /**
52+ * データ初期化.
53+ */
54+ public final void initialize() {
55+ this.item = "";
56+ this.htmltag = "";
57+ this.htmlid = "";
58+ this.htmlclass = "";
59+ this.around = "";
60+ this.regexp = "";
61+ }
62+
63+ // Setter
64+ public void setitem(String item) {
65+ this.item = item;
66+ }
67+
68+ public void setHtmltag(String htmltag) {
69+ this.htmltag = htmltag;
70+ }
71+
72+ public void setHtmlid(String htmlid) {
73+ this.htmlid = htmlid;
74+ }
75+
76+ public void setHtmlclass(String htmlclass) {
77+ this.htmlclass = htmlclass;
78+ }
79+
80+ public void setaround(String around) {
81+ this.around = around;
82+ }
83+
84+ public void setregexp(String regexp) {
85+ this.regexp = regexp;
86+ }
87+
88+ // Getter
89+ public String getitem() {
90+ return item;
91+ }
92+
93+ public String getHtmltag() {
94+ return htmltag;
95+ }
96+
97+ public String getHtmlid() {
98+ return htmlid;
99+ }
100+
101+ public String getHtmlclass() {
102+ return htmlclass;
103+ }
104+
105+ public String getaround() {
106+ return around;
107+ }
108+
109+ public String getregexp() {
110+ return regexp;
111+ }
112+
113+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- branches/b3/WebScraping/src/WebScraping/DebugProcess.java (nonexistent)
+++ branches/b3/WebScraping/src/WebScraping/DebugProcess.java (revision 102)
@@ -0,0 +1,264 @@
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$
21+ */
22+
23+package WebScraping;
24+
25+import java.io.File;
26+import java.io.FileInputStream;
27+import java.io.FileNotFoundException;
28+import java.io.IOException;
29+import java.util.logging.FileHandler;
30+import java.util.logging.Formatter;
31+import java.util.logging.Handler;
32+import java.util.logging.Level;
33+import java.util.logging.LogManager;
34+import java.util.logging.LogRecord;
35+import java.util.logging.Logger;
36+import javax.swing.text.MutableAttributeSet;
37+import javax.swing.text.html.HTML;
38+
39+/**
40+ * デバック情報.
41+ * カレントディレクトリに設定ファイル(Debug.prop)を置くことで、デバックログの出力を制御する。
42+ * @author kgto
43+ */
44+public class DebugProcess {
45+ // 設定ファイル名
46+ protected static final String configurationFilename = "Debug.prop";
47+ // ロガー名
48+ protected static final Logger logger = Logger.getLogger("WebScraping");
49+ // ログ出力デフォルトレベル
50+ protected static final Level loggerlevel = Level.FINEST;
51+
52+
53+ /**
54+ * ログ出力設定.
55+ * ログ設定ファイルの存在をチェック、(最終的な)ログレベルにより、
56+ * ファイルハンドラの設定と出力書式の設定を行う。
57+ */
58+ public static void debuglog_set() {
59+ try {
60+ initLogConfiguration();
61+
62+ if(Level.ALL.equals(logger.getLevel())) {
63+ //logger.addHandler(new FileHandler("WebScraping%g.log", 100000, 2));
64+ logger.addHandler(new FileHandler("WebScraping%g.log", true));
65+ }
66+ setFomatter();
67+
68+ } catch (IOException | SecurityException ex) {
69+ Logger.getLogger(DebugProcess.class.getName()).log(Level.SEVERE, null, ex);
70+ }
71+ }
72+
73+ /**
74+ * ログ出力設定解除.
75+ */
76+ public static void debuglog_unset() {
77+ }
78+
79+
80+ /**
81+ * デバック出力(HTML解析-タグ&属性).
82+ * HTMLのタグと属性の解析状態を出力する。
83+ * 書式: 9 : x : タグ名 [属性名]属性数 = 属性値<br>
84+ * 凡例: 9 = 階層レベル(count値), x = F(tagの開始)/E(tagの終了)/S(単独tag)の何れか1文字<br>
85+ * @param tag タグ
86+ * @param attr 属性
87+ * @param methodname このメソッドを呼び出した親メソッド名
88+ * @param count HTMLタグの階層レベル
89+ */
90+ public static void htmlinfo(HTML.Tag tag, MutableAttributeSet attr,
91+ String methodname, int count) {
92+
93+ // ログ出力レベルチェック
94+ if(logger.getLevel() == null) {
95+ return;
96+ }
97+ if(logger.getLevel().intValue() > loggerlevel.intValue()) {
98+ return;
99+ }
100+
101+ // 編集処理
102+ char kbn = ' ';
103+ if("handleStartTag".equals(methodname)) {
104+ kbn = 'F';
105+ }
106+ if("handleEndTag".equals(methodname)) {
107+ kbn = 'E';
108+ }
109+ if("handleSimpleTag".equals(methodname)) {
110+ kbn = 'S';
111+ }
112+
113+ StringBuilder strBuf = new StringBuilder(80);
114+ strBuf.append(count).append(" : ");
115+ strBuf.append(kbn).append(" : ");
116+ strBuf.append(tag.toString());
117+ // 属性情報
118+ if(attr != null) {
119+ if(attr.getAttributeCount() != 0) {
120+ AttributeData handleAttrData = new AttributeData();
121+ handleAttrData.add(tag, attr);
122+ for(int i = 0; i < handleAttrData.size; i++) {
123+ strBuf.append(" [");
124+ strBuf.append(handleAttrData.getattrname(i));
125+ strBuf.append("]");
126+ strBuf.append(handleAttrData.getcount(i));
127+ strBuf.append(" = ");
128+ strBuf.append(handleAttrData.getattrvalue(i));
129+ }
130+ }
131+ }
132+
133+ logger.log(loggerlevel, strBuf.toString());
134+ }
135+
136+ /**
137+ * デバック出力(メッセージ).
138+ * 引数に渡された任意のメッセージを出力する。
139+ * @param str メッセージ
140+ * @param methodname このメソッドを呼び出した親メソッド名
141+ */
142+ public static void htmlinfo(String str, String methodname) {
143+ logger.log(loggerlevel, str);
144+ }
145+
146+ public static void htmlinfo(String str) {
147+ logger.log(loggerlevel, str);
148+ }
149+
150+ /**
151+ * デバック出力(HTML解析-本文).
152+ * 本文の内容を出力する。
153+ * @param data 本文(HTML内の文字列)
154+ * @param methodname このメソッドを呼び出した親メソッド名
155+ */
156+ public static void htmlinfo(char[] data, String methodname) {
157+ String dat = new String(data);
158+ logger.log(loggerlevel, dat);
159+ }
160+
161+ public static void htmlinfo(char[] data) {
162+ String dat = new String(data);
163+ logger.log(loggerlevel, dat);
164+ }
165+
166+ /**
167+ * デバック出力(検索キー).
168+ * 検索キー(SearchData)の内容を出力する。
169+ * @param skey
170+ */
171+ public static void searchDatainfo(SearchData skey) {
172+
173+ StringBuilder strBuf = new StringBuilder(30);
174+ strBuf.append("SearchData KEY tag[");
175+ strBuf.append(skey.getHtmltag());
176+ strBuf.append("] ID[");
177+ strBuf.append(skey.getHtmlid());
178+ strBuf.append("] CLASS[");
179+ strBuf.append(skey.getHtmlclass());
180+ strBuf.append("]\n");
181+
182+ logger.log(loggerlevel, strBuf.toString());
183+ }
184+
185+ /**
186+ * ログ出力設定ファイルチェック.
187+ * 設定ファイルの存在をチェックし存在する場合、設定ファイルの内容を設定する。
188+ */
189+ private static void initLogConfiguration() {
190+
191+ File file = new File(configurationFilename);
192+ try {
193+ if(file.exists()) {
194+ FileInputStream inputStream = new FileInputStream(file);
195+ // 設定ファイルの読み込み
196+ LogManager.getLogManager().readConfiguration(inputStream);
197+ }
198+
199+ } catch (FileNotFoundException ex) {
200+ Logger.getLogger(DebugProcess.class.getName()).log(Level.SEVERE, null, ex);
201+ } catch (IOException ex) {
202+ Logger.getLogger(DebugProcess.class.getName()).log(Level.SEVERE, null, ex);
203+ }
204+ }
205+
206+ /**
207+ * ログ出力フォーマッター設定.
208+ * ファイルへログ出力時の書式を設定する。
209+ */
210+ private static void setFomatter() {
211+ Handler[] handlers = logger.getHandlers();
212+ for(int i = 0 ; i < handlers.length ; i++) {
213+ if(handlers[i] instanceof java.util.logging.FileHandler) {
214+ handlers[i].setFormatter(new HtmlFormatter());
215+ }
216+ }
217+ }
218+
219+}
220+
221+/**
222+ * ログ出力フォーマッター.
223+ * @author kgto
224+ */
225+class HtmlFormatter extends Formatter {
226+ /**
227+ * Logの出力文字列を生成する。
228+ * 出力書式:<br>
229+ * YYYY-MM-DD HH:SS:MM ログレベル<メソッド名>メッセージ
230+ */
231+ @Override
232+ public synchronized String format(final LogRecord aRecord) {
233+
234+ final StringBuffer message = new StringBuffer(100);
235+
236+ long millis = aRecord.getMillis();
237+ String time = String.format("%tF %<tT", millis);
238+
239+ message.append(time);
240+ message.append(' ');
241+
242+ message.append(aRecord.getLevel());
243+ message.append('<');
244+ String methodName = aRecord.getSourceMethodName();
245+ message.append(methodName != null ? methodName : "N/A");
246+ message.append('>');
247+
248+ message.append(formatMessage(aRecord));
249+ message.append('\n');
250+
251+ // 例外エラーの場合、エラー内容とスタックトレース出力
252+ Throwable throwable = aRecord.getThrown();
253+ if (throwable != null) {
254+ message.append(throwable.toString());
255+ message.append('\n');
256+ for (StackTraceElement trace : throwable.getStackTrace()) {
257+ message.append('\t');
258+ message.append(trace.toString());
259+ message.append('\n');
260+ }
261+ }
262+ return message.toString();
263+ }
264+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- branches/b3/WebScraping/src/WebScraping/HtmlParserCallback.java (nonexistent)
+++ branches/b3/WebScraping/src/WebScraping/HtmlParserCallback.java (revision 102)
@@ -0,0 +1,211 @@
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$
21+ */
22+
23+package WebScraping;
24+
25+import java.util.ArrayList;
26+import java.util.HashMap;
27+import javax.swing.text.MutableAttributeSet;
28+import javax.swing.text.html.HTML;
29+import javax.swing.text.html.HTMLEditorKit;
30+
31+/**
32+ * HTMLパーサ部品.
33+ * @author kgto
34+ */
35+class HtmlParserCallback extends HTMLEditorKit.ParserCallback {
36+
37+ // Tag毎の階層
38+ HashMap<HTML.Tag,Integer> tagMap = new HashMap<>();
39+
40+ // serach key 情報
41+ String keytag;
42+ String keyid;
43+ String keyclass;
44+
45+ // serach key と一致時の情報退避
46+ int bufCount = 0;
47+ HTML.Tag bufTag = null;
48+ // serach key と一致時の情報格納ワーク
49+ StringBuilder bufText;
50+
51+ // serach key と一致時のデータ一覧
52+ ArrayList sData;
53+
54+ // 属性データ
55+ AttributeData attrdata;
56+
57+ protected HtmlParserCallback(SearchData skey) {
58+
59+ // キー情報展開
60+ keytag = skey.getHtmltag();
61+ keyid = skey.getHtmlid();
62+ keyclass = skey.getHtmlclass();
63+
64+ sData = new ArrayList();
65+ }
66+
67+ ArrayList getrtnData() {
68+ return this.sData;
69+ }
70+
71+ @Override
72+ public void handleStartTag(HTML.Tag tag, MutableAttributeSet attr, int pos){
73+ // Tag毎の階層を保持
74+ int count = 1;
75+ if(tagMap.containsKey(tag)) {
76+ count = tagMap.get(tag);
77+ count++;
78+ }
79+ tagMap.put(tag, count);
80+
81+ // 属性解析
82+ AttributeData handleStartattrdata = new AttributeData();
83+ handleStartattrdata.add(tag, attr);
84+
85+ DebugProcess.htmlinfo(tag, attr, "handleStartTag", count);
86+
87+ if(bufCount == 0) {
88+ if(tag.toString().equals(keytag)) {
89+ //if(serachAttribute(attr)) {
90+ if(serachAttribute(tag, handleStartattrdata)) {
91+ bufCount = count;
92+ bufTag = tag;
93+ attrdata = new AttributeData();
94+ bufText = new StringBuilder();
95+ }
96+ }
97+ }
98+ if(bufCount > 0) {
99+ attrdata.add(tag, attr);
100+ }
101+ }
102+
103+ @Override
104+ public void handleEndTag(HTML.Tag tag, int pos){
105+ // Tag毎の階層を取得
106+ int count = 0;
107+ if(tagMap.containsKey(tag)) {
108+ count = tagMap.get(tag);
109+ }
110+
111+ DebugProcess.htmlinfo(tag, null, "handleEndTag", count);
112+
113+ if(tag.equals(bufTag) && count <= bufCount) {
114+
115+ // 溜め込んだ一致情報をリストへ格納
116+ sData.add(bufText.toString());
117+
118+ // 退避したserach keyとの一致情報クリア
119+ bufCount = 0;
120+ bufTag = null;
121+ bufText = null;
122+ }
123+
124+ // Tag毎の階層減算
125+ tagMap.put(tag, --count);
126+ }
127+
128+ @Override
129+ public void handleText(char[] data, int pos){
130+
131+ DebugProcess.htmlinfo(data, "handleText");
132+
133+ String splitchar = "\t";
134+ //制御文字の削除
135+ // &nbsp; 0xa0
136+ StringBuilder buf = new StringBuilder();
137+ for(int i = 0; i < data.length; i++) {
138+ if(data[i] > 0x1f && data[i] != 0x7f && data[i] != 0xa0) {
139+ buf.append(data[i]);
140+ }
141+ }
142+ if(bufCount > 0) {
143+ if(bufText.length() > 0) {
144+ bufText.append(splitchar);
145+ }
146+ bufText.append(buf.toString());
147+ }
148+ }
149+
150+ @Override
151+ public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attr, int pos){
152+ if(bufCount > 0) {
153+ attrdata.add(tag, attr);
154+ }
155+ DebugProcess.htmlinfo(tag, attr, "handleSimpleTag", 0);
156+ }
157+
158+ /**
159+ * ページ内のID/CLASS値と検索キーを比較する.
160+ * @param attr ページのMutableAttributeSet
161+ * @return boolean 検索キーと一致の時、true
162+ */
163+ boolean serachAttribute(MutableAttributeSet attr) {
164+ String currentID = (String)attr.getAttribute(HTML.Attribute.ID);
165+ String currentClass = (String)attr.getAttribute(HTML.Attribute.CLASS);
166+
167+ if(keyid.isEmpty() == false && keyclass.isEmpty() == false) {
168+ if(keyid.equals(currentID) && keyclass.equals(currentClass)) {
169+ return true;
170+ }
171+ }
172+
173+ if(keyid.isEmpty() == false) {
174+ if(keyid.equals(currentID)) {
175+ return true;
176+ }
177+ }
178+
179+ if(keyclass.isEmpty() == false) {
180+ if(keyclass.equals(currentClass)) {
181+ return true;
182+ }
183+ }
184+
185+ return false;
186+ }
187+
188+ /**
189+ * ページ内のID/CLASS値と検索キーを比較する.
190+ * @param tag
191+ * @param attrdata
192+ * @return boolean 検索キーと一致の時、true
193+ */
194+ boolean serachAttribute(HTML.Tag tag, AttributeData attrdata) {
195+ // ID と CLASS の両方にキー入力有りの場合
196+ if(keyid.isEmpty() == false && keyclass.isEmpty() == false) {
197+ if(attrdata.searchId(tag, keyid) && attrdata.searchClass(tag, keyclass)) {
198+ return true;
199+ }
200+ }
201+ // ID のキーチェック
202+ if(keyid.isEmpty() == false) {
203+ return attrdata.searchId(tag, keyid);
204+ }
205+ // CLASS のキーチェック
206+ if(keyclass.isEmpty() == false) {
207+ return attrdata.searchClass(tag, keyclass);
208+ }
209+ return false;
210+ }
211+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- branches/b3/WebScraping/src/WebScraping/AttributeData.java (nonexistent)
+++ branches/b3/WebScraping/src/WebScraping/AttributeData.java (revision 102)
@@ -0,0 +1,163 @@
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$
21+ */
22+
23+package WebScraping;
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+ ret = true;
81+ }
82+ }
83+ }
84+ return ret;
85+ }
86+
87+ public boolean searchId(HTML.Tag tag, String attrvalue) {
88+ return search(tag, "id", attrvalue);
89+ }
90+
91+ public boolean searchClass(HTML.Tag tag, String attrvalue) {
92+ return search(tag, "class", attrvalue);
93+ }
94+
95+ /**
96+ * 属性の値を取得する.
97+ * @param tag
98+ * @param attrname
99+ * @return
100+ */
101+ public ArrayList getvale(HTML.Tag tag, String attrname) {
102+ ArrayList ret = new ArrayList();
103+ for (Object AttrList1 : AttrList) {
104+ AttrData a = (AttrData)AttrList1;
105+ if(a.tag == tag) {
106+ if(a.attrname.equals(attrname)) {
107+ ret.add(a.attrvalue);
108+ }
109+ }
110+ }
111+ return ret;
112+ }
113+
114+ /**
115+ * 引数で渡されたTAGの最新カウント数を返す.
116+ * @param tag
117+ * @return
118+ */
119+ private int tagcnt(HTML.Tag tag) {
120+ int wkcnt = 0;
121+ for (Object AttrList1 : AttrList) {
122+ AttrData a = (AttrData)AttrList1;
123+ if(a.tag == tag) {
124+ if(wkcnt < a.count) {
125+ wkcnt = a.count;
126+ }
127+ }
128+ }
129+ return wkcnt;
130+ }
131+
132+ // AttrList の内容を返すメソッド
133+ public HTML.Tag gettag(int i) {
134+ AttrData a = (AttrData)AttrList.get(i);
135+ return a.tag;
136+ }
137+
138+ public int getcount(int i) {
139+ AttrData a = (AttrData)AttrList.get(i);
140+ return a.count;
141+ }
142+
143+ public String getattrname(int i) {
144+ AttrData a = (AttrData)AttrList.get(i);
145+ return a.attrname;
146+ }
147+
148+ public String getattrvalue(int i) {
149+ AttrData a = (AttrData)AttrList.get(i);
150+ return a.attrvalue;
151+ }
152+
153+ // フィールド変数
154+ public class AttrData {
155+ public HTML.Tag tag;
156+ public int count;
157+ public String attrname;
158+ public String attrvalue;
159+ }
160+ public ArrayList AttrList;
161+ public int size; // AttrListのサイズ
162+
163+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- branches/b3/WebScraping/data/Yahoo!天気.xml (nonexistent)
+++ branches/b3/WebScraping/data/Yahoo!天気.xml (revision 102)
@@ -0,0 +1,108 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<searchdata>
3+ <url>http://weather.yahoo.co.jp/weather/</url>
4+ <searchlist>
5+ <item>天気01</item>
6+ <htmltag>li</htmltag>
7+ <htmlid/>
8+ <htmlclass>point pt1400</htmlclass>
9+ <around/>
10+ <regexp/>
11+ </searchlist>
12+ <searchlist>
13+ <item>天気02</item>
14+ <htmltag>li</htmltag>
15+ <htmlid/>
16+ <htmlclass>point pt1900</htmlclass>
17+ <around/>
18+ <regexp/>
19+ </searchlist>
20+ <searchlist>
21+ <item>天気03</item>
22+ <htmltag>li</htmltag>
23+ <htmlid/>
24+ <htmlclass>point pt3410</htmlclass>
25+ <around/>
26+ <regexp/>
27+ </searchlist>
28+ <searchlist>
29+ <item>天気04</item>
30+ <htmltag>li</htmltag>
31+ <htmlid/>
32+ <htmlclass>point pt4410</htmlclass>
33+ <around/>
34+ <regexp/>
35+ </searchlist>
36+ <searchlist>
37+ <item>天気05</item>
38+ <htmltag>li</htmltag>
39+ <htmlid/>
40+ <htmlclass>point pt5110</htmlclass>
41+ <around/>
42+ <regexp/>
43+ </searchlist>
44+ <searchlist>
45+ <item>天気06</item>
46+ <htmltag>li</htmltag>
47+ <htmlid/>
48+ <htmlclass>point pt5410</htmlclass>
49+ <around/>
50+ <regexp/>
51+ </searchlist>
52+ <searchlist>
53+ <item>天気07</item>
54+ <htmltag>li</htmltag>
55+ <htmlid/>
56+ <htmlclass>point pt5610</htmlclass>
57+ <around/>
58+ <regexp/>
59+ </searchlist>
60+ <searchlist>
61+ <item>天気08</item>
62+ <htmltag>li</htmltag>
63+ <htmlid/>
64+ <htmlclass>point pt6200</htmlclass>
65+ <around/>
66+ <regexp/>
67+ </searchlist>
68+ <searchlist>
69+ <item>天気09</item>
70+ <htmltag>li</htmltag>
71+ <htmlid/>
72+ <htmlclass>point pt6710</htmlclass>
73+ <around/>
74+ <regexp/>
75+ </searchlist>
76+ <searchlist>
77+ <item>天気10</item>
78+ <htmltag>li</htmltag>
79+ <htmlid/>
80+ <htmlclass>point pt7410</htmlclass>
81+ <around/>
82+ <regexp/>
83+ </searchlist>
84+ <searchlist>
85+ <item>天気11</item>
86+ <htmltag>li</htmltag>
87+ <htmlid/>
88+ <htmlclass>point pt8210</htmlclass>
89+ <around/>
90+ <regexp/>
91+ </searchlist>
92+ <searchlist>
93+ <item>天気12</item>
94+ <htmltag>li</htmltag>
95+ <htmlid/>
96+ <htmlclass>point pt8810</htmlclass>
97+ <around/>
98+ <regexp/>
99+ </searchlist>
100+ <searchlist>
101+ <item>天気13</item>
102+ <htmltag>li</htmltag>
103+ <htmlid/>
104+ <htmlclass>point pt9110</htmlclass>
105+ <around/>
106+ <regexp/>
107+ </searchlist>
108+</searchdata>
\ No newline at end of file
--- branches/b3/WebScraping/data/Yahoo!ファイナンス.xml (nonexistent)
+++ branches/b3/WebScraping/data/Yahoo!ファイナンス.xml (revision 102)
@@ -0,0 +1 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?><searchdata><url>http://stocks.finance.yahoo.co.jp/stocks/detail/?code=9984.T</url><searchlist><item>銘柄コード</item><htmltag>dl</htmltag><htmlid/><htmlclass>stocksInfo clearFix</htmlclass><around/><regexp>(^\d{4})</regexp></searchlist><searchlist><item>カテゴリ</item><htmltag>div</htmltag><htmlid/><htmlclass>stockMainTabParts stockMainTabPartsCurrent</htmlclass><around/><regexp/></searchlist><searchlist><item>業種</item><htmltag>dd</htmltag><htmlid/><htmlclass>category yjSb</htmlclass><around/><regexp/></searchlist><searchlist><item>取得時間</item><htmltag>dd</htmltag><htmlid/><htmlclass>yjSb real</htmlclass><around/><regexp>^(.*)\t</regexp></searchlist><searchlist><item>銘柄名</item><htmltag>th</htmltag><htmlid/><htmlclass>symbol</htmlclass><around/><regexp/></searchlist><searchlist><item>株価</item><htmltag>td</htmltag><htmlid/><htmlclass>stoksPrice</htmlclass><around/><regexp/></searchlist><searchlist><item>前日比</item><htmltag>td</htmltag><htmlid/><htmlclass>change</htmlclass><around/><regexp>\t(.*)(.*%)</regexp></searchlist><searchlist><item>前日比%</item><htmltag>td</htmltag><htmlid/><htmlclass>change</htmlclass><around/><regexp>\t.*((.*)%)</regexp></searchlist><searchlist><item>前日終値</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi clearfix</htmlclass><around>0</around><regexp>^([,0-9]+)\t</regexp></searchlist><searchlist><item>始値</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi clearfix</htmlclass><around>1</around><regexp>^([,0-9]+|-{3})\t</regexp></searchlist><searchlist><item>高値</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi clearfix</htmlclass><around>2</around><regexp>^([,0-9]+|-{3})\t</regexp></searchlist><searchlist><item>安値</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi clearfix</htmlclass><around>3</around><regexp>^([,0-9]+|-{3})\t</regexp></searchlist><searchlist><item>出来高</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi clearfix</htmlclass><around>4</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>売買代金</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi clearfix</htmlclass><around>5</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>値幅制限</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi clearfix</htmlclass><around>6</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>時価総額</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>0</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>発行済株式数</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>1</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>配当利回り</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>2</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>1株配当</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>3</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>PER</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>4</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>PBR</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>5</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>EPS</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>6</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>BPS</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>7</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>最低購入代金</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>8</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>単元株数</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>9</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>年初来高値</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>10</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>年初来安値</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>11</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>信用買残</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>12</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>信用買残前週比</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>13</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>信用売残</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>14</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>信用売残前週比</item><htmltag>div</htmltag><htmlid/><htmlclass>lineFi yjMS clearfix</htmlclass><around>15</around><regexp>^(.*?)\t</regexp></searchlist><searchlist><item>貸借倍率</item><htmltag>div</htmltag><htmlid/><htmlclass>yjMS clearfix</htmlclass><around/><regexp>^(.*?)\t</regexp></searchlist></searchdata>
\ No newline at end of file
--- branches/b3/WebScraping/data/Yahoo!天気.txt (nonexistent)
+++ branches/b3/WebScraping/data/Yahoo!天気.txt (revision 102)
@@ -0,0 +1,14 @@
1+http://weather.yahoo.co.jp/weather/
2+天気01 li point pt1400
3+天気02 li point pt1900
4+天気03 li point pt3410
5+天気04 li point pt4410
6+天気05 li point pt5110
7+天気06 li point pt5410
8+天気07 li point pt5610
9+天気08 li point pt6200
10+天気09 li point pt6710
11+天気10 li point pt7410
12+天気11 li point pt8210
13+天気12 li point pt8810
14+天気13 li point pt9110
--- branches/b3/WebScraping/data/Yahoo!ファイナンス.txt (nonexistent)
+++ branches/b3/WebScraping/data/Yahoo!ファイナンス.txt (revision 102)
@@ -0,0 +1,33 @@
1+http://stocks.finance.yahoo.co.jp/stocks/detail/?code=9984.T
2+銘柄コード dl stocksInfo clearFix (^\d{4})
3+カテゴリ div stockMainTabParts stockMainTabPartsCurrent
4+業種 dd category yjSb
5+取得時間 dd yjSb real ^(.*)\t
6+銘柄名 th symbol
7+株価 td stoksPrice
8+前日比 td change \t(.*)(.*%)
9+前日比% td change \t.*((.*)%)
10+前日終値 div lineFi clearfix 0 ^([,0-9]+)\t
11+始値 div lineFi clearfix 1 ^([,0-9]+|-{3})\t
12+高値 div lineFi clearfix 2 ^([,0-9]+|-{3})\t
13+安値 div lineFi clearfix 3 ^([,0-9]+|-{3})\t
14+出来高 div lineFi clearfix 4 ^(.*?)\t
15+売買代金 div lineFi clearfix 5 ^(.*?)\t
16+値幅制限 div lineFi clearfix 6 ^(.*?)\t
17+時価総額 div lineFi yjMS clearfix 0 ^(.*?)\t
18+発行済株式数 div lineFi yjMS clearfix 1 ^(.*?)\t
19+配当利回り div lineFi yjMS clearfix 2 ^(.*?)\t
20+1株配当 div lineFi yjMS clearfix 3 ^(.*?)\t
21+PER div lineFi yjMS clearfix 4 ^(.*?)\t
22+PBR div lineFi yjMS clearfix 5 ^(.*?)\t
23+EPS div lineFi yjMS clearfix 6 ^(.*?)\t
24+BPS div lineFi yjMS clearfix 7 ^(.*?)\t
25+最低購入代金 div lineFi yjMS clearfix 8 ^(.*?)\t
26+単元株数 div lineFi yjMS clearfix 9 ^(.*?)\t
27+年初来高値 div lineFi yjMS clearfix 10 ^(.*?)\t
28+年初来安値 div lineFi yjMS clearfix 11 ^(.*?)\t
29+信用買残 div lineFi yjMS clearfix 12 ^(.*?)\t
30+信用買残前週比 div lineFi yjMS clearfix 13 ^(.*?)\t
31+信用売残 div lineFi yjMS clearfix 14 ^(.*?)\t
32+信用売残前週比 div lineFi yjMS clearfix 15 ^(.*?)\t
33+貸借倍率 div yjMS clearfix ^(.*?)\t
--- branches/b3/WebScraping/nbproject/project.xml (nonexistent)
+++ branches/b3/WebScraping/nbproject/project.xml (revision 102)
@@ -0,0 +1,15 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<project xmlns="http://www.netbeans.org/ns/project/1">
3+ <type>org.netbeans.modules.java.j2seproject</type>
4+ <configuration>
5+ <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
6+ <name>WebScraping</name>
7+ <source-roots>
8+ <root id="src.dir"/>
9+ </source-roots>
10+ <test-roots>
11+ <root id="test.src.dir"/>
12+ </test-roots>
13+ </data>
14+ </configuration>
15+</project>
--- branches/b3/WebScraping/nbproject/build-impl.xml (nonexistent)
+++ branches/b3/WebScraping/nbproject/build-impl.xml (revision 102)
@@ -0,0 +1,1413 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<!--
3+*** GENERATED FROM project.xml - DO NOT EDIT ***
4+*** EDIT ../build.xml INSTEAD ***
5+
6+For the purpose of easier reading the script
7+is divided into following sections:
8+
9+ - initialization
10+ - compilation
11+ - jar
12+ - execution
13+ - debugging
14+ - javadoc
15+ - test compilation
16+ - test execution
17+ - test debugging
18+ - applet
19+ - cleanup
20+
21+ -->
22+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="WebScraping-impl">
23+ <fail message="Please build using Ant 1.8.0 or higher.">
24+ <condition>
25+ <not>
26+ <antversion atleast="1.8.0"/>
27+ </not>
28+ </condition>
29+ </fail>
30+ <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
31+ <!--
32+ ======================
33+ INITIALIZATION SECTION
34+ ======================
35+ -->
36+ <target name="-pre-init">
37+ <!-- Empty placeholder for easier customization. -->
38+ <!-- You can override this target in the ../build.xml file. -->
39+ </target>
40+ <target depends="-pre-init" name="-init-private">
41+ <property file="nbproject/private/config.properties"/>
42+ <property file="nbproject/private/configs/${config}.properties"/>
43+ <property file="nbproject/private/private.properties"/>
44+ </target>
45+ <target depends="-pre-init,-init-private" name="-init-user">
46+ <property file="${user.properties.file}"/>
47+ <!-- The two properties below are usually overridden -->
48+ <!-- by the active platform. Just a fallback. -->
49+ <property name="default.javac.source" value="1.4"/>
50+ <property name="default.javac.target" value="1.4"/>
51+ </target>
52+ <target depends="-pre-init,-init-private,-init-user" name="-init-project">
53+ <property file="nbproject/configs/${config}.properties"/>
54+ <property file="nbproject/project.properties"/>
55+ </target>
56+ <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
57+ <property name="platform.java" value="${java.home}/bin/java"/>
58+ <available file="${manifest.file}" property="manifest.available"/>
59+ <condition property="splashscreen.available">
60+ <and>
61+ <not>
62+ <equals arg1="${application.splash}" arg2="" trim="true"/>
63+ </not>
64+ <available file="${application.splash}"/>
65+ </and>
66+ </condition>
67+ <condition property="main.class.available">
68+ <and>
69+ <isset property="main.class"/>
70+ <not>
71+ <equals arg1="${main.class}" arg2="" trim="true"/>
72+ </not>
73+ </and>
74+ </condition>
75+ <condition property="profile.available">
76+ <and>
77+ <isset property="javac.profile"/>
78+ <length length="0" string="${javac.profile}" when="greater"/>
79+ <matches pattern="1\.[89](\..*)?" string="${javac.source}"/>
80+ </and>
81+ </condition>
82+ <condition property="do.archive">
83+ <or>
84+ <not>
85+ <istrue value="${jar.archive.disabled}"/>
86+ </not>
87+ <istrue value="${not.archive.disabled}"/>
88+ </or>
89+ </condition>
90+ <condition property="do.mkdist">
91+ <and>
92+ <isset property="do.archive"/>
93+ <isset property="libs.CopyLibs.classpath"/>
94+ <not>
95+ <istrue value="${mkdist.disabled}"/>
96+ </not>
97+ </and>
98+ </condition>
99+ <condition property="do.archive+manifest.available">
100+ <and>
101+ <isset property="manifest.available"/>
102+ <istrue value="${do.archive}"/>
103+ </and>
104+ </condition>
105+ <condition property="do.archive+main.class.available">
106+ <and>
107+ <isset property="main.class.available"/>
108+ <istrue value="${do.archive}"/>
109+ </and>
110+ </condition>
111+ <condition property="do.archive+splashscreen.available">
112+ <and>
113+ <isset property="splashscreen.available"/>
114+ <istrue value="${do.archive}"/>
115+ </and>
116+ </condition>
117+ <condition property="do.archive+profile.available">
118+ <and>
119+ <isset property="profile.available"/>
120+ <istrue value="${do.archive}"/>
121+ </and>
122+ </condition>
123+ <condition property="have.tests">
124+ <or>
125+ <available file="${test.src.dir}"/>
126+ </or>
127+ </condition>
128+ <condition property="have.sources">
129+ <or>
130+ <available file="${src.dir}"/>
131+ </or>
132+ </condition>
133+ <condition property="netbeans.home+have.tests">
134+ <and>
135+ <isset property="netbeans.home"/>
136+ <isset property="have.tests"/>
137+ </and>
138+ </condition>
139+ <condition property="no.javadoc.preview">
140+ <and>
141+ <isset property="javadoc.preview"/>
142+ <isfalse value="${javadoc.preview}"/>
143+ </and>
144+ </condition>
145+ <property name="run.jvmargs" value=""/>
146+ <property name="run.jvmargs.ide" value=""/>
147+ <property name="javac.compilerargs" value=""/>
148+ <property name="work.dir" value="${basedir}"/>
149+ <condition property="no.deps">
150+ <and>
151+ <istrue value="${no.dependencies}"/>
152+ </and>
153+ </condition>
154+ <property name="javac.debug" value="true"/>
155+ <property name="javadoc.preview" value="true"/>
156+ <property name="application.args" value=""/>
157+ <property name="source.encoding" value="${file.encoding}"/>
158+ <property name="runtime.encoding" value="${source.encoding}"/>
159+ <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
160+ <and>
161+ <isset property="javadoc.encoding"/>
162+ <not>
163+ <equals arg1="${javadoc.encoding}" arg2=""/>
164+ </not>
165+ </and>
166+ </condition>
167+ <property name="javadoc.encoding.used" value="${source.encoding}"/>
168+ <property name="includes" value="**"/>
169+ <property name="excludes" value=""/>
170+ <property name="do.depend" value="false"/>
171+ <condition property="do.depend.true">
172+ <istrue value="${do.depend}"/>
173+ </condition>
174+ <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
175+ <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
176+ <and>
177+ <isset property="endorsed.classpath"/>
178+ <not>
179+ <equals arg1="${endorsed.classpath}" arg2="" trim="true"/>
180+ </not>
181+ </and>
182+ </condition>
183+ <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}">
184+ <isset property="profile.available"/>
185+ </condition>
186+ <condition else="false" property="jdkBug6558476">
187+ <and>
188+ <matches pattern="1\.[56]" string="${java.specification.version}"/>
189+ <not>
190+ <os family="unix"/>
191+ </not>
192+ </and>
193+ </condition>
194+ <property name="javac.fork" value="${jdkBug6558476}"/>
195+ <property name="jar.index" value="false"/>
196+ <property name="jar.index.metainf" value="${jar.index}"/>
197+ <property name="copylibs.rebase" value="true"/>
198+ <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
199+ <condition property="junit.available">
200+ <or>
201+ <available classname="org.junit.Test" classpath="${run.test.classpath}"/>
202+ <available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
203+ </or>
204+ </condition>
205+ <condition property="testng.available">
206+ <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
207+ </condition>
208+ <condition property="junit+testng.available">
209+ <and>
210+ <istrue value="${junit.available}"/>
211+ <istrue value="${testng.available}"/>
212+ </and>
213+ </condition>
214+ <condition else="testng" property="testng.mode" value="mixed">
215+ <istrue value="${junit+testng.available}"/>
216+ </condition>
217+ <condition else="" property="testng.debug.mode" value="-mixed">
218+ <istrue value="${junit+testng.available}"/>
219+ </condition>
220+ </target>
221+ <target name="-post-init">
222+ <!-- Empty placeholder for easier customization. -->
223+ <!-- You can override this target in the ../build.xml file. -->
224+ </target>
225+ <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
226+ <fail unless="src.dir">Must set src.dir</fail>
227+ <fail unless="test.src.dir">Must set test.src.dir</fail>
228+ <fail unless="build.dir">Must set build.dir</fail>
229+ <fail unless="dist.dir">Must set dist.dir</fail>
230+ <fail unless="build.classes.dir">Must set build.classes.dir</fail>
231+ <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
232+ <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
233+ <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
234+ <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
235+ <fail unless="dist.jar">Must set dist.jar</fail>
236+ </target>
237+ <target name="-init-macrodef-property">
238+ <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
239+ <attribute name="name"/>
240+ <attribute name="value"/>
241+ <sequential>
242+ <property name="@{name}" value="${@{value}}"/>
243+ </sequential>
244+ </macrodef>
245+ </target>
246+ <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
247+ <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
248+ <attribute default="${src.dir}" name="srcdir"/>
249+ <attribute default="${build.classes.dir}" name="destdir"/>
250+ <attribute default="${javac.classpath}" name="classpath"/>
251+ <attribute default="${javac.processorpath}" name="processorpath"/>
252+ <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
253+ <attribute default="${includes}" name="includes"/>
254+ <attribute default="${excludes}" name="excludes"/>
255+ <attribute default="${javac.debug}" name="debug"/>
256+ <attribute default="${empty.dir}" name="sourcepath"/>
257+ <attribute default="${empty.dir}" name="gensrcdir"/>
258+ <element name="customize" optional="true"/>
259+ <sequential>
260+ <property location="${build.dir}/empty" name="empty.dir"/>
261+ <mkdir dir="${empty.dir}"/>
262+ <mkdir dir="@{apgeneratedsrcdir}"/>
263+ <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
264+ <src>
265+ <dirset dir="@{gensrcdir}" erroronmissingdir="false">
266+ <include name="*"/>
267+ </dirset>
268+ </src>
269+ <classpath>
270+ <path path="@{classpath}"/>
271+ </classpath>
272+ <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
273+ <compilerarg line="${javac.profile.cmd.line.arg}"/>
274+ <compilerarg line="${javac.compilerargs}"/>
275+ <compilerarg value="-processorpath"/>
276+ <compilerarg path="@{processorpath}:${empty.dir}"/>
277+ <compilerarg line="${ap.processors.internal}"/>
278+ <compilerarg line="${annotation.processing.processor.options}"/>
279+ <compilerarg value="-s"/>
280+ <compilerarg path="@{apgeneratedsrcdir}"/>
281+ <compilerarg line="${ap.proc.none.internal}"/>
282+ <customize/>
283+ </javac>
284+ </sequential>
285+ </macrodef>
286+ </target>
287+ <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
288+ <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
289+ <attribute default="${src.dir}" name="srcdir"/>
290+ <attribute default="${build.classes.dir}" name="destdir"/>
291+ <attribute default="${javac.classpath}" name="classpath"/>
292+ <attribute default="${javac.processorpath}" name="processorpath"/>
293+ <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
294+ <attribute default="${includes}" name="includes"/>
295+ <attribute default="${excludes}" name="excludes"/>
296+ <attribute default="${javac.debug}" name="debug"/>
297+ <attribute default="${empty.dir}" name="sourcepath"/>
298+ <attribute default="${empty.dir}" name="gensrcdir"/>
299+ <element name="customize" optional="true"/>
300+ <sequential>
301+ <property location="${build.dir}/empty" name="empty.dir"/>
302+ <mkdir dir="${empty.dir}"/>
303+ <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
304+ <src>
305+ <dirset dir="@{gensrcdir}" erroronmissingdir="false">
306+ <include name="*"/>
307+ </dirset>
308+ </src>
309+ <classpath>
310+ <path path="@{classpath}"/>
311+ </classpath>
312+ <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
313+ <compilerarg line="${javac.profile.cmd.line.arg}"/>
314+ <compilerarg line="${javac.compilerargs}"/>
315+ <customize/>
316+ </javac>
317+ </sequential>
318+ </macrodef>
319+ </target>
320+ <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
321+ <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
322+ <attribute default="${src.dir}" name="srcdir"/>
323+ <attribute default="${build.classes.dir}" name="destdir"/>
324+ <attribute default="${javac.classpath}" name="classpath"/>
325+ <sequential>
326+ <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
327+ <classpath>
328+ <path path="@{classpath}"/>
329+ </classpath>
330+ </depend>
331+ </sequential>
332+ </macrodef>
333+ <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
334+ <attribute default="${build.classes.dir}" name="destdir"/>
335+ <sequential>
336+ <fail unless="javac.includes">Must set javac.includes</fail>
337+ <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
338+ <path>
339+ <filelist dir="@{destdir}" files="${javac.includes}"/>
340+ </path>
341+ <globmapper from="*.java" to="*.class"/>
342+ </pathconvert>
343+ <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
344+ <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
345+ <delete>
346+ <files includesfile="${javac.includesfile.binary}"/>
347+ </delete>
348+ <delete>
349+ <fileset file="${javac.includesfile.binary}"/>
350+ </delete>
351+ </sequential>
352+ </macrodef>
353+ </target>
354+ <target if="${junit.available}" name="-init-macrodef-junit-init">
355+ <condition else="false" property="nb.junit.batch" value="true">
356+ <and>
357+ <istrue value="${junit.available}"/>
358+ <not>
359+ <isset property="test.method"/>
360+ </not>
361+ </and>
362+ </condition>
363+ <condition else="false" property="nb.junit.single" value="true">
364+ <and>
365+ <istrue value="${junit.available}"/>
366+ <isset property="test.method"/>
367+ </and>
368+ </condition>
369+ </target>
370+ <target name="-init-test-properties">
371+ <property name="test.binaryincludes" value="&lt;nothing&gt;"/>
372+ <property name="test.binarytestincludes" value=""/>
373+ <property name="test.binaryexcludes" value=""/>
374+ </target>
375+ <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
376+ <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
377+ <attribute default="${includes}" name="includes"/>
378+ <attribute default="${excludes}" name="excludes"/>
379+ <attribute default="**" name="testincludes"/>
380+ <attribute default="" name="testmethods"/>
381+ <element name="customize" optional="true"/>
382+ <sequential>
383+ <property name="junit.forkmode" value="perTest"/>
384+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
385+ <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
386+ <syspropertyset>
387+ <propertyref prefix="test-sys-prop."/>
388+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
389+ </syspropertyset>
390+ <formatter type="brief" usefile="false"/>
391+ <formatter type="xml"/>
392+ <jvmarg value="-ea"/>
393+ <customize/>
394+ </junit>
395+ </sequential>
396+ </macrodef>
397+ </target>
398+ <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
399+ <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
400+ <attribute default="${includes}" name="includes"/>
401+ <attribute default="${excludes}" name="excludes"/>
402+ <attribute default="**" name="testincludes"/>
403+ <attribute default="" name="testmethods"/>
404+ <element name="customize" optional="true"/>
405+ <sequential>
406+ <property name="junit.forkmode" value="perTest"/>
407+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
408+ <batchtest todir="${build.test.results.dir}">
409+ <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
410+ <filename name="@{testincludes}"/>
411+ </fileset>
412+ <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
413+ <filename name="${test.binarytestincludes}"/>
414+ </fileset>
415+ </batchtest>
416+ <syspropertyset>
417+ <propertyref prefix="test-sys-prop."/>
418+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
419+ </syspropertyset>
420+ <formatter type="brief" usefile="false"/>
421+ <formatter type="xml"/>
422+ <jvmarg value="-ea"/>
423+ <customize/>
424+ </junit>
425+ </sequential>
426+ </macrodef>
427+ </target>
428+ <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
429+ <target if="${testng.available}" name="-init-macrodef-testng">
430+ <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3">
431+ <attribute default="${includes}" name="includes"/>
432+ <attribute default="${excludes}" name="excludes"/>
433+ <attribute default="**" name="testincludes"/>
434+ <attribute default="" name="testmethods"/>
435+ <element name="customize" optional="true"/>
436+ <sequential>
437+ <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
438+ <isset property="test.method"/>
439+ </condition>
440+ <union id="test.set">
441+ <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
442+ <filename name="@{testincludes}"/>
443+ </fileset>
444+ </union>
445+ <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
446+ <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="WebScraping" testname="TestNG tests" workingDir="${work.dir}">
447+ <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
448+ <propertyset>
449+ <propertyref prefix="test-sys-prop."/>
450+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
451+ </propertyset>
452+ <customize/>
453+ </testng>
454+ </sequential>
455+ </macrodef>
456+ </target>
457+ <target name="-init-macrodef-test-impl">
458+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
459+ <attribute default="${includes}" name="includes"/>
460+ <attribute default="${excludes}" name="excludes"/>
461+ <attribute default="**" name="testincludes"/>
462+ <attribute default="" name="testmethods"/>
463+ <element implicit="true" name="customize" optional="true"/>
464+ <sequential>
465+ <echo>No tests executed.</echo>
466+ </sequential>
467+ </macrodef>
468+ </target>
469+ <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
470+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
471+ <attribute default="${includes}" name="includes"/>
472+ <attribute default="${excludes}" name="excludes"/>
473+ <attribute default="**" name="testincludes"/>
474+ <attribute default="" name="testmethods"/>
475+ <element implicit="true" name="customize" optional="true"/>
476+ <sequential>
477+ <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
478+ <customize/>
479+ </j2seproject3:junit>
480+ </sequential>
481+ </macrodef>
482+ </target>
483+ <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
484+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
485+ <attribute default="${includes}" name="includes"/>
486+ <attribute default="${excludes}" name="excludes"/>
487+ <attribute default="**" name="testincludes"/>
488+ <attribute default="" name="testmethods"/>
489+ <element implicit="true" name="customize" optional="true"/>
490+ <sequential>
491+ <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
492+ <customize/>
493+ </j2seproject3:testng>
494+ </sequential>
495+ </macrodef>
496+ </target>
497+ <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
498+ <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3">
499+ <attribute default="${includes}" name="includes"/>
500+ <attribute default="${excludes}" name="excludes"/>
501+ <attribute default="**" name="testincludes"/>
502+ <attribute default="" name="testmethods"/>
503+ <sequential>
504+ <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
505+ <customize>
506+ <classpath>
507+ <path path="${run.test.classpath}"/>
508+ </classpath>
509+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
510+ <jvmarg line="${run.jvmargs}"/>
511+ <jvmarg line="${run.jvmargs.ide}"/>
512+ </customize>
513+ </j2seproject3:test-impl>
514+ </sequential>
515+ </macrodef>
516+ </target>
517+ <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
518+ <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
519+ <attribute default="${includes}" name="includes"/>
520+ <attribute default="${excludes}" name="excludes"/>
521+ <attribute default="**" name="testincludes"/>
522+ <attribute default="" name="testmethods"/>
523+ <element name="customize" optional="true"/>
524+ <sequential>
525+ <property name="junit.forkmode" value="perTest"/>
526+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
527+ <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
528+ <syspropertyset>
529+ <propertyref prefix="test-sys-prop."/>
530+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
531+ </syspropertyset>
532+ <formatter type="brief" usefile="false"/>
533+ <formatter type="xml"/>
534+ <jvmarg value="-ea"/>
535+ <jvmarg line="${debug-args-line}"/>
536+ <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
537+ <customize/>
538+ </junit>
539+ </sequential>
540+ </macrodef>
541+ </target>
542+ <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
543+ <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
544+ <attribute default="${includes}" name="includes"/>
545+ <attribute default="${excludes}" name="excludes"/>
546+ <attribute default="**" name="testincludes"/>
547+ <attribute default="" name="testmethods"/>
548+ <element name="customize" optional="true"/>
549+ <sequential>
550+ <property name="junit.forkmode" value="perTest"/>
551+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
552+ <batchtest todir="${build.test.results.dir}">
553+ <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
554+ <filename name="@{testincludes}"/>
555+ </fileset>
556+ <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
557+ <filename name="${test.binarytestincludes}"/>
558+ </fileset>
559+ </batchtest>
560+ <syspropertyset>
561+ <propertyref prefix="test-sys-prop."/>
562+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
563+ </syspropertyset>
564+ <formatter type="brief" usefile="false"/>
565+ <formatter type="xml"/>
566+ <jvmarg value="-ea"/>
567+ <jvmarg line="${debug-args-line}"/>
568+ <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
569+ <customize/>
570+ </junit>
571+ </sequential>
572+ </macrodef>
573+ </target>
574+ <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
575+ <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
576+ <attribute default="${includes}" name="includes"/>
577+ <attribute default="${excludes}" name="excludes"/>
578+ <attribute default="**" name="testincludes"/>
579+ <attribute default="" name="testmethods"/>
580+ <element implicit="true" name="customize" optional="true"/>
581+ <sequential>
582+ <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
583+ <customize/>
584+ </j2seproject3:junit-debug>
585+ </sequential>
586+ </macrodef>
587+ </target>
588+ <target if="${testng.available}" name="-init-macrodef-testng-debug">
589+ <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
590+ <attribute default="${main.class}" name="testClass"/>
591+ <attribute default="" name="testMethod"/>
592+ <element name="customize2" optional="true"/>
593+ <sequential>
594+ <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
595+ <isset property="test.method"/>
596+ </condition>
597+ <condition else="-suitename WebScraping -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
598+ <matches pattern=".*\.xml" string="@{testClass}"/>
599+ </condition>
600+ <delete dir="${build.test.results.dir}" quiet="true"/>
601+ <mkdir dir="${build.test.results.dir}"/>
602+ <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
603+ <customize>
604+ <customize2/>
605+ <jvmarg value="-ea"/>
606+ <arg line="${testng.debug.mode}"/>
607+ <arg line="-d ${build.test.results.dir}"/>
608+ <arg line="-listener org.testng.reporters.VerboseReporter"/>
609+ <arg line="${testng.cmd.args}"/>
610+ </customize>
611+ </j2seproject3:debug>
612+ </sequential>
613+ </macrodef>
614+ </target>
615+ <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
616+ <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
617+ <attribute default="${main.class}" name="testClass"/>
618+ <attribute default="" name="testMethod"/>
619+ <element implicit="true" name="customize2" optional="true"/>
620+ <sequential>
621+ <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
622+ <customize2/>
623+ </j2seproject3:testng-debug>
624+ </sequential>
625+ </macrodef>
626+ </target>
627+ <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
628+ <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
629+ <attribute default="${includes}" name="includes"/>
630+ <attribute default="${excludes}" name="excludes"/>
631+ <attribute default="**" name="testincludes"/>
632+ <attribute default="" name="testmethods"/>
633+ <attribute default="${main.class}" name="testClass"/>
634+ <attribute default="" name="testMethod"/>
635+ <sequential>
636+ <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
637+ <customize>
638+ <classpath>
639+ <path path="${run.test.classpath}"/>
640+ </classpath>
641+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
642+ <jvmarg line="${run.jvmargs}"/>
643+ <jvmarg line="${run.jvmargs.ide}"/>
644+ </customize>
645+ </j2seproject3:test-debug-impl>
646+ </sequential>
647+ </macrodef>
648+ </target>
649+ <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
650+ <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
651+ <attribute default="${includes}" name="includes"/>
652+ <attribute default="${excludes}" name="excludes"/>
653+ <attribute default="**" name="testincludes"/>
654+ <attribute default="" name="testmethods"/>
655+ <attribute default="${main.class}" name="testClass"/>
656+ <attribute default="" name="testMethod"/>
657+ <sequential>
658+ <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
659+ <customize2>
660+ <syspropertyset>
661+ <propertyref prefix="test-sys-prop."/>
662+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
663+ </syspropertyset>
664+ </customize2>
665+ </j2seproject3:testng-debug-impl>
666+ </sequential>
667+ </macrodef>
668+ </target>
669+ <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
670+ <!--
671+ pre NB7.2 profiling section; consider it deprecated
672+ -->
673+ <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
674+ <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
675+ <!-- Empty placeholder for easier customization. -->
676+ <!-- You can override this target in the ../build.xml file. -->
677+ </target>
678+ <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
679+ <!-- Empty placeholder for easier customization. -->
680+ <!-- You can override this target in the ../build.xml file. -->
681+ </target>
682+ <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
683+ <macrodef name="resolve">
684+ <attribute name="name"/>
685+ <attribute name="value"/>
686+ <sequential>
687+ <property name="@{name}" value="${env.@{value}}"/>
688+ </sequential>
689+ </macrodef>
690+ <macrodef name="profile">
691+ <attribute default="${main.class}" name="classname"/>
692+ <element name="customize" optional="true"/>
693+ <sequential>
694+ <property environment="env"/>
695+ <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
696+ <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
697+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
698+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
699+ <jvmarg line="${profiler.info.jvmargs}"/>
700+ <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
701+ <arg line="${application.args}"/>
702+ <classpath>
703+ <path path="${run.classpath}"/>
704+ </classpath>
705+ <syspropertyset>
706+ <propertyref prefix="run-sys-prop."/>
707+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
708+ </syspropertyset>
709+ <customize/>
710+ </java>
711+ </sequential>
712+ </macrodef>
713+ </target>
714+ <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
715+ <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
716+ <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
717+ </target>
718+ <!--
719+ end of pre NB7.2 profiling section
720+ -->
721+ <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
722+ <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
723+ <attribute default="${main.class}" name="name"/>
724+ <attribute default="${debug.classpath}" name="classpath"/>
725+ <attribute default="" name="stopclassname"/>
726+ <sequential>
727+ <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
728+ <classpath>
729+ <path path="@{classpath}"/>
730+ </classpath>
731+ </nbjpdastart>
732+ </sequential>
733+ </macrodef>
734+ <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
735+ <attribute default="${build.classes.dir}" name="dir"/>
736+ <sequential>
737+ <nbjpdareload>
738+ <fileset dir="@{dir}" includes="${fix.classes}">
739+ <include name="${fix.includes}*.class"/>
740+ </fileset>
741+ </nbjpdareload>
742+ </sequential>
743+ </macrodef>
744+ </target>
745+ <target name="-init-debug-args">
746+ <property name="version-output" value="java version &quot;${ant.java.version}"/>
747+ <condition property="have-jdk-older-than-1.4">
748+ <or>
749+ <contains string="${version-output}" substring="java version &quot;1.0"/>
750+ <contains string="${version-output}" substring="java version &quot;1.1"/>
751+ <contains string="${version-output}" substring="java version &quot;1.2"/>
752+ <contains string="${version-output}" substring="java version &quot;1.3"/>
753+ </or>
754+ </condition>
755+ <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
756+ <istrue value="${have-jdk-older-than-1.4}"/>
757+ </condition>
758+ <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
759+ <os family="windows"/>
760+ </condition>
761+ <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
762+ <isset property="debug.transport"/>
763+ </condition>
764+ </target>
765+ <target depends="-init-debug-args" name="-init-macrodef-debug">
766+ <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
767+ <attribute default="${main.class}" name="classname"/>
768+ <attribute default="${debug.classpath}" name="classpath"/>
769+ <element name="customize" optional="true"/>
770+ <sequential>
771+ <java classname="@{classname}" dir="${work.dir}" fork="true">
772+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
773+ <jvmarg line="${debug-args-line}"/>
774+ <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
775+ <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
776+ <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
777+ <jvmarg line="${run.jvmargs}"/>
778+ <jvmarg line="${run.jvmargs.ide}"/>
779+ <classpath>
780+ <path path="@{classpath}"/>
781+ </classpath>
782+ <syspropertyset>
783+ <propertyref prefix="run-sys-prop."/>
784+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
785+ </syspropertyset>
786+ <customize/>
787+ </java>
788+ </sequential>
789+ </macrodef>
790+ </target>
791+ <target name="-init-macrodef-java">
792+ <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
793+ <attribute default="${main.class}" name="classname"/>
794+ <attribute default="${run.classpath}" name="classpath"/>
795+ <attribute default="jvm" name="jvm"/>
796+ <element name="customize" optional="true"/>
797+ <sequential>
798+ <java classname="@{classname}" dir="${work.dir}" fork="true">
799+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
800+ <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
801+ <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
802+ <jvmarg line="${run.jvmargs}"/>
803+ <jvmarg line="${run.jvmargs.ide}"/>
804+ <classpath>
805+ <path path="@{classpath}"/>
806+ </classpath>
807+ <syspropertyset>
808+ <propertyref prefix="run-sys-prop."/>
809+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
810+ </syspropertyset>
811+ <customize/>
812+ </java>
813+ </sequential>
814+ </macrodef>
815+ </target>
816+ <target name="-init-macrodef-copylibs">
817+ <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
818+ <attribute default="${manifest.file}" name="manifest"/>
819+ <element name="customize" optional="true"/>
820+ <sequential>
821+ <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
822+ <pathconvert property="run.classpath.without.build.classes.dir">
823+ <path path="${run.classpath}"/>
824+ <map from="${build.classes.dir.resolved}" to=""/>
825+ </pathconvert>
826+ <pathconvert pathsep=" " property="jar.classpath">
827+ <path path="${run.classpath.without.build.classes.dir}"/>
828+ <chainedmapper>
829+ <flattenmapper/>
830+ <filtermapper>
831+ <replacestring from=" " to="%20"/>
832+ </filtermapper>
833+ <globmapper from="*" to="lib/*"/>
834+ </chainedmapper>
835+ </pathconvert>
836+ <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
837+ <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
838+ <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
839+ <manifest>
840+ <attribute name="Class-Path" value="${jar.classpath}"/>
841+ <customize/>
842+ </manifest>
843+ </copylibs>
844+ </sequential>
845+ </macrodef>
846+ </target>
847+ <target name="-init-presetdef-jar">
848+ <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
849+ <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
850+ <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
851+ </jar>
852+ </presetdef>
853+ </target>
854+ <target name="-init-ap-cmdline-properties">
855+ <property name="annotation.processing.enabled" value="true"/>
856+ <property name="annotation.processing.processors.list" value=""/>
857+ <property name="annotation.processing.processor.options" value=""/>
858+ <property name="annotation.processing.run.all.processors" value="true"/>
859+ <property name="javac.processorpath" value="${javac.classpath}"/>
860+ <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
861+ <condition property="ap.supported.internal" value="true">
862+ <not>
863+ <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
864+ </not>
865+ </condition>
866+ </target>
867+ <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
868+ <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
869+ <isfalse value="${annotation.processing.run.all.processors}"/>
870+ </condition>
871+ <condition else="" property="ap.proc.none.internal" value="-proc:none">
872+ <isfalse value="${annotation.processing.enabled}"/>
873+ </condition>
874+ </target>
875+ <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
876+ <property name="ap.cmd.line.internal" value=""/>
877+ </target>
878+ <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
879+ <!--
880+ ===================
881+ COMPILATION SECTION
882+ ===================
883+ -->
884+ <target name="-deps-jar-init" unless="built-jar.properties">
885+ <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
886+ <delete file="${built-jar.properties}" quiet="true"/>
887+ </target>
888+ <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
889+ <echo level="warn" message="Cycle detected: WebScraping was already built"/>
890+ </target>
891+ <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
892+ <mkdir dir="${build.dir}"/>
893+ <touch file="${built-jar.properties}" verbose="false"/>
894+ <property file="${built-jar.properties}" prefix="already.built.jar."/>
895+ <antcall target="-warn-already-built-jar"/>
896+ <propertyfile file="${built-jar.properties}">
897+ <entry key="${basedir}" value=""/>
898+ </propertyfile>
899+ </target>
900+ <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
901+ <target depends="init" name="-check-automatic-build">
902+ <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
903+ </target>
904+ <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
905+ <antcall target="clean"/>
906+ </target>
907+ <target depends="init,deps-jar" name="-pre-pre-compile">
908+ <mkdir dir="${build.classes.dir}"/>
909+ </target>
910+ <target name="-pre-compile">
911+ <!-- Empty placeholder for easier customization. -->
912+ <!-- You can override this target in the ../build.xml file. -->
913+ </target>
914+ <target if="do.depend.true" name="-compile-depend">
915+ <pathconvert property="build.generated.subdirs">
916+ <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
917+ <include name="*"/>
918+ </dirset>
919+ </pathconvert>
920+ <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
921+ </target>
922+ <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
923+ <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
924+ <copy todir="${build.classes.dir}">
925+ <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
926+ </copy>
927+ </target>
928+ <target if="has.persistence.xml" name="-copy-persistence-xml">
929+ <mkdir dir="${build.classes.dir}/META-INF"/>
930+ <copy todir="${build.classes.dir}/META-INF">
931+ <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
932+ </copy>
933+ </target>
934+ <target name="-post-compile">
935+ <!-- Empty placeholder for easier customization. -->
936+ <!-- You can override this target in the ../build.xml file. -->
937+ </target>
938+ <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
939+ <target name="-pre-compile-single">
940+ <!-- Empty placeholder for easier customization. -->
941+ <!-- You can override this target in the ../build.xml file. -->
942+ </target>
943+ <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
944+ <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
945+ <j2seproject3:force-recompile/>
946+ <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
947+ </target>
948+ <target name="-post-compile-single">
949+ <!-- Empty placeholder for easier customization. -->
950+ <!-- You can override this target in the ../build.xml file. -->
951+ </target>
952+ <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
953+ <!--
954+ ====================
955+ JAR BUILDING SECTION
956+ ====================
957+ -->
958+ <target depends="init" name="-pre-pre-jar">
959+ <dirname file="${dist.jar}" property="dist.jar.dir"/>
960+ <mkdir dir="${dist.jar.dir}"/>
961+ </target>
962+ <target name="-pre-jar">
963+ <!-- Empty placeholder for easier customization. -->
964+ <!-- You can override this target in the ../build.xml file. -->
965+ </target>
966+ <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available">
967+ <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
968+ <touch file="${tmp.manifest.file}" verbose="false"/>
969+ </target>
970+ <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest">
971+ <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
972+ <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/>
973+ </target>
974+ <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass">
975+ <manifest file="${tmp.manifest.file}" mode="update">
976+ <attribute name="Main-Class" value="${main.class}"/>
977+ </manifest>
978+ </target>
979+ <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile">
980+ <manifest file="${tmp.manifest.file}" mode="update">
981+ <attribute name="Profile" value="${javac.profile}"/>
982+ </manifest>
983+ </target>
984+ <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen">
985+ <basename file="${application.splash}" property="splashscreen.basename"/>
986+ <mkdir dir="${build.classes.dir}/META-INF"/>
987+ <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
988+ <manifest file="${tmp.manifest.file}" mode="update">
989+ <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
990+ </manifest>
991+ </target>
992+ <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs">
993+ <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
994+ <echo level="info">To run this application from the command line without Ant, try:</echo>
995+ <property location="${dist.jar}" name="dist.jar.resolved"/>
996+ <echo level="info">java -jar "${dist.jar.resolved}"</echo>
997+ </target>
998+ <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist">
999+ <j2seproject1:jar manifest="${tmp.manifest.file}"/>
1000+ <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
1001+ <property location="${dist.jar}" name="dist.jar.resolved"/>
1002+ <pathconvert property="run.classpath.with.dist.jar">
1003+ <path path="${run.classpath}"/>
1004+ <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
1005+ </pathconvert>
1006+ <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}">
1007+ <isset property="main.class.available"/>
1008+ </condition>
1009+ <condition else="debug" property="jar.usage.level" value="info">
1010+ <isset property="main.class.available"/>
1011+ </condition>
1012+ <echo level="${jar.usage.level}" message="${jar.usage.message}"/>
1013+ </target>
1014+ <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest">
1015+ <delete>
1016+ <fileset file="${tmp.manifest.file}"/>
1017+ </delete>
1018+ </target>
1019+ <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/>
1020+ <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/>
1021+ <target name="-post-jar">
1022+ <!-- Empty placeholder for easier customization. -->
1023+ <!-- You can override this target in the ../build.xml file. -->
1024+ </target>
1025+ <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/>
1026+ <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/>
1027+ <!--
1028+ =================
1029+ EXECUTION SECTION
1030+ =================
1031+ -->
1032+ <target depends="init,compile" description="Run a main class." name="run">
1033+ <j2seproject1:java>
1034+ <customize>
1035+ <arg line="${application.args}"/>
1036+ </customize>
1037+ </j2seproject1:java>
1038+ </target>
1039+ <target name="-do-not-recompile">
1040+ <property name="javac.includes.binary" value=""/>
1041+ </target>
1042+ <target depends="init,compile-single" name="run-single">
1043+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
1044+ <j2seproject1:java classname="${run.class}"/>
1045+ </target>
1046+ <target depends="init,compile-test-single" name="run-test-with-main">
1047+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
1048+ <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
1049+ </target>
1050+ <!--
1051+ =================
1052+ DEBUGGING SECTION
1053+ =================
1054+ -->
1055+ <target depends="init" if="netbeans.home" name="-debug-start-debugger">
1056+ <j2seproject1:nbjpdastart name="${debug.class}"/>
1057+ </target>
1058+ <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
1059+ <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
1060+ </target>
1061+ <target depends="init,compile" name="-debug-start-debuggee">
1062+ <j2seproject3:debug>
1063+ <customize>
1064+ <arg line="${application.args}"/>
1065+ </customize>
1066+ </j2seproject3:debug>
1067+ </target>
1068+ <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
1069+ <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
1070+ <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
1071+ </target>
1072+ <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
1073+ <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
1074+ <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
1075+ <j2seproject3:debug classname="${debug.class}"/>
1076+ </target>
1077+ <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
1078+ <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
1079+ <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
1080+ <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
1081+ </target>
1082+ <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
1083+ <target depends="init" name="-pre-debug-fix">
1084+ <fail unless="fix.includes">Must set fix.includes</fail>
1085+ <property name="javac.includes" value="${fix.includes}.java"/>
1086+ </target>
1087+ <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
1088+ <j2seproject1:nbjpdareload/>
1089+ </target>
1090+ <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
1091+ <!--
1092+ =================
1093+ PROFILING SECTION
1094+ =================
1095+ -->
1096+ <!--
1097+ pre NB7.2 profiler integration
1098+ -->
1099+ <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
1100+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
1101+ <nbprofiledirect>
1102+ <classpath>
1103+ <path path="${run.classpath}"/>
1104+ </classpath>
1105+ </nbprofiledirect>
1106+ <profile/>
1107+ </target>
1108+ <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
1109+ <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
1110+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
1111+ <nbprofiledirect>
1112+ <classpath>
1113+ <path path="${run.classpath}"/>
1114+ </classpath>
1115+ </nbprofiledirect>
1116+ <profile classname="${profile.class}"/>
1117+ </target>
1118+ <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
1119+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
1120+ <nbprofiledirect>
1121+ <classpath>
1122+ <path path="${run.classpath}"/>
1123+ </classpath>
1124+ </nbprofiledirect>
1125+ <profile classname="sun.applet.AppletViewer">
1126+ <customize>
1127+ <arg value="${applet.url}"/>
1128+ </customize>
1129+ </profile>
1130+ </target>
1131+ <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
1132+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
1133+ <nbprofiledirect>
1134+ <classpath>
1135+ <path path="${run.test.classpath}"/>
1136+ </classpath>
1137+ </nbprofiledirect>
1138+ <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
1139+ <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
1140+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
1141+ <jvmarg line="${profiler.info.jvmargs}"/>
1142+ <test name="${profile.class}"/>
1143+ <classpath>
1144+ <path path="${run.test.classpath}"/>
1145+ </classpath>
1146+ <syspropertyset>
1147+ <propertyref prefix="test-sys-prop."/>
1148+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
1149+ </syspropertyset>
1150+ <formatter type="brief" usefile="false"/>
1151+ <formatter type="xml"/>
1152+ </junit>
1153+ </target>
1154+ <!--
1155+ end of pre NB72 profiling section
1156+ -->
1157+ <target if="netbeans.home" name="-profile-check">
1158+ <condition property="profiler.configured">
1159+ <or>
1160+ <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
1161+ <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
1162+ </or>
1163+ </condition>
1164+ </target>
1165+ <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
1166+ <startprofiler/>
1167+ <antcall target="run"/>
1168+ </target>
1169+ <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
1170+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
1171+ <startprofiler/>
1172+ <antcall target="run-single"/>
1173+ </target>
1174+ <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
1175+ <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
1176+ <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
1177+ <startprofiler/>
1178+ <antcall target="test-single"/>
1179+ </target>
1180+ <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
1181+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
1182+ <startprofiler/>
1183+ <antcal target="run-test-with-main"/>
1184+ </target>
1185+ <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
1186+ <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
1187+ <startprofiler/>
1188+ <antcall target="run-applet"/>
1189+ </target>
1190+ <!--
1191+ ===============
1192+ JAVADOC SECTION
1193+ ===============
1194+ -->
1195+ <target depends="init" if="have.sources" name="-javadoc-build">
1196+ <mkdir dir="${dist.javadoc.dir}"/>
1197+ <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
1198+ <and>
1199+ <isset property="endorsed.classpath.cmd.line.arg"/>
1200+ <not>
1201+ <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
1202+ </not>
1203+ </and>
1204+ </condition>
1205+ <condition else="" property="bug5101868workaround" value="*.java">
1206+ <matches pattern="1\.[56](\..*)?" string="${java.version}"/>
1207+ </condition>
1208+ <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
1209+ <classpath>
1210+ <path path="${javac.classpath}"/>
1211+ </classpath>
1212+ <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
1213+ <filename name="**/*.java"/>
1214+ </fileset>
1215+ <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
1216+ <include name="**/*.java"/>
1217+ <exclude name="*.java"/>
1218+ </fileset>
1219+ <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
1220+ </javadoc>
1221+ <copy todir="${dist.javadoc.dir}">
1222+ <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
1223+ <filename name="**/doc-files/**"/>
1224+ </fileset>
1225+ <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
1226+ <include name="**/doc-files/**"/>
1227+ </fileset>
1228+ </copy>
1229+ </target>
1230+ <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
1231+ <nbbrowse file="${dist.javadoc.dir}/index.html"/>
1232+ </target>
1233+ <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
1234+ <!--
1235+ =========================
1236+ TEST COMPILATION SECTION
1237+ =========================
1238+ -->
1239+ <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
1240+ <mkdir dir="${build.test.classes.dir}"/>
1241+ </target>
1242+ <target name="-pre-compile-test">
1243+ <!-- Empty placeholder for easier customization. -->
1244+ <!-- You can override this target in the ../build.xml file. -->
1245+ </target>
1246+ <target if="do.depend.true" name="-compile-test-depend">
1247+ <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
1248+ </target>
1249+ <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
1250+ <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
1251+ <copy todir="${build.test.classes.dir}">
1252+ <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
1253+ </copy>
1254+ </target>
1255+ <target name="-post-compile-test">
1256+ <!-- Empty placeholder for easier customization. -->
1257+ <!-- You can override this target in the ../build.xml file. -->
1258+ </target>
1259+ <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
1260+ <target name="-pre-compile-test-single">
1261+ <!-- Empty placeholder for easier customization. -->
1262+ <!-- You can override this target in the ../build.xml file. -->
1263+ </target>
1264+ <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
1265+ <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
1266+ <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
1267+ <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
1268+ <copy todir="${build.test.classes.dir}">
1269+ <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
1270+ </copy>
1271+ </target>
1272+ <target name="-post-compile-test-single">
1273+ <!-- Empty placeholder for easier customization. -->
1274+ <!-- You can override this target in the ../build.xml file. -->
1275+ </target>
1276+ <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
1277+ <!--
1278+ =======================
1279+ TEST EXECUTION SECTION
1280+ =======================
1281+ -->
1282+ <target depends="init" if="have.tests" name="-pre-test-run">
1283+ <mkdir dir="${build.test.results.dir}"/>
1284+ </target>
1285+ <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
1286+ <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/>
1287+ </target>
1288+ <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
1289+ <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
1290+ </target>
1291+ <target depends="init" if="have.tests" name="test-report"/>
1292+ <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
1293+ <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
1294+ <target depends="init" if="have.tests" name="-pre-test-run-single">
1295+ <mkdir dir="${build.test.results.dir}"/>
1296+ </target>
1297+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
1298+ <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
1299+ <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
1300+ </target>
1301+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
1302+ <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
1303+ </target>
1304+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
1305+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
1306+ <fail unless="test.class">Must select some files in the IDE or set test.class</fail>
1307+ <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
1308+ <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
1309+ </target>
1310+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
1311+ <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
1312+ </target>
1313+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
1314+ <!--
1315+ =======================
1316+ TEST DEBUGGING SECTION
1317+ =======================
1318+ -->
1319+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
1320+ <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
1321+ <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
1322+ </target>
1323+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
1324+ <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
1325+ <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
1326+ <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
1327+ </target>
1328+ <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
1329+ <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
1330+ </target>
1331+ <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
1332+ <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
1333+ <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
1334+ <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
1335+ </target>
1336+ <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
1337+ <!--
1338+ =========================
1339+ APPLET EXECUTION SECTION
1340+ =========================
1341+ -->
1342+ <target depends="init,compile-single" name="run-applet">
1343+ <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
1344+ <j2seproject1:java classname="sun.applet.AppletViewer">
1345+ <customize>
1346+ <arg value="${applet.url}"/>
1347+ </customize>
1348+ </j2seproject1:java>
1349+ </target>
1350+ <!--
1351+ =========================
1352+ APPLET DEBUGGING SECTION
1353+ =========================
1354+ -->
1355+ <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
1356+ <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
1357+ <j2seproject3:debug classname="sun.applet.AppletViewer">
1358+ <customize>
1359+ <arg value="${applet.url}"/>
1360+ </customize>
1361+ </j2seproject3:debug>
1362+ </target>
1363+ <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
1364+ <!--
1365+ ===============
1366+ CLEANUP SECTION
1367+ ===============
1368+ -->
1369+ <target name="-deps-clean-init" unless="built-clean.properties">
1370+ <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
1371+ <delete file="${built-clean.properties}" quiet="true"/>
1372+ </target>
1373+ <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
1374+ <echo level="warn" message="Cycle detected: WebScraping was already built"/>
1375+ </target>
1376+ <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
1377+ <mkdir dir="${build.dir}"/>
1378+ <touch file="${built-clean.properties}" verbose="false"/>
1379+ <property file="${built-clean.properties}" prefix="already.built.clean."/>
1380+ <antcall target="-warn-already-built-clean"/>
1381+ <propertyfile file="${built-clean.properties}">
1382+ <entry key="${basedir}" value=""/>
1383+ </propertyfile>
1384+ </target>
1385+ <target depends="init" name="-do-clean">
1386+ <delete dir="${build.dir}"/>
1387+ <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
1388+ </target>
1389+ <target name="-post-clean">
1390+ <!-- Empty placeholder for easier customization. -->
1391+ <!-- You can override this target in the ../build.xml file. -->
1392+ </target>
1393+ <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
1394+ <target name="-check-call-dep">
1395+ <property file="${call.built.properties}" prefix="already.built."/>
1396+ <condition property="should.call.dep">
1397+ <and>
1398+ <not>
1399+ <isset property="already.built.${call.subproject}"/>
1400+ </not>
1401+ <available file="${call.script}"/>
1402+ </and>
1403+ </condition>
1404+ </target>
1405+ <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
1406+ <ant antfile="${call.script}" inheritall="false" target="${call.target}">
1407+ <propertyset>
1408+ <propertyref prefix="transfer."/>
1409+ <mapper from="transfer.*" to="*" type="glob"/>
1410+ </propertyset>
1411+ </ant>
1412+ </target>
1413+</project>
--- branches/b3/WebScraping/test/WebScraping/DebugProcessT01.java (nonexistent)
+++ branches/b3/WebScraping/test/WebScraping/DebugProcessT01.java (revision 102)
@@ -0,0 +1,48 @@
1+
2+package WebScraping;
3+
4+import static WebScraping.DebugProcess.logger;
5+import java.util.logging.Formatter;
6+import java.util.logging.Handler;
7+import java.util.logging.Logger;
8+
9+/**
10+ *
11+ * @author kgto
12+ */
13+
14+
15+public class DebugProcessT01 {
16+
17+ public static void main(String[] args) {
18+
19+ DebugProcessT01 test = new DebugProcessT01();
20+ test.testdebuglog_set();
21+
22+ System.out.println("LoggerName : " + logger.getName());
23+ System.out.println("LoggerLevel : " + logger.getLevel());
24+ System.out.println("Parent : " + logger.getParent().getName());
25+
26+ Handler[] handlers = logger.getHandlers();
27+ for(int i = 0 ; i < handlers.length ; i++) {
28+ System.out.println(handlers[i] + "'s Level: " + handlers[i].getLevel());
29+
30+ Formatter formatter = handlers[i].getFormatter();
31+ System.out.println("\tFormatter: " + formatter.toString());
32+ }
33+
34+ test.testhtmlinfo();
35+ }
36+
37+ public DebugProcessT01() {
38+ }
39+
40+ void testdebuglog_set() {
41+ DebugProcess.debuglog_set();
42+ }
43+
44+ void testhtmlinfo() {
45+ DebugProcess.htmlinfo("testhtmlinfo");
46+ }
47+
48+}
--- branches/b3/WebScraping/test/WebScraping/DebugProcessTest.java (nonexistent)
+++ branches/b3/WebScraping/test/WebScraping/DebugProcessTest.java (revision 102)
@@ -0,0 +1,113 @@
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+package WebScraping;
20+
21+import javax.swing.text.MutableAttributeSet;
22+import javax.swing.text.html.HTML;
23+import org.junit.AfterClass;
24+import org.junit.BeforeClass;
25+import org.junit.Test;
26+import static org.junit.Assert.*;
27+
28+import org.junit.AfterClass;
29+import org.junit.BeforeClass;
30+import org.junit.Test;
31+import static org.junit.Assert.*;
32+
33+/**
34+ *
35+ * @author kgto
36+ */
37+
38+
39+public class DebugProcessTest {
40+
41+ public DebugProcessTest() {
42+ }
43+
44+ @BeforeClass
45+ public static void setUpClass() {
46+ }
47+
48+ @AfterClass
49+ public static void tearDownClass() {
50+ }
51+
52+ /**
53+ * Test of debuglog_set method, of class DebugProcess.
54+ */
55+ @Test
56+ public void testDebuglog_set() {
57+ System.out.println("debuglog_set");
58+ DebugProcess.debuglog_set();
59+ // TODO review the generated test code and remove the default call to fail.
60+ fail("The test case is a prototype.");
61+ }
62+
63+ /**
64+ * Test of debuglog_unset method, of class DebugProcess.
65+ */
66+ @Test
67+ public void testDebuglog_unset() {
68+ System.out.println("debuglog_unset");
69+ DebugProcess.debuglog_unset();
70+ // TODO review the generated test code and remove the default call to fail.
71+ fail("The test case is a prototype.");
72+ }
73+
74+ /**
75+ * Test of htmlinfo method, of class DebugProcess.
76+ */
77+ @Test
78+ public void testHtmlinfo_4args() {
79+ System.out.println("htmlinfo");
80+ HTML.Tag tag = null;
81+ MutableAttributeSet attr = null;
82+ String methodname = "";
83+ int count = 0;
84+ DebugProcess.htmlinfo(tag, attr, methodname, count);
85+ // TODO review the generated test code and remove the default call to fail.
86+ fail("The test case is a prototype.");
87+ }
88+
89+ /**
90+ * Test of htmlinfo method, of class DebugProcess.
91+ */
92+ @Test
93+ public void testHtmlinfo_String() {
94+ System.out.println("htmlinfo");
95+ String str = "";
96+ DebugProcess.htmlinfo(str);
97+ // TODO review the generated test code and remove the default call to fail.
98+ fail("The test case is a prototype.");
99+ }
100+
101+ /**
102+ * Test of htmlinfo method, of class DebugProcess.
103+ */
104+ @Test
105+ public void testHtmlinfo_charArr() {
106+ System.out.println("htmlinfo");
107+ char[] data = null;
108+ DebugProcess.htmlinfo(data);
109+ // TODO review the generated test code and remove the default call to fail.
110+ fail("The test case is a prototype.");
111+ }
112+
113+}
--- branches/b3/WebScraping/test/WebScraping/HtmlFormatterTest.java (nonexistent)
+++ branches/b3/WebScraping/test/WebScraping/HtmlFormatterTest.java (revision 102)
@@ -0,0 +1,66 @@
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+package WebScraping;
20+
21+import java.util.logging.LogRecord;
22+import org.junit.AfterClass;
23+import org.junit.BeforeClass;
24+import org.junit.Test;
25+import static org.junit.Assert.*;
26+
27+import org.junit.AfterClass;
28+import org.junit.BeforeClass;
29+import org.junit.Test;
30+import static org.junit.Assert.*;
31+
32+/**
33+ *
34+ * @author kgto
35+ */
36+
37+
38+public class HtmlFormatterTest {
39+
40+ public HtmlFormatterTest() {
41+ }
42+
43+ @BeforeClass
44+ public static void setUpClass() {
45+ }
46+
47+ @AfterClass
48+ public static void tearDownClass() {
49+ }
50+
51+ /**
52+ * Test of format method, of class HtmlFormatter.
53+ */
54+ @Test
55+ public void testFormat() {
56+ System.out.println("format");
57+ LogRecord aRecord = null;
58+ HtmlFormatter instance = new HtmlFormatter();
59+ String expResult = "";
60+ String result = instance.format(aRecord);
61+ assertEquals(expResult, result);
62+ // TODO review the generated test code and remove the default call to fail.
63+ fail("The test case is a prototype.");
64+ }
65+
66+}
--- branches/b3/WebScraping/build.xml (nonexistent)
+++ branches/b3/WebScraping/build.xml (revision 102)
@@ -0,0 +1,73 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<!-- You may freely edit this file. See commented blocks below for -->
3+<!-- some examples of how to customize the build. -->
4+<!-- (If you delete it and reopen the project it will be recreated.) -->
5+<!-- By default, only the Clean and Build commands use this build script. -->
6+<!-- Commands such as Run, Debug, and Test only use this build script if -->
7+<!-- the Compile on Save feature is turned off for the project. -->
8+<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
9+<!-- in the project's Project Properties dialog box.-->
10+<project name="WebScraping" default="default" basedir=".">
11+ <description>Builds, tests, and runs the project WebScraping.</description>
12+ <import file="nbproject/build-impl.xml"/>
13+ <!--
14+
15+ There exist several targets which are by default empty and which can be
16+ used for execution of your tasks. These targets are usually executed
17+ before and after some main targets. They are:
18+
19+ -pre-init: called before initialization of project properties
20+ -post-init: called after initialization of project properties
21+ -pre-compile: called before javac compilation
22+ -post-compile: called after javac compilation
23+ -pre-compile-single: called before javac compilation of single file
24+ -post-compile-single: called after javac compilation of single file
25+ -pre-compile-test: called before javac compilation of JUnit tests
26+ -post-compile-test: called after javac compilation of JUnit tests
27+ -pre-compile-test-single: called before javac compilation of single JUnit test
28+ -post-compile-test-single: called after javac compilation of single JUunit test
29+ -pre-jar: called before JAR building
30+ -post-jar: called after JAR building
31+ -post-clean: called after cleaning build products
32+
33+ (Targets beginning with '-' are not intended to be called on their own.)
34+
35+ Example of inserting an obfuscator after compilation could look like this:
36+
37+ <target name="-post-compile">
38+ <obfuscate>
39+ <fileset dir="${build.classes.dir}"/>
40+ </obfuscate>
41+ </target>
42+
43+ For list of available properties check the imported
44+ nbproject/build-impl.xml file.
45+
46+
47+ Another way to customize the build is by overriding existing main targets.
48+ The targets of interest are:
49+
50+ -init-macrodef-javac: defines macro for javac compilation
51+ -init-macrodef-junit: defines macro for junit execution
52+ -init-macrodef-debug: defines macro for class debugging
53+ -init-macrodef-java: defines macro for class execution
54+ -do-jar: JAR building
55+ run: execution of project
56+ -javadoc-build: Javadoc generation
57+ test-report: JUnit report generation
58+
59+ An example of overriding the target for project execution could look like this:
60+
61+ <target name="run" depends="WebScraping-impl.jar">
62+ <exec dir="bin" executable="launcher.exe">
63+ <arg file="${dist.jar}"/>
64+ </exec>
65+ </target>
66+
67+ Notice that the overridden target depends on the jar target and not only on
68+ the compile target as the regular run target does. Again, for a list of available
69+ properties which you can use, check the target you are overriding in the
70+ nbproject/build-impl.xml file.
71+
72+ -->
73+</project>
--- branches/b3/WebScraping/manifest.mf (nonexistent)
+++ branches/b3/WebScraping/manifest.mf (revision 102)
@@ -0,0 +1,3 @@
1+Manifest-Version: 1.0
2+X-COMMENT: Main-Class will be added automatically by build
3+