Changeset 66
- Timestamp:
- 05/03/05 18:24:32 (4 years ago)
- Files:
-
- trunk/xml/dom/CharacterData.d (modified) (1 diff)
- trunk/xml/dom/DOMException.d (modified) (2 diffs)
- trunk/xml/dom/DocumentType.d (modified) (1 diff)
- trunk/xml/dom/defs.d (modified) (1 diff)
- trunk/xml/dom/std/CAttr.d (added)
- trunk/xml/dom/std/CCharacterData.d (added)
- trunk/xml/dom/std/CDOMException.d (added)
- trunk/xml/dom/std/CDOMImplementation.d (modified) (1 diff)
- trunk/xml/dom/std/CDOMImplementationSource.d (modified) (2 diffs)
- trunk/xml/dom/std/CDocument.d (added)
- trunk/xml/dom/std/CDocumentType.d (added)
- trunk/xml/dom/std/CNamedNodeMap.d (added)
- trunk/xml/dom/std/CNode.d (added)
- trunk/xml/dom/std/CNodeList.d (added)
- trunk/xml/dom/std/CProcessingInstruction.d (added)
- trunk/xml/dom/std/CText.d (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/xml/dom/CharacterData.d
r60 r66 24 24 25 25 uint length(); 26 void length(uint value);27 26 28 27 DOMString substringData(in uint offset, trunk/xml/dom/DOMException.d
r60 r66 16 16 module xml.dom.DOMException; 17 17 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 18 class DOMException{ 19 int code(); 25 20 static char[][] reason = [ 26 21 "INDEX_SIZE_ERR", … … 43 38 ]; 44 39 } 40 41 // ExceptionCode 42 enum : 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 1 1 /+ 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 13 3 +/ 14 15 4 module xml.dom.DocumentType; 16 5 trunk/xml/dom/defs.d
r60 r66 24 24 alias bit boolean; 25 25 alias void* any; 26 27 // ExceptionCode28 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 = 1746 }trunk/xml/dom/std/CDOMImplementation.d
r60 r66 11 11 private import xml.dom.Document; 12 12 13 private import xml.dom.std.CDocumentType; 14 private import xml.dom.std.CDocument; 15 16 private import std.string; 17 13 18 class 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; 16 23 return false; 17 24 } 18 25 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); 24 32 } // raises(DOMException); 25 33 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 38 36 return null; 39 37 } trunk/xml/dom/std/CDOMImplementationSource.d
r60 r66 9 9 10 10 private import xml.dom.std.CDOMImplementationList; 11 12 private import std.string; 11 13 12 14 class CDOMImplementationSource : DOMImplementationSource{ … … 24 26 25 27 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; 27 40 } 28 return impl;41 return null; 29 42 } 30 43
