| 46 | | void xmlProcessingInstruction(char[] name,char[] data){ |
|---|
| 47 | | writefln("parsed PI"); |
|---|
| | 57 | void xmlStartDTDElement(CharT[] name){ |
|---|
| | 58 | writef("<!ELEMENT %s ",name); |
|---|
| | 59 | } |
|---|
| | 60 | void xmlSetDTDElementChild(CharT[] name,CharT[] childName){ |
|---|
| | 61 | writef("%s",childName); |
|---|
| | 62 | } |
|---|
| | 63 | void xmlSetDTDElementOperation(CharT[] name,DTDOperation type){ |
|---|
| | 64 | writef("%s",toCharTString(cast(CharT)type)); |
|---|
| | 65 | } |
|---|
| | 66 | void xmlEndDTDElement(CharT[] name){ |
|---|
| | 67 | writef(">"); |
|---|
| | 68 | } |
|---|
| | 69 | |
|---|
| | 70 | void xmlStartDTDAttlist(CharT[] name){ |
|---|
| | 71 | writef("<!ATTLIST %s ",name); |
|---|
| | 72 | } |
|---|
| | 73 | void xmlSetDTDAttlistDef(CharT[] name,CharT[] type,CharT[] defaultDecl,CharT[] defaultValue){ |
|---|
| | 74 | writef("%s %s %s",type,defaultDecl,defaultValue); |
|---|
| | 75 | } |
|---|
| | 76 | void xmlEndDTDAttlist(CharT[] name){ |
|---|
| | 77 | writef(">"); |
|---|
| 50 | | void xmlComment(char[] text){ |
|---|
| 51 | | writefln("comment: %s",text); |
|---|
| | 80 | void xmlSetDTDEntity(CharT[] name,CharT[] value,CharT[] ndata,bit parsed){ |
|---|
| | 81 | if(parsed){ |
|---|
| | 82 | if(ndata){ |
|---|
| | 83 | writef("<!ENTITY %%%s '%s'><!--ndata: %s -->",name,value,ndata); |
|---|
| | 84 | } |
|---|
| | 85 | else{ |
|---|
| | 86 | writef("<!ENTITY %%%s '%s'>",name,value); |
|---|
| | 87 | } |
|---|
| | 88 | } |
|---|
| | 89 | else{ |
|---|
| | 90 | writef("<!ENTITY %s '%s'>",name,value); |
|---|
| | 91 | } |
|---|
| 53 | | |
|---|
| 54 | | void xmlStartElement(char[] name,XMLAttributes attribs,bit isEmpty){ |
|---|
| 55 | | writefln("started %s",name); |
|---|
| | 93 | |
|---|
| | 94 | void xmlSetDTDNotation(CharT[] name, CharT[] publicId, CharT[] systemLiteral){} |
|---|
| | 95 | |
|---|
| | 96 | void xmlParsedProcessingInstruction(CharT[] name,XMLAttributes attribs){ |
|---|
| | 97 | writef("<?%s %s?>",name,attribs.toCharTString()); |
|---|
| 60 | | void xmlText(char[] text){} |
|---|
| | 102 | |
|---|
| | 103 | void xmlComment(CharT[] text){ |
|---|
| | 104 | writef("<!--%s-->",text); |
|---|
| | 105 | } |
|---|
| | 106 | |
|---|
| | 107 | void xmlStartElement(CharT[] name,XMLAttributes attribs,bit isEmpty){ |
|---|
| | 108 | if(isEmpty){ |
|---|
| | 109 | writef("<%s %s/>",name,attribs.toCharTString()); |
|---|
| | 110 | } |
|---|
| | 111 | else{ |
|---|
| | 112 | writef("<%s %s>",name,attribs.toCharTString()); |
|---|
| | 113 | } |
|---|
| | 114 | } |
|---|
| | 115 | void xmlEndElement(CharT[] name,XMLAttributes attribs,bit isEmpty){ |
|---|
| | 116 | if(!isEmpty){ |
|---|
| | 117 | writef("</%s>",name); |
|---|
| | 118 | } |
|---|
| | 119 | } |
|---|
| | 120 | void xmlText(CharT[] text,TextType type){ |
|---|
| | 121 | writef("%s",text); |
|---|
| | 122 | } |
|---|
| 120 | | // log failure |
|---|
| 121 | | writefln(" -- Failed!"); |
|---|
| 122 | | |
|---|
| 123 | | // display meaningful output via the debug consumer |
|---|
| 124 | | try{ |
|---|
| 125 | | parser.parse(new DebugConsumer(), provider, toUTF8(cast(char[])std.file.read(testfile))); |
|---|
| 126 | | } |
|---|
| 127 | | catch(Error e){ |
|---|
| 128 | | writefln("%s",e.toString()); |
|---|
| 129 | | } |
|---|
| 130 | | catch(Exception e){ |
|---|
| 131 | | writefln("%s",e.toString()); |
|---|
| 132 | | } |
|---|
| 133 | | |
|---|
| 134 | | // give something else useful |
|---|
| 135 | | writefln("%s",parser.toString()); |
|---|
| 136 | | writefln(""); |
|---|
| | 180 | writefln("%s -- FAILED: %s\n",testfile,e.toString()); |
|---|
| | 181 | parser.parse(new DebugConsumer(), provider, data); |
|---|
| | 182 | break; |
|---|