svn-gvsig-desktop / tags / v1_0_2_Build_908 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / metadataXML / XMLTreeNumberOfRecordsAnswer.java @ 11054
History | View | Annotate | Download (2.63 KB)
1 | 3566 | jorpiell | |
---|---|---|---|
2 | 2820 | jorpiell | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
3 | *
|
||
4 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 2
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
19 | *
|
||
20 | * For more information, contact:
|
||
21 | *
|
||
22 | * Generalitat Valenciana
|
||
23 | * Conselleria d'Infraestructures i Transport
|
||
24 | * Av. Blasco Ib??ez, 50
|
||
25 | * 46010 VALENCIA
|
||
26 | * SPAIN
|
||
27 | *
|
||
28 | * +34 963862235
|
||
29 | * gvsig@gva.es
|
||
30 | * www.gvsig.gva.es
|
||
31 | *
|
||
32 | * or
|
||
33 | *
|
||
34 | * IVER T.I. S.A
|
||
35 | * Salamanca 50
|
||
36 | * 46005 Valencia
|
||
37 | * Spain
|
||
38 | *
|
||
39 | * +34 963163400
|
||
40 | * dac@iver.es
|
||
41 | */
|
||
42 | 2047 | luisw | package es.gva.cit.catalogClient.metadataXML; |
43 | import java.io.ByteArrayInputStream; |
||
44 | |||
45 | /**
|
||
46 | 3566 | jorpiell | *
|
47 | *
|
||
48 | *
|
||
49 | 2820 | jorpiell | * @author Jorge Piera Llodra (piera_jor@gva.es)
|
50 | 2047 | luisw | */
|
51 | public class XMLTreeNumberOfRecordsAnswer { |
||
52 | 3566 | jorpiell | |
53 | /**
|
||
54 | *
|
||
55 | *
|
||
56 | *
|
||
57 | * @return
|
||
58 | * @param numberOfRecords
|
||
59 | * @param firstRecord
|
||
60 | * @param lastRecord
|
||
61 | */
|
||
62 | public static XMLNode getNode(int numberOfRecords, int firstRecord, int lastRecord) { |
||
63 | 2724 | jorpiell | String message = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + |
64 | "<Elements> " + "<NumberOfRecords>" + |
||
65 | String.valueOf(numberOfRecords) + "</NumberOfRecords>" + |
||
66 | "<FirstRecord>" + String.valueOf(firstRecord) + "</FirstRecord>" + |
||
67 | "<LastRecord>" + String.valueOf(lastRecord) + "</LastRecord>" + |
||
68 | "</Elements>";
|
||
69 | ByteArrayInputStream buffer = new ByteArrayInputStream(message.getBytes()); |
||
70 | 3454 | jorpiell | return XMLTree.xmlToTree(buffer);
|
71 | 3566 | jorpiell | } |
72 | 2724 | jorpiell | |
73 | 3566 | jorpiell | /**
|
74 | *
|
||
75 | *
|
||
76 | *
|
||
77 | * @return
|
||
78 | * @param node
|
||
79 | */
|
||
80 | public static int getNumberOfRecords(XMLNode node) { |
||
81 | 2724 | jorpiell | return Integer.parseInt(XMLTree.searchNodeValue(node, "NumberOfRecords")); |
82 | 3566 | jorpiell | } |
83 | 2724 | jorpiell | |
84 | 3566 | jorpiell | /**
|
85 | *
|
||
86 | *
|
||
87 | *
|
||
88 | * @return
|
||
89 | * @param node
|
||
90 | */
|
||
91 | public static int getFirstRecord(XMLNode node) { |
||
92 | 2724 | jorpiell | return Integer.parseInt(XMLTree.searchNodeValue(node, "FirstRecord")); |
93 | 3566 | jorpiell | } |
94 | 2724 | jorpiell | |
95 | 3566 | jorpiell | /**
|
96 | *
|
||
97 | *
|
||
98 | *
|
||
99 | * @return
|
||
100 | * @param node
|
||
101 | */
|
||
102 | public static int getLastRecord(XMLNode node) { |
||
103 | 2724 | jorpiell | return Integer.parseInt(XMLTree.searchNodeValue(node, "LastRecord")); |
104 | 3566 | jorpiell | } |
105 | } |