contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
External entities: combining in a single file  
 

Introduction

If the replacement text of some of the external entities is small, all of the entities can be defined in a single file.

This example reads in a file called "entity.set", which contains a set of entity definitions. Each entity definition consists of an external entity name terminated by an equal sign, a "quote" character (which may be anything other than a new line), and the text of the entity terminated by another "quote" character. Optional, non-significant line breaks are allowed following the equal sign and following the closing "quote" of the entity text.

The example assumes that the file "entity.set" is correctly formatted, and makes no provision for the entity not being defined. (If it is not defined, the entity text will be "", the zero-length string, which may or may not be an appropriate fall-back position.)

An example of an "entity.set" file is the following, which contains information specific to processing a set of documents. Different "quotes" are used for illustration.

  orgname=/OmniMark Technologies Corporation/
  prodname='OmniMark'
  rights=
  "All rights reserved by OmniMark Technologies Corporation. This material contains the valuable properties of OmniMark Technologies Corporation. No part of this material may be reproduced, translated, or transmitted in any form or by any means, electronic, mechanical, or otherwise, including photocopying and recording, without the premission in writing from OmniMark Technologies Corporation."

Using this example, the entity reference "&orgname;" would have the replacement text "OmniMark Technologies Corporation".



Sample

  external-text-entity #implied
     repeat scan file "entity.set"
     match "%q" "=" "%n"? any => quote
           ((lookahead ! another quote) any)* => text
        output text
        exit
     match [any except "="]+ "=" "%n"? any => quote
           ((lookahead ! another quote) any)* another quote "%n"?
        ; skip other entities
     again

   
----  

Top [CONTENTS] [CONCEPTS] [SYNTAX] [LIBRARIES] [SAMPLES] [ERRORS] [INDEX]

Generated: April 21, 1999 at 2:01:42 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © OmniMark Technologies Corporation, 1988-1999.