Looping through XML Using The Dom Parser

3 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€85.78
List Price:  €120.09
You save:  €34.31
£74.57
List Price:  £104.41
You save:  £29.83
CA$137.96
List Price:  CA$193.15
You save:  CA$55.19
A$153.09
List Price:  A$214.33
You save:  A$61.24
S$128.82
List Price:  S$180.35
You save:  S$51.53
HK$780.13
List Price:  HK$1,092.22
You save:  HK$312.08
CHF 80.34
List Price:  CHF 112.49
You save:  CHF 32.14
NOK kr1,002.34
List Price:  NOK kr1,403.32
You save:  NOK kr400.97
DKK kr640.19
List Price:  DKK kr896.29
You save:  DKK kr256.10
NZ$170.50
List Price:  NZ$238.70
You save:  NZ$68.20
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,161.77
List Price:  ৳17,026.97
You save:  ৳4,865.19
₹8,804.49
List Price:  ₹12,326.64
You save:  ₹3,522.15
RM422.70
List Price:  RM591.80
You save:  RM169.10
₦153,629.63
List Price:  ₦215,087.63
You save:  ₦61,458
₨28,293.93
List Price:  ₨39,612.64
You save:  ₨11,318.70
฿3,234.32
List Price:  ฿4,528.18
You save:  ฿1,293.86
₺4,114.84
List Price:  ₺5,760.95
You save:  ₺1,646.10
B$547.02
List Price:  B$765.85
You save:  B$218.83
R1,762.70
List Price:  R2,467.86
You save:  R705.15
Лв167.91
List Price:  Лв235.08
You save:  Лв67.17
₩138,945.27
List Price:  ₩194,528.94
You save:  ₩55,583.66
₪336.77
List Price:  ₪471.49
You save:  ₪134.72
₱5,729.37
List Price:  ₱8,021.35
You save:  ₱2,291.98
¥14,854.21
List Price:  ¥20,796.49
You save:  ¥5,942.28
MX$1,870.35
List Price:  MX$2,618.57
You save:  MX$748.21
QR364.32
List Price:  QR510.06
You save:  QR145.74
P1,347.77
List Price:  P1,886.93
You save:  P539.16
KSh12,913.70
List Price:  KSh18,079.70
You save:  KSh5,166
E£4,858.94
List Price:  E£6,802.71
You save:  E£1,943.77
ብር14,285.86
List Price:  ብር20,000.78
You save:  ብር5,714.91
Kz91,186.39
List Price:  Kz127,664.59
You save:  Kz36,478.20
CLP$97,354.26
List Price:  CLP$136,299.86
You save:  CLP$38,945.60
CN¥713
List Price:  CN¥998.24
You save:  CN¥285.23
RD$6,298.47
List Price:  RD$8,818.11
You save:  RD$2,519.64
DA12,991.06
List Price:  DA18,188
You save:  DA5,196.94
FJ$226.12
List Price:  FJ$316.58
You save:  FJ$90.46
Q766.32
List Price:  Q1,072.87
You save:  Q306.55
GY$20,908.02
List Price:  GY$29,272.07
You save:  GY$8,364.04
ISK kr12,319.76
List Price:  ISK kr17,248.16
You save:  ISK kr4,928.40
DH904.41
List Price:  DH1,266.21
You save:  DH361.80
L1,648.78
List Price:  L2,308.36
You save:  L659.58
ден5,288.25
List Price:  ден7,403.76
You save:  ден2,115.51
MOP$803.86
List Price:  MOP$1,125.44
You save:  MOP$321.57
N$1,771.48
List Price:  N$2,480.14
You save:  N$708.66
C$3,679.53
List Price:  C$5,151.49
You save:  C$1,471.96
रु14,112.30
List Price:  रु19,757.79
You save:  रु5,645.48
S/353.41
List Price:  S/494.79
You save:  S/141.37
K419.26
List Price:  K586.98
You save:  K167.72
SAR375.19
List Price:  SAR525.29
You save:  SAR150.09
ZK2,368.97
List Price:  ZK3,316.66
You save:  ZK947.68
L435.57
List Price:  L609.82
You save:  L174.24
Kč2,097.30
List Price:  Kč2,936.30
You save:  Kč839
Ft33,774.46
List Price:  Ft47,285.59
You save:  Ft13,511.13
SEK kr943.78
List Price:  SEK kr1,321.33
You save:  SEK kr377.55
ARS$135,932.91
List Price:  ARS$190,311.51
You save:  ARS$54,378.60
Bs690.86
List Price:  Bs967.24
You save:  Bs276.37
COP$400,952.08
List Price:  COP$561,348.96
You save:  COP$160,396.87
₡50,547.65
List Price:  ₡70,768.74
You save:  ₡20,221.08
L2,635.35
List Price:  L3,689.60
You save:  L1,054.24
₲722,145.91
List Price:  ₲1,011,033.16
You save:  ₲288,887.25
$U4,001.81
List Price:  $U5,602.70
You save:  $U1,600.88
zł364.73
List Price:  zł510.64
You save:  zł145.90
Already have an account? Log In

Transcript

Hello, in this video, we are going to look at looping through the XML. So what we've got right here, literally just pumps out this, not very useful to use pumping out literally all of the content. And imagine if you had other loads of, you know, notes, for example in this, it's just not, you just can't do much with it. So what we want to do is get rid of this, we still want to load it, that's fine. I'm going to say dollar. And then I'm gonna say element equals dollar XML document.

Document element. And say for each dollar element, and then we're going to get all the child node. So this is basically on a cornice the dollar value to know nothing better names. No, technically, there's no But you won't always be a note as a copy that paste that here, trial node. US dollar. No.

I'm all gonna say he's in here, he's going to print out as I was doing Echo, a couple upon echo dollar node, the node name. Obviously this is the way I'm going to format it we can do however you want dash dot dollar node, no run, you know find them do not depend on a new line tab and get a bit of nice formatting. Now, if we go back, there we go. We have, what do we want text where the text is coming from. It's the white space. So if there's whitespace, he will literally compound the text.

So that's what that is. But there you go. That's how you pass for it use in the, you know the built in Dom parser. Not very good. To be fair boss wanted to show you all the different methods for manipulating XML or recommend either simple XML that's my first go to one. If you need something more advanced use the XML expert, Partha Nepal.

A parser and I've got videos covering all the nuances of both of those that I just mentioned. And that's it any questions, feel free to drop me a message. And as usual, I look forward to seeing you in the next great video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.