diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-04 18:24:32 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-04 18:24:32 +0100 |
commit | e76f58e912bd6661ba755d27da97bebf711f06ad (patch) | |
tree | 84db508d8d65ad48522ea835f84b21f9f4d4dff9 /testdata | |
parent | 0149f97eca604662493e8aa2ebcceecba5fc5b94 (diff) |
added mechanism for parent parsing, which does not fully work as of now.
Diffstat (limited to 'testdata')
-rw-r--r-- | testdata/xmlparser/book_domain.oxm | 16 | ||||
-rw-r--r-- | testdata/xmlparser/headings_domain.oxm | 33 |
2 files changed, 41 insertions, 8 deletions
diff --git a/testdata/xmlparser/book_domain.oxm b/testdata/xmlparser/book_domain.oxm index 625e3c0..e02ec53 100644 --- a/testdata/xmlparser/book_domain.oxm +++ b/testdata/xmlparser/book_domain.oxm @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0" standalone="yes"?> <!-- The domain node is the root node of a single domain definition --> <domain name="book"> <!-- We start by declaring the structured classes. This implicitly defines @@ -9,9 +9,9 @@ nor parent, nor transparency, meaning that we refer to the default values. Also note that we need to specify explicitly, which classes are allowed as root nodes. --> - <struct name="book" cardinality="1" isRoot="true"> + <struct name="book" cardinality="{1}" isRoot="true"> <!-- implicitly: - <struct name="book" cardinality="1" isRoot="true" + <struct name="book" cardinality="{1}" isRoot="true" transparent="false" isa="" attributesDescriptor=""> --> <!-- Note that we assume that, if not specified, a @@ -39,7 +39,7 @@ </struct> <struct name="chapter"> <!-- implicitly: - <struct name="chapter" isRoot="false" cardinality="*" + <struct name="chapter" isRoot="false" cardinality="{*}" transparent="false" isa="" attributesDescriptor=""> --> <field> @@ -52,7 +52,7 @@ </struct> <struct name="section"> <!-- implicitly: - <struct name="section" isRoot="false" cardinality="*" + <struct name="section" isRoot="false" cardinality="{*}" transparent="false" isa="" attributesDescriptor=""> --> <field> @@ -65,7 +65,7 @@ </struct> <struct name="subsection"> <!-- implicitly: - <struct name="subsection" isRoot="false" cardinality="*" + <struct name="subsection" isRoot="false" cardinality="{*}" transparent="false" isa="" attributesDescriptor=""> --> <field> @@ -77,7 +77,7 @@ </struct> <struct name="paragraph" transparent="true" role="paragraph"> <!-- implicitly: - <struct name="subsection" isRoot="false" cardinality="*" + <struct name="subsection" isRoot="false" cardinality="{*}" transparent="true" isa="" attributesDescriptor=""> --> <field> @@ -89,7 +89,7 @@ </struct> <struct name="text" transparent="true" role="text"> <!-- implicitly: - <struct name="text" isRoot="false" cardinality="*" + <struct name="text" isRoot="false" cardinality="{*}" transparent="true" isa="" attributesDescriptor=""> --> <!-- we might want to specify std.string here --> diff --git a/testdata/xmlparser/headings_domain.oxm b/testdata/xmlparser/headings_domain.oxm new file mode 100644 index 0000000..f83843c --- /dev/null +++ b/testdata/xmlparser/headings_domain.oxm @@ -0,0 +1,33 @@ +<?xml version="1.0" standalone="yes"?> +<domain name="headings"> + + <import rel="domain" src="./book_domain.oxm"/> + + <struct name="heading" cardinality="{0-1}" transparent="true"> + <!-- The parent mechanism is a curious thing. Remind yourself + that parent-child-relationship in this sense are mediated + by fields. So we must either reference a field that is + already there or declare a new one on the fly. --> + <parent name="book.book"> + <field name="heading" isSubtree="true"/> + </parent> + <parent name="book.chapter"> + <field name="heading" isSubtree="true"/> + </parent> + <parent name="book.section"> + <field name="heading" isSubtree="true"/> + </parent> + <parent name="book.subsection"> + <field name="heading" isSubtree="true"/> + </parent> + <parent name="book.paragraph"> + <field name="heading" isSubtree="true"/> + </parent> + <!-- regarding its fields we have a problem here. We do not want to + declare a new field, because in fact we want to allow every + bit of content that a paragraph would allow - also considering + possible extensions of paragraph by other domains. + So we need to reference the default field of paragraph. --> + <fieldRef name="book.paragraph."/> + </struct> +</domain> |