Changeset 1054

Show
Ignore:
Timestamp:
02/10/08 15:39:15 (7 months ago)
Author:
teqdruid
Message:

Fix for #31

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/mango/xml/sax/parser/teqXML.d

    r1047 r1054  
    4141 
    4242private import  tango.text.convert.UnicodeBom, 
     43        Integer = tango.text.convert.Integer, 
    4344        Utf = tango.text.convert.Utf; 
    4445 
     
    345346    private T[][T[]] entities; 
    346347    private T[] amp = "amp", lt = "lt", gt = "gt", apos = "apos", quot = "quot"; 
    347     private T[] ampV = "&",  ltV = "<", gtV = ">", aposV = "'",   quotV = "\""; //" For kate 
     348    private T[] ampV = "&",  ltV = "<", gtV = ">", aposV = "'",   quotV = "\""; 
    348349 
    349350    private bool first; 
     
    519520                myHandler.characterData(str, CDataStatus.Append); 
    520521             
    521             str = entities[data[ampIndx+1..scIndx]]; 
     522            T[] ent = data[ampIndx+1..scIndx]; 
     523            T[1] chr; 
     524            if (!(ent in entities)) { 
     525                if (ent[0] == '#' && ent.length >= 2) { 
     526                    ent = ent[1..$]; 
     527                    if (ent[0] == 'x' && ent.length >= 2) 
     528                        chr[0] = Integer.toInt(ent, 16); 
     529                    else 
     530                        chr[0] = Integer.toInt(ent, 10); 
     531                    str = chr; 
     532                } else { 
     533                    throw new TeqXMLException( 
     534                        "Cannot resolve entity '" ~ ent ~ "'"); 
     535                } 
     536            } else { 
     537                str = entities[ent]; 
     538            } 
     539 
    522540            if (status.containsEnd() && scIndx == (data.length-1)) 
    523541                myHandler.characterData(str, CDataStatus.End);