Changeset 66

Show
Ignore:
Timestamp:
05/03/05 18:24:32 (4 years ago)
Author:
pragma
Message:

Minor update to DOM classes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/xml/dom/CharacterData.d

    r60 r66  
    2424                                        
    2525    uint   length(); 
    26     void   length(uint value); 
    2726     
    2827    DOMString          substringData(in uint offset,  
  • trunk/xml/dom/DOMException.d

    r60 r66  
    1616module xml.dom.DOMException; 
    1717 
    18 class DOMException : Exception { 
    19     int   code; 
    20     public this(ushort code){ 
    21         assert(code >= 1 && code < DOMException.reason.length); 
    22         super(DOMException.reason[code-1]); 
    23     } 
    24      
     18class DOMException{ 
     19    int   code(); 
    2520    static char[][] reason = [ 
    2621        "INDEX_SIZE_ERR",             
     
    4338    ]; 
    4439} 
     40 
     41// ExceptionCode 
     42enum : ushort{ 
     43    INDEX_SIZE_ERR                 = 1, 
     44    DOMSTRING_SIZE_ERR             = 2, 
     45    HIERARCHY_REQUEST_ERR          = 3, 
     46    WRONG_DOCUMENT_ERR             = 4, 
     47    INVALID_CHARACTER_ERR          = 5, 
     48    NO_DATA_ALLOWED_ERR            = 6, 
     49    NO_MODIFICATION_ALLOWED_ERR    = 7, 
     50    NOT_FOUND_ERR                  = 8, 
     51    NOT_SUPPORTED_ERR              = 9, 
     52    INUSE_ATTRIBUTE_ERR            = 10, 
     53    INVALID_STATE_ERR              = 11, 
     54    SYNTAX_ERR                     = 12, 
     55    INVALID_MODIFICATION_ERR       = 13, 
     56    NAMESPACE_ERR                  = 14, 
     57    INVALID_ACCESS_ERR             = 15, 
     58    VALIDATION_ERR                 = 16, 
     59    TYPE_MISMATCH_ERR              = 17 
     60} 
  • trunk/xml/dom/DocumentType.d

    r60 r66  
    11/+ 
    2  Copyright (c) 2004 World Wide Web Consortium, 
    3  
    4  (Massachusetts Institute of Technology, European Research Consortium for 
    5  Informatics and Mathematics, Keio University). All Rights Reserved. This 
    6  work is distributed under the W3C(r) Software License [1] in the hope that 
    7  it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
    8  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  
    10  [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 
    11   
    12  Converted to D by Eric Anderton - 2005 
     2    Custom DOM implementation 
    133+/ 
    14  
    154module xml.dom.DocumentType; 
    165 
  • trunk/xml/dom/defs.d

    r60 r66  
    2424alias bit boolean; 
    2525alias void* any; 
    26  
    27 // ExceptionCode 
    28 enum : ushort{ 
    29     INDEX_SIZE_ERR                 = 1, 
    30     DOMSTRING_SIZE_ERR             = 2, 
    31     HIERARCHY_REQUEST_ERR          = 3, 
    32     WRONG_DOCUMENT_ERR             = 4, 
    33     INVALID_CHARACTER_ERR          = 5, 
    34     NO_DATA_ALLOWED_ERR            = 6, 
    35     NO_MODIFICATION_ALLOWED_ERR    = 7, 
    36     NOT_FOUND_ERR                  = 8, 
    37     NOT_SUPPORTED_ERR              = 9, 
    38     INUSE_ATTRIBUTE_ERR            = 10, 
    39     INVALID_STATE_ERR              = 11, 
    40     SYNTAX_ERR                     = 12, 
    41     INVALID_MODIFICATION_ERR       = 13, 
    42     NAMESPACE_ERR                  = 14, 
    43     INVALID_ACCESS_ERR             = 15, 
    44     VALIDATION_ERR                 = 16, 
    45     TYPE_MISMATCH_ERR              = 17 
    46 } 
  • trunk/xml/dom/std/CDOMImplementation.d

    r60 r66  
    1111private import xml.dom.Document; 
    1212 
     13private import xml.dom.std.CDocumentType; 
     14private import xml.dom.std.CDocument; 
     15 
     16private import std.string; 
     17 
    1318class CDOMImplementation : DOMImplementation{ 
    14     boolean            hasFeature(in DOMString feature,  
    15                                    in DOMString ver){ 
     19    boolean            hasFeature(in DOMString feature, in DOMString ver){ 
     20 
     21        // this implementation does nothing fancy 
     22        if(feature == "standardDOM") return true; 
    1623        return false; 
    1724    } 
    1825                                   
    19     // Introduced in DOM Level 2: 
    20     DocumentType       createDocumentType(in DOMString qualifiedName,  
    21                                           in DOMString publicId,  
    22                                           in DOMString systemId){ 
    23         return null;                       
     26    DocumentType       createDocumentType(in DOMString qualifiedName, in DOMString publicId, in DOMString systemId){ 
     27        return new CDocumentType(qualifiedName,publicId,systemId); 
     28    } 
     29 
     30    Document           createDocument(in DOMString namespaceURI, in DOMString qualifiedName, in DocumentType doctype){ 
     31        return new CDocument(namespaceURI,qualifiedName,doctype); 
    2432    } // raises(DOMException); 
    2533     
    26      
    27     // Introduced in DOM Level 2: 
    28     Document           createDocument(in DOMString namespaceURI,  
    29                                       in DOMString qualifiedName,  
    30                                       in DocumentType doctype){ 
    31         return null; 
    32     } // raises(DOMException); 
    33      
    34      
    35     // Introduced in DOM Level 3: 
    36     DOMObject          getFeature(in DOMString feature,  
    37                                   in DOMString ver){ 
     34    DOMObject          getFeature(in DOMString feature, in DOMString ver){ 
     35        //TODO: implement 
    3836        return null; 
    3937    } 
  • trunk/xml/dom/std/CDOMImplementationSource.d

    r60 r66  
    99 
    1010private import xml.dom.std.CDOMImplementationList; 
     11 
     12private import std.string; 
    1113 
    1214class CDOMImplementationSource : DOMImplementationSource{ 
     
    2426         
    2527        for(int i=0; i<list.length; i++){ 
    26             //TODO: compare for each implementation and break if match 
     28            DOMImplementation impl = list.item(i); 
     29             
     30            //TODO: what is 'version' for? 
     31            char[] version = "1.0"; 
     32            bit hasFeatures = true; 
     33            foreach(char[] feature; split(features)){ 
     34                if(!item.hasFeature(feature,version)){ 
     35                    hasFeatures = false; 
     36                    break; 
     37                } 
     38            } 
     39            if(hasFeatures) return impl; 
    2740        } 
    28         return impl; 
     41        return null; 
    2942    } 
    3043