Sample
;
; Copyright, (C) 1998 by OmniMark Technologies Corporation
; All Rights Reserved
;
; socatex2.xom -- parse a document with a declaration derived from the DTD
;
; Description:
;
; Omnimark checks structure of input document and reports any errors.
;
; Run this program with one of the commands:
;
; omnimark -d socat yourcatalog -s socatex2.xom yourdocument
process ; SGML input
include "socatete.xin"
;Input function for sgml-parse
; output sends the data directly to the SGML parser.
; If you want to apply find rules to the text, you would use submit
; instead of output.
define function parse-document(value stream decl, value stream file-name)
as
do
do when file-name != "" and file file-name exists
do when decl != "" and file decl exists
output file decl
done
output file file-name
else
put #error "No file: " || file-name || "%n"
done
done
; for each file, get the public identifier of the DTD from the DOCTYPE
; declaration, and use the public identifer to get the appropriate
; SGML declaration. Parse the document using the declaration.
process-start
repeat over #command-line-names
do scan file #command-line-names
match unanchored ul
( "<!doctype"
white-space+
[any-text except white-space or ">" or "["]+
white-space+
"public"
white-space+
('"' | "'") => pi-begin
( [any-text except '"' | "'"]+
|
((lookahead not pi-begin) '"' | "'")
)+ => public-identifier
pi-begin
)
do sgml-parse document
scan input parse-document(
socat-resolve-dtddecl(public-identifier), #command-line-names)
suppress
done
match any+ = nam
put #error "skipping " || #command-line-names || "%n"
done
again
halt
element #IMPLIED ; For all elements (in the DTD)
suppress ; Do nothing
Generated: April 21, 1999 at 2:01:45 pm
If you have any comments about this section of the documentation, send email to [email protected]
Copyright © OmniMark Technologies Corporation, 1988-1999.