xmlreaderimpl/trunk/XMLv2__VWSAXBuilder.st
changeset 0 5057afe1ec87
child 173 738b801e1a58
equal deleted inserted replaced
-1:000000000000 0:5057afe1ec87
       
     1 "{ Package: 'stx:goodies/xmlsuite/xmlreaderimpl' }"
       
     2 
       
     3 "{ NameSpace: XMLv2 }"
       
     4 
       
     5 XML::SAXBuilder subclass:#VWSAXBuilder
       
     6 	instanceVariableNames:''
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'XML Suite-SAX2-XMLReaders'
       
    10 !
       
    11 
       
    12 
       
    13 !VWSAXBuilder methodsFor:'building'!
       
    14 
       
    15 externalGeneralEntity: nameString id: arrayIDs ndata: ndata uri: anURI 
       
    16         | entity |
       
    17         entity := (XML::GeneralEntity new)
       
    18                         externalFrom: arrayIDs;
       
    19                         name: nameString;
       
    20                         ndata: ndata.
       
    21         (saxDriver respondsTo:#resolveEntity:)
       
    22             ifTrue:[saxDriver resolveEntity: entity].
       
    23         entity isParsed 
       
    24                 ifFalse: 
       
    25                         [(saxDriver respondsTo:#unparsedEntity:pubicID:systemID:)
       
    26                             ifTrue:[saxDriver 
       
    27                                         unparsedEntity: entity name
       
    28                                         pubicID: entity publicID
       
    29                                         systemID: entity systemID]].
       
    30         ^entity
       
    31 
       
    32     "Created: / 07-11-2006 / 21:01:40 / janfrog"
       
    33 ! !
       
    34 
       
    35 !VWSAXBuilder methodsFor:'initialization'!
       
    36 
       
    37 initializeDriver: aVWXMLSAXDriver source: aStream 
       
    38 
       
    39     super initializeDriver: aVWXMLSAXDriver source: aStream.
       
    40     attributes := Attributes new
       
    41 
       
    42     "Created: / 12-05-2005 / 12:31:16 / masca"
       
    43 ! !
       
    44 
       
    45 !VWSAXBuilder methodsFor:'namespaces'!
       
    46 
       
    47 findNamespace: ns
       
    48 
       
    49 
       
    50         ns = 'xml' ifTrue: [^'http://www.w3.org/XML/1998/namespace'].
       
    51 
       
    52         ^super findNamespace: ns
       
    53 
       
    54     "Created: / 04-05-2005 / 10:50:03 / janfrog"
       
    55 ! !
       
    56 
       
    57 !VWSAXBuilder methodsFor:'private'!
       
    58 
       
    59 notifyClientStartElement: currentTag 
       
    60         | myAtts |
       
    61         myAtts := attributes reject:[:att|att tag qualifiedName startsWith:'xmlns'].
       
    62         myAtts do:[:a|a tag qualifier = currentTag qualifier ifTrue:[
       
    63                 a tag 
       
    64                     qualifier:a tag qualifier 
       
    65                     ns:currentTag namespace
       
    66                     type:a tag type.
       
    67             ]                        
       
    68         ].
       
    69         myAtts := myAtts collect:[:att| Attr fromCincomAttribute: att].
       
    70         saxDriver 
       
    71                 startElement: currentTag type
       
    72                 namespace: currentTag namespace
       
    73                 prefix: currentTag qualifier
       
    74                 attributes: myAtts.
       
    75         attributes := Attributes new.
       
    76         hasPendingTag := false
       
    77 
       
    78     "Created: / 04-05-2005 / 09:50:01 / janfrog"
       
    79     "Modified: / 20-05-2006 / 15:32:58 / janfrog"
       
    80 !
       
    81 
       
    82 separateIgnorableWhitespaceAndText: aString 
       
    83     "Don't try to reformat the text by eliminating ignorable whitespace and emitting it as
       
    84     ignorable whitespace. Just pass the text as is.
       
    85     The original idea was not bad but I would prefer to skip spaces after a newline and
       
    86     nothing more (in case any skipping/formatting is requested)."
       
    87 
       
    88     (aString allSatisfy: [:e | e isSeparator])
       
    89         ifTrue: [saxDriver ignorableWhitespace: aString]
       
    90         ifFalse: [saxDriver characters: aString]
       
    91 
       
    92     "Created: / 13-06-2005 / 17:06:39 / masca"
       
    93 ! !
       
    94 
       
    95 !VWSAXBuilder class methodsFor:'documentation'!
       
    96 
       
    97 version
       
    98     ^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/xmlreaderimpl/XMLv2__VWSAXBuilder.st,v 1.3 2006-11-08 09:29:48 vranyj1 Exp $'
       
    99 ! !