|
|||||
|
||||||
Related Topics | Other Library Functions |
data type |
markup-buffer |
Library: Markup utilities (OMMARKUPUTILITIES)
Import: ommarkuputilities.xmd |
An instance of the markup-buffer
data type can be used for storing and reproducing a markup
stream. Apart from the data type itself, the markup utilities library also provides:
markup sink
or a markup source
from an instance of the markup-buffer
type,
string
to markup-buffer
, and
=
and !=
between two markup-buffer
instances.
You can use the markup sink
to write a markup stream into the buffer. To obtain the sink, cast
the buffer to a markup sink
or prefix it by using output as
. To reproduce the previously written
markup stream, cast it to a markup source
or simply start reading the contents of the buffer using the
do markup-parse
action.
This example program parses an XML document in the file inclusion.xml and buffers the parsed
markup stream. Then it parses another SGML document container.sgml, replacing every occurrence of
element reference within it by the buffered inclusion.xml document. After this
preprocessing step, the transformed SGML document can be subjected to final processing.
import "ommarkuputilities.xmd" unprefixed global markup-buffer replacement define markup source function replace-references as using group "replace references" do sgml-parse document scan file "container.sgml" output "%c" done process using output as replacement do xml-parse scan file "inclusion.xml" output #content done using group "process transformed document" do markup-parse replace-references output "%c%n" done group "replace references" element "reference" output replacement suppress element #implied signal throw #markup-start #current-markup-event output "%c" signal throw #markup-end #current-markup-event group "process transformed document" element #implied output "<%q>%c</%q>"
Related Topics |
Other Library Functions
|
Copyright © Stilo International plc, 1988-2010.