Re: sgml-parse working example required

Subject: Re: sgml-parse working example required
From: James Clark <jjc@xxxxxxxxxx>
Date: Thu, 29 May 1997 21:03:52 +0700
At 17:54 29/05/97 MSD, Tsyshevsky Vladimir wrote:
>jade_08 implements new primitive
>(sgml-parse string #!key active: parent:) 
>which is described in standard as follows:
>  Returns a node-list containing a single node that is the root of a grove
built by
>  parsing an SGML document or subdocument using the SGML property set.
string is
>  the system identifier of the SGML document entity or SGML subdocument entity.
>  active: is a list of strings specifying the names of the active DTD or
LPDs. At most
>  one DTD shall be active...
>a) It looks like the 'string' argument is used as filename, but not as
>entity name;

It's a system identifier as the standard requires.

>b) I failed to parse the subdocument with it's own dtd, it looks like
>the parent documents's dtd always used

It works for me.

Here's an example:

<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(root (make simple-page-sequence))

(element p (make paragraph))

(element para (make paragraph))

(element include
      (attribute-string "entity"))))))

(define read-entity
  (external-procedure "UNREGISTERED::James Clark//Procedure::read-entity"))

(element example
  (make paragraph
    font-family-name: "Courier"
    input-whitespace-treatment: 'preserve
    lines: 'asis
       (attribute-string "entity"))))))
(define (document-element #!optional (node (current-node)))
  (node-property 'document-element node default: (empty-node-list)))

Here's a document entity you can try it with:

<!doctype doc system "include.dtd" [
<!entity e system "include2.sgm" subdoc>
Paragraph the first.
<include entity=e>
Paragraph the second.
<include entity=e>
<example entity=e>


<!element doc  o o (p|include|example)*>
<!element p - o (#pcdata)>
<!element include - o empty>
<!element example - o empty>
<!attlist (example|include) entity entity #required>
<!notation sgml public "ISO 8879:1986//NOTATION SGML//EN">


<!doctype doc [
<!element doc o o (para+)>
<!element para - o (#pcdata)>
Included paragraph the first.
Included paragraph the second.

 DSSSList info and archive:

Current Thread