Changeset 37873 in project


Ignore:
Timestamp:
09/01/19 17:32:51 (3 weeks ago)
Author:
svnwiki
Message:

Anonymous wiki edit for IP [78.85.49.45]: version update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/sxml-modifications

    r37553 r37873  
    11[[tags:eggs]]
    22
    3 This is version 0.2 of the '''sxml-modifications''' extension library for Chicken Scheme.
     3This is version 0.3 of the '''sxml-modifications''' extension library for Chicken Scheme.
    44
    55[[toc:]]
     
    3333expressions.
    3434
    35 <procedure>(modify [update-specifier ...])</procedure>
     35<procedure>(sxml-modify [update-specifier ...])</procedure>
    3636
    3737Returns a procedure which accepts a document and returns a modified
     
    9090
    9191<enscript highlight="scheme">
    92 (import (prefix sxml-modifications sxmlm:))
    93 
    9492(define doc
    9593  '(*TOP*
     
    102100        (cd (@ (title "Little Lion") (artist "Brooks Williams")))))))
    103101
    104 (define delete-recipient (sxmlm:modify '("purchaseOrder/recipient" delete)))
     102(define delete-recipient (sxml-modify '("purchaseOrder/recipient" delete)))
    105103(delete-recipient doc)
    106104=>
     
    113111
    114112;; insert-into accepts any number of action-parameters, being the node(s) to insert at the end
    115 ((sxmlm:modify '("purchaseOrder/recipient" insert-into (postalCode "05676") (city "Footown"))) doc)
     113((sxml-modify '("purchaseOrder/recipient" insert-into (postalCode "05676") (city "Footown"))) doc)
    116114=>
    117115(*TOP*
     
    127125</enscript>
    128126
    129 <procedure>(modify! [update-specifier ...])</procedure>
    130 
    131 Destructively updating version of {{modify}}.  Like the
     127<procedure>(sxml-modify! [update-specifier ...])</procedure>
     128
     129Destructively updating version of {{sxml-modify}}.  Like the
    132130linear-updating variants of SRFI-1, you should use the return value of
    133131this procedure rather than assuming the original document was mutated
    134132in-place.
    135133
    136 <procedure>(insert-following node-specifier)</procedure>
    137 <procedure>(insert-preceding node-specifier)</procedure>
    138 <procedure>(insert-into node-specifier)</procedure>
    139 <procedure>(rename new-name)</procedure>
    140 <procedure>delete</procedure>
    141 <procedure>delete-undeep</procedure>
     134<procedure>(sxml-insert-following node-specifier)</procedure>
     135<procedure>(sxml-insert-preceding node-specifier)</procedure>
     136<procedure>(sxml-insert-into node-specifier)</procedure>
     137<procedure>(sxml-rename new-name)</procedure>
     138<procedure>sxml-delete</procedure>
     139<procedure>sxml-delete-undeep</procedure>
    142140
    143141These procedures all correspond to the action symbols accepted by
    144 {{modify}}.  There are no procedures corresponding to
     142{{sxml-modify}}.  There are no procedures corresponding to
    145143{{move-into}}, {{move-preceding}}, {{move-following}} or {{replace}}.
    146144
    147 The {{delete}} and {{delete-undeep}} procedures can only be
     145The {{sxml-delete}} and {{sxml-delete-undeep}} procedures can only be
    148146put directly into the action-parameters list as-is, which means this
    149147adds zero expressiveness over the corresponding symbols.
     
    155153node.
    156154
    157 The {{rename}} procedure accepts a symbol which indicates the new
     155The {{sxml-rename}} procedure accepts a symbol which indicates the new
    158156element name to use for the matched nodes.
    159157
    160 Here's the example from {{modify}} using these procedures instead
     158Here's the example from {{sxml-modify}} using these procedures instead
    161159of action symbols:
    162160
    163161<enscript highlight="scheme">
    164 (prefix sxml-modifications sxmlm:)
    165 
    166162(define doc
    167163  '(*TOP*
     
    174170        (cd (@ (title "Little Lion") (artist "Brooks Williams")))))))
    175171
    176 (define delete-recipient (sxmlm:modify `("purchaseOrder/recipient" ,sxmlm:delete)))
     172(define delete-recipient (sxml-modify `("purchaseOrder/recipient" ,sxml-delete)))
    177173(delete-recipient doc)
    178174=>
     
    185181
    186182;; insert-into accepts any number of action-parameters, being the node(s) to insert at the end
    187 ((sxmlm:modify `("purchaseOrder/recipient"
    188                 ,(sxmlm:insert-into
     183((sxml-modify `("purchaseOrder/recipient"
     184                ,(sxml-insert-into
    189185                  (lambda (context base-node)
    190186                    (list '(postalCode "05676") '(city "Footown"))))))
     
    211207=== Version history
    212208
     209; 0.3 : Add sxml- prefix to all exported functions
    213210; 0.2 : Ported to Chicken 5
    214211; 0.1 : First Chicken 4 release
Note: See TracChangeset for help on using the changeset viewer.