September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 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