diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-04-10 14:16:48 +0200 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2016-04-25 22:24:13 +0200 |
commit | 7db9ce9d14ace08a2cbd92ddd79b3b359f8784e4 (patch) | |
tree | ca8558826b4212e2e9d5974a591063bff10efebc | |
parent | 4e01c2d54320595d56aa02b469b6a2bdd5064673 (diff) |
handled special tokens in ontology serialization.
3 files changed, 30 insertions, 4 deletions
diff --git a/src/plugins/xml/XmlOutput.cpp b/src/plugins/xml/XmlOutput.cpp index 1a7ea2a..516fc22 100644 --- a/src/plugins/xml/XmlOutput.cpp +++ b/src/plugins/xml/XmlOutput.cpp @@ -250,13 +250,13 @@ static Rooted<Element> transformTokenDescriptor(Handle<Element> parent, return nullptr; } Rooted<Element> tag{new Element(P.mgr, parent, tagName)}; - std::string str; + Rooted<xml::Node> token; if (descr.special) { - // TODO: Handle this case + token = Rooted<Element>{ + new Element(P.mgr, tag, Token::specialName(descr.id))}; } else { - str = descr.token; + token = Rooted<Text>{new Text(P.mgr, tag, descr.token)}; } - Rooted<Text> token{new Text(P.mgr, parent, str)}; tag->addChild(token); return tag; } diff --git a/testdata/integration/ontology_serialization/special_tokens.in.osml b/testdata/integration/ontology_serialization/special_tokens.in.osml new file mode 100644 index 0000000..e89c5eb --- /dev/null +++ b/testdata/integration/ontology_serialization/special_tokens.in.osml @@ -0,0 +1,10 @@ +\begin{document} + \begin{ontology#test} + \struct#a[root=true] + \syntax + \close{\newline} + \field + \childRef[ref=a] + \end{ontology} +\a +\end{document} diff --git a/testdata/integration/ontology_serialization/special_tokens.out.osxml b/testdata/integration/ontology_serialization/special_tokens.out.osxml new file mode 100644 index 0000000..c5d7a6a --- /dev/null +++ b/testdata/integration/ontology_serialization/special_tokens.out.osxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<document> + <ontology name="test"> + <struct name="a" root="true"> + <field> + <childRef ref="a"/> + </field> + <syntax> + <close> + <newline/> + </close> + </syntax> + </struct> + </ontology> + <test:a/> +</document> |