File: NOTES%2Cv

package info (click to toggle)
flexml 1-5
  • links: PTS
  • area: main
  • in suites: potato, woody
  • size: 884 kB
  • ctags: 203
  • sloc: perl: 2,016; makefile: 160; ansic: 56; xml: 28
file content (141 lines) | stat: -rw-r--r-- 2,949 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
head	1.2;
access;
symbols;
locks; strict;
comment	@# @;


1.2
date	99.11.22.18.41.48;	author krisrose;	state Exp;
branches;
next	1.1;

1.1
date	99.10.26.16.18.35;	author krisrose;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Working like mad...
@
text
@# FleXML fast XML scanner framework
# Copyright  1999 Kristoffer Rose.  All rights reserved.
#
# Description:	Notes for FleXML scanner generator
# Author:	Kristoffer Rose
# Created:	August 1999
# License:	NTSys proprietary
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# $Id: NOTES,v 1.1 1999/10/26 16:18:35 krisrose Exp krisrose $


GUIDELINES FOR WRITING A flex(1) SCANNER FOR SIMPLE XML FORMATS.


We know how to handle the following DTD element declarations.


1. "Leaf" elements with the declarations

	<!ELEMENT tag EMPTY>
	<!ELEMENT tag (#PCDATA)>

   Start conditions:

	%x AL_tag

   Rules:

	"<tag"{s}"/>"			STag(tag), ETag(tag);
	"<tag"{s}">"			STag(tag), ENTER(PCDATA);
	"<tag"{S}			STag(tag), ENTER(AL_tag);
	<AL_tag>"/>"			LEAVE, Etag(tag);
	<AL_tag>">"			LEAVE, ENTER(PCDATA);
	<PCDATA>"</tag"{s}">"		Etag(tag), LEAVE;

   Handlers:

	STag_tag(void) {...}
	ETag_tag(char* pcdata) {...}


2. "Logical" elements with unordered element contents using the declaration

	<!ELEMENT tag (tag1|tag2|...|tagn)*>

   Start conditions:

	%x AL_tag
	%x IN_tag

   Rules:   

	"<tag"{s}"/>"			STag(tag), ETag(tag);
	"<tag"{s}">"			STag(tag), ENTER(IN_tag);
	"<tag"{S}			STag(tag), ENTER(AL_tag);
	<AL_tag>"/>"			LEAVE, Etag(tag);
	<AL_tag>">"			BEGIN(IN_tag);
	<IN_tag>"</tag"{s}">"		Etag(tag);

   Handlers:

	STag_tag(void) {...}
	ETag_tag(char* pcdata) {...}


3. "Attribute" declarations of the form

	<!ATTLIST tag attribute CDATA>

   Rule:

	<AL_tag>"attribute"{Eq}{Q}	Attribute(tag,attribute);

   Handler:

	Attribute_tag_attribute(char* value) {...}

That's all, for the moment.

Note: the scanner can be made (more) validating by using the <IN_tag>
condition in front of all the rules in tag1...tagn and give the
top-level rules the start condition INITIAL.
@


1.1
log
@Initial revision
@
text
@d2 1
a2 1
# Copyright  1999 Kristoffer Rose, NTSys.  All rights reserved.
d4 1
a4 1
# Description:	
d23 1
a23 1
# $Header: /var/cvsroot/ntsys/FleXML/NOTES,v 1.1.1.1 1999/09/10 12:55:10 krisrose Exp $
@