summaryrefslogtreecommitdiff
path: root/epan/dtd_grammar.lemon
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2005-09-17 17:05:46 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2005-09-17 17:05:46 +0000
commit4c14b12c25291919fc7e409f9cfe95c16cefe678 (patch)
tree432eb53c8e154b0e76f997c778b30c476637985c /epan/dtd_grammar.lemon
parent8ace2749f38daec92df4da8cf2d1eda298cf36ff (diff)
downloadwireshark-4c14b12c25291919fc7e409f9cfe95c16cefe678.tar.gz
Because there's more than just text in XML...
DTDs are imported to create fields svn path=/trunk/; revision=15851
Diffstat (limited to 'epan/dtd_grammar.lemon')
-rw-r--r--epan/dtd_grammar.lemon29
1 files changed, 26 insertions, 3 deletions
diff --git a/epan/dtd_grammar.lemon b/epan/dtd_grammar.lemon
index 153f320efb..b451749150 100644
--- a/epan/dtd_grammar.lemon
+++ b/epan/dtd_grammar.lemon
@@ -85,8 +85,31 @@ dtd ::= doctype.
dtd ::= dtd_parts.
doctype ::= TAG_START DOCTYPE_KW NAME(Name) OPEN_BRACKET dtd_parts CLOSE_BRACKET TAG_STOP. {
- bd->proto_name = g_strdup(Name->text);
+ dtd_named_list_t* root;
+ GPtrArray* root_elems = g_ptr_array_new();
+ guint i;
+
+ if(! bd->proto_name) {
+ bd->proto_name = g_strdup(Name->text);
+ }
+
+ if(bd->proto_root)
+ g_free(bd->proto_root);
+
+ bd->proto_root = g_strdup(Name->text);
+
g_strdown(bd->proto_name);
+
+ for( i = 0; i< bd->elements->len; i++) {
+ dtd_named_list_t* el = g_ptr_array_index(bd->elements,i);
+
+ g_ptr_array_add(root_elems,g_strdup(el->name));
+ }
+
+ root = dtd_named_list_new(g_strdup(Name->text),root_elems);
+
+ g_ptr_array_add(bd->elements,root);
+
}
dtd_parts ::= dtd_parts element(Element). { g_ptr_array_add(bd->elements,Element); }
@@ -95,10 +118,10 @@ dtd_parts ::= element(Element). { g_ptr_array_add(bd->elements,Element); }
dtd_parts ::= attlist(Attlist). { g_ptr_array_add(bd->attributes,Attlist); }
%type attlist { dtd_named_list_t* }
-attlist(A) ::= TAG_START ATTLIST_KW NAME(B) attrib_list(TheList) TAG_STOP. { A = dtd_named_list_new(B->text,TheList); }
+attlist(A) ::= TAG_START ATTLIST_KW NAME(B) attrib_list(TheList) TAG_STOP. { g_strdown(B->text); A = dtd_named_list_new(B->text,TheList); }
%type element { dtd_named_list_t* }
-element(A) ::= TAG_START ELEMENT_KW NAME(B) sub_elements(C) TAG_STOP. { A = dtd_named_list_new(B->text,C); }
+element(A) ::= TAG_START ELEMENT_KW NAME(B) sub_elements(C) TAG_STOP. { g_strdown(B->text); A = dtd_named_list_new(B->text,C); }
%type attrib_list { GPtrArray* }
attrib_list(A) ::= attrib_list(B) attrib(C). { g_ptr_array_add(B,C); A = B; }