Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/XML-Input/Zkl/xml-input.zkl
Normal file
18
Task/XML-Input/Zkl/xml-input.zkl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
student:=RegExp(0'|.*<Student\s*.+Name\s*=\s*"([^"]+)"|);
|
||||
unicode:=RegExp(0'|.*(&#x[0-9a-fA-F]+;)|);
|
||||
xml:=File("foo.xml").read();
|
||||
|
||||
students:=xml.pump(List,'wrap(line){
|
||||
if(student.search(line)){
|
||||
s:=student.matched[1]; // ( (match start,len),group text )
|
||||
while(unicode.search(s)){ // convert "É" to 0xc9 to UTF-8
|
||||
c:=unicode.matched[1];
|
||||
uc:=c[3,-1].toInt(16).toString(-8);
|
||||
s=s.replace(c,uc);
|
||||
}
|
||||
s
|
||||
}
|
||||
else Void.Skip; // line doesn't contain <Student ... Name ...
|
||||
});
|
||||
|
||||
students.println();
|
||||
Loading…
Add table
Add a link
Reference in a new issue