Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/XML-XPath/XPL0/xml-xpath.xpl0
Normal file
39
Task/XML-XPath/XPL0/xml-xpath.xpl0
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
include xpllib; \for StrFind
|
||||
|
||||
char XML(1000000), P, P1, P2, Addr;
|
||||
int I, Ch;
|
||||
[I:= 0;
|
||||
loop [Ch:= ChIn(1);
|
||||
XML(I):= Ch;
|
||||
if Ch = $1A \EOF\ then quit;
|
||||
I:= I+1;
|
||||
];
|
||||
XML(I):= 0;
|
||||
|
||||
P1:= StrFind(XML, "<item ");
|
||||
P2:= StrFind(XML, "</item>");
|
||||
Text(0, "The first 'item' element is:^m^j");
|
||||
for P:= P1 to P2+6 do ChOut(0, P(0));
|
||||
CrLf(0);
|
||||
|
||||
Text(0, "^m^jThe 'prices' are:^m^j");
|
||||
Addr:= XML;
|
||||
loop [P1:= StrFind(Addr, "<price>");
|
||||
if P1 = 0 then quit;
|
||||
P2:= StrFind(Addr, "</price>");
|
||||
if P2 = 0 then quit;
|
||||
for P:= P1+7 to P2-1 do ChOut(0, P(0));
|
||||
CrLf(0);
|
||||
Addr:= P2+1;
|
||||
];
|
||||
Text(0, "^m^jThe 'names' are:^m^j");
|
||||
Addr:= XML;
|
||||
loop [P1:= StrFind(Addr, "<name>");
|
||||
if P1 = 0 then quit;
|
||||
P2:= StrFind(Addr, "</name>");
|
||||
if P2 = 0 then quit;
|
||||
for P:= P1+6 to P2-1 do ChOut(0, P(0));
|
||||
CrLf(0);
|
||||
Addr:= P2+1;
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue