Project: XML Encoding Filter
Write a filter program that transforms the input Unicode text stream into properly encoded XML. The characters left angle bracket, right angle bracket, ampersand, apostrophe and double quotes need to be converted to their corresponding XML entities <, >, &, ' and ". Any codepoint higher than 127 should be encoded as a hexadecimal character entity such as ሴ.
See [[List of XML and HTML character entity references]]
Output
$ rustc XMLEncodingFilter.rs
error[E0425]: cannot find function `getcodepoint` in this scope
--> XMLEncodingFilter.rs:11:8
|
11 | while getcodepoint(c) {
| ^^^^^^^^^^^^ not found in this scope
error[E0423]: expected function, found builtin type `u32`
--> XMLEncodingFilter.rs:12:11
|
12 | if c == u32('<') {
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> XMLEncodingFilter.rs:14:18
|
14 | } else if c == u32('>') {
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> XMLEncodingFilter.rs:16:18
|
16 | } else if c == u32('&') {
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> XMLEncodingFilter.rs:18:18
|
18 | } else if c == u32('\'') {
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> XMLEncodingFilter.rs:20:18
|
20 | } else if c == u32('"') {
| ^^^ not a function
error[E0425]: cannot find function `putcodepoint` in this scope
--> XMLEncodingFilter.rs:25:4
|
25 | putcodepoint(c);
| ^^^^^^^^^^^^ not found in this scope
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0423, E0425.
For more information about an error, try `rustc --explain E0423`.
$ rustc XMLEncodingFilter.rs
error[E0425]: cannot find function `getcodepoint` in this scope
--> XMLEncodingFilter.rs:11:8
|
11 | while getcodepoint(c) {
| ^^^^^^^^^^^^ not found in this scope
error[E0423]: expected function, found builtin type `u32`
--> XMLEncodingFilter.rs:12:11
|
12 | if c == u32('<') {
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> XMLEncodingFilter.rs:14:18
|
14 | } else if c == u32('>') {
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> XMLEncodingFilter.rs:16:18
|
16 | } else if c == u32('&') {
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> XMLEncodingFilter.rs:18:18
|
18 | } else if c == u32('\'') {
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> XMLEncodingFilter.rs:20:18
|
20 | } else if c == u32('"') {
| ^^^ not a function
error[E0425]: cannot find function `putcodepoint` in this scope
--> XMLEncodingFilter.rs:25:4
|
25 | putcodepoint(c);
| ^^^^^^^^^^^^ not found in this scope
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0423, E0425.
For more information about an error, try `rustc --explain E0423`.