Changeset 1210
- Timestamp:
- 07/04/09 03:12:01 (3 years ago)
- Files:
-
- trunk/phobos/std/xml.d (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phobos/std/xml.d
r1182 r1210 290 290 // does not do copy-on-write, but instead copies always. 291 291 292 if (s. find('&') != -1) s = replace(s,"&","&");293 if (s. find('"') != -1) s = replace(s,"\"",""");294 if (s. find("'") != -1) s = replace(s,"'","'");295 if (s. find('<') != -1) s = replace(s,"<","<");296 if (s. find('>') != -1) s = replace(s,">",">");292 if (s.indexOf('&') != -1) s = replace(s,"&","&"); 293 if (s.indexOf('"') != -1) s = replace(s,"\"","""); 294 if (s.indexOf("'") != -1) s = replace(s,"'","'"); 295 if (s.indexOf('<') != -1) s = replace(s,"<","<"); 296 if (s.indexOf('>') != -1) s = replace(s,">",">"); 297 297 return s; 298 298 } … … 379 379 dchar d; 380 380 string t = s[i..$]; 381 checkCharRef(t,d); 382 buffer ~= cast(char)d; 381 checkCharRef(t, d); 382 char[4] temp; 383 buffer ~= temp[0 .. std.utf.encode(temp, d)]; 383 384 i = s.length - t.length - 1; 384 385 } … … 1137 1138 this(string content) 1138 1139 { 1139 if (content == "-" || content. find("==") != -1)1140 if (content == "-" || content.indexOf("==") != -1) 1140 1141 throw new CommentException(content); 1141 1142 this.content = content; … … 1217 1218 this(string content) 1218 1219 { 1219 if (content. find("]]>") != -1) throw new CDataException(content);1220 if (content.indexOf("]]>") != -1) throw new CDataException(content); 1220 1221 this.content = content; 1221 1222 } … … 1376 1377 this(string content) 1377 1378 { 1378 if (content. find(">") != -1) throw new XIException(content);1379 if (content.indexOf(">") != -1) throw new XIException(content); 1379 1380 this.content = content; 1380 1381 } … … 1455 1456 this(string content) 1456 1457 { 1457 if (content. find("?>") != -1) throw new PIException(content);1458 if (content.indexOf("?>") != -1) throw new PIException(content); 1458 1459 this.content = content; 1459 1460 } … … 1874 1875 { 1875 1876 chop(*s,4); 1876 t = chop(*s, find(*s,"-->"));1877 t = chop(*s,indexOf(*s,"-->")); 1877 1878 if (commentHandler.funcptr !is null) commentHandler(t); 1878 1879 chop(*s,3); … … 1881 1882 { 1882 1883 chop(*s,9); 1883 t = chop(*s, find(*s,"]]>"));1884 t = chop(*s,indexOf(*s,"]]>")); 1884 1885 if (cdataHandler.funcptr !is null) cdataHandler(t); 1885 1886 chop(*s,3); … … 1888 1889 { 1889 1890 chop(*s,2); 1890 t = chop(*s, find(*s,">"));1891 t = chop(*s,indexOf(*s,">")); 1891 1892 if (xiHandler.funcptr !is null) xiHandler(t); 1892 1893 chop(*s,1); … … 1895 1896 { 1896 1897 chop(*s,2); 1897 t = chop(*s, find(*s,"?>"));1898 t = chop(*s,indexOf(*s,"?>")); 1898 1899 if (piHandler.funcptr !is null) piHandler(t); 1899 1900 chop(*s,2); … … 1970 1971 else 1971 1972 { 1972 t = chop(*s, find(*s,"<"));1973 t = chop(*s,indexOf(*s,"<")); 1973 1974 if (rawTextHandler.funcptr !is null) 1974 1975 rawTextHandler(t); … … 2128 2129 2129 2130 try { checkLiteral("<!--",s); } catch(Err e) { fail(e); } 2130 int n = s. find("--");2131 int n = s.indexOf("--"); 2131 2132 if (n == -1) fail("unterminated comment"); 2132 2133 s = s[0..n]; … … 2468 2469 // Deliberately no mixin Check here. 2469 2470 2470 int n = s. find(end);2471 int n = s.indexOf(end); 2471 2472 if (n == -1) throw new Err(s,"Unable to find terminating \""~end~"\""); 2472 2473 s = s[n..$]; … … 2589 2590 catch(CheckException e) 2590 2591 { 2591 int n = e.toString(). find("end tag name \"genres\" differs"2592 int n = e.toString().indexOf("end tag name \"genres\" differs" 2592 2593 " from start tag name \"genre\""); 2593 2594 assert(n != -1); … … 2659 2660 { 2660 2661 string head = entire[0..$-tail.length]; 2661 int n = head. rfind('\n') + 1;2662 int n = head.lastIndexOf('\n') + 1; 2662 2663 line = head.count("\n") + 1; 2663 2664 dstring t;
