Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
alx_20230801
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
alx_20230801
Commits
a3504f9d
Commit
a3504f9d
authored
Aug 01, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XPath waluty v2 z predykatem
parent
6893df37
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
WalutyXPath2.java
ObslugaXML/src/main/java/przyklady_xpath/WalutyXPath2.java
+4
-7
No files found.
ObslugaXML/src/main/java/przyklady_xpath/WalutyXPath2.java
View file @
a3504f9d
...
@@ -32,16 +32,13 @@ public class WalutyXPath2 {
...
@@ -32,16 +32,13 @@ public class WalutyXPath2 {
System
.
out
.
println
(
"Ewaluacja"
);
System
.
out
.
println
(
"Ewaluacja"
);
double
suma
=
0
;
double
suma
=
0
;
int
ilosc
=
0
;
int
ilosc
=
0
;
NodeList
rates
=
(
NodeList
)
xpath
.
evaluate
(
"//Rate"
,
doc
,
XPathConstants
.
NODESET
);
NodeList
rates
=
(
NodeList
)
xpath
.
evaluate
(
"//Rate
[Code = '"
+
szukanyKod
+
"']
"
,
doc
,
XPathConstants
.
NODESET
);
final
int
nRates
=
rates
.
getLength
();
final
int
nRates
=
rates
.
getLength
();
for
(
int
i
=
0
;
i
<
nRates
;
i
++)
{
for
(
int
i
=
0
;
i
<
nRates
;
i
++)
{
Node
rate
=
rates
.
item
(
i
);
Node
rate
=
rates
.
item
(
i
);
String
code
=
xpath
.
evaluate
(
"Code"
,
rate
);
suma
+=
(
Double
)
xpath
.
evaluate
(
"Mid"
,
rate
,
XPathConstants
.
NUMBER
);
if
(
code
.
equalsIgnoreCase
(
szukanyKod
))
{
ilosc
++;
suma
+=
(
Double
)
xpath
.
evaluate
(
"Mid"
,
rate
,
XPathConstants
.
NUMBER
);
System
.
out
.
println
(
ilosc
);
ilosc
++;
System
.
out
.
println
(
ilosc
);
}
}
}
double
srednia
=
suma
/
ilosc
;
double
srednia
=
suma
/
ilosc
;
System
.
out
.
println
(
"Średni kurs waluty "
+
szukanyKod
+
" = "
+
srednia
);
System
.
out
.
println
(
"Średni kurs waluty "
+
szukanyKod
+
" = "
+
srednia
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment