Commit 1a05abfc authored by Florent Terrones's avatar Florent Terrones
Browse files

2006-06-16 Florent Terrones <terron_f@lrde.epita.fr>

 
	* data/vaucanson.xsd: Change the structure of the label as a node. The
	element corresponding to the star is now a node instead of an attribute.
	* include/vaucanson/xml/tools.hxx: Change the parsing of an XML node
	accordingly.
	* include/vaucanson/algebra/implementation/series/rat/xml_exp_visitor.hxx:
	Change the `star' case of the xml visitor. A star node is now created.
parent 67f064fb
2006-06-16 Florent Terrones <terron_f@lrde.epita.fr>
* data/vaucanson.xsd: Change the structure of the label as a node. The
element corresponding to the star is now a node instead of an attribute.
* include/vaucanson/xml/tools.hxx: Change the parsing of an XML node
accordingly.
* include/vaucanson/algebra/implementation/series/rat/xml_exp_visitor.hxx:
Change the `star' case of the xml visitor. A star node is now created.
2006-06-16 Florent Terrones <terron_f@lrde.epita.fr>
* include/vaucanson/xml/node.hxx: Do not fill the alphabet with the
......
......@@ -16,7 +16,6 @@ vaucanson.xsd version 0.3.1
Attribute group used to factorize some code.
-->
<xs:attributeGroup name="expression_attributes">
<xs:attribute name="star" type="xs:boolean"/>
<xs:attribute name="parenthesis" type="xs:boolean"/>
<xs:attribute name="weight" type="xs:decimal"/>
</xs:attributeGroup>
......@@ -37,15 +36,33 @@ vaucanson.xsd version 0.3.1
<xs:attribute name="weight" type="xs:decimal"/>
</xs:complexType>
<!--
<star> tag properties. Used to add a star in the regular expression.
The members of a star can be any tag out of the <product>, <sum>, <star>,
<zero>, <identity> and <word> ones.
-->
<xs:complexType name="star">
<xs:choice>
<xs:element name="star" type="star" minOccurs="0"/>
<xs:element name="word" type="word" minOccurs="0"/>
<xs:element name="sum" type="sum" minOccurs="0"/>
<xs:element name="product" type="product" minOccurs="0"/>
<xs:element name="zero" type="zero_val" minOccurs="0"/>
<xs:element name="identity" type="identity_val" minOccurs="0"/>
</xs:choice>
<xs:attributeGroup ref="expression_attributes"/>
</xs:complexType>
<!--
<sum> tag properties. Used to represent a product in the regular expression.
The members of a sum can be any tag out of the <product>, <sum>, <zero>,
<identity> and <word> ones.
<identity> and <word> ones, or a star.
Caution, only these tags should be inserted where the <xs:any> tag stands.
-->
<xs:complexType name="sum">
<xs:choice>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
<xs:element name="star" type="star" minOccurs="0"/>
</xs:choice>
<xs:attributeGroup ref="expression_attributes"/>
</xs:complexType>
......@@ -53,12 +70,13 @@ vaucanson.xsd version 0.3.1
<!--
<product> tag properties. Used to represent a product in the regular expression.
The members of a product can be any tag out of the <product>, <sum>, <zero>,
<identity> and <word> ones.
<identity> and <word> ones, or a star.
Caution, only these tags should be inserted where the <xs:any> tag stands.
-->
<xs:complexType name="product">
<xs:choice>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
<xs:element name="star" type="star" minOccurs="0"/>
</xs:choice>
<xs:attributeGroup ref="expression_attributes"/>
</xs:complexType>
......@@ -69,6 +87,7 @@ label by using <product>, <sum>, <zero>, <identity> and <word> tags.
-->
<xs:complexType name="expression_label">
<xs:choice>
<xs:element name="star" type="star" minOccurs="0"/>
<xs:element name="word" type="word" minOccurs="0"/>
<xs:element name="sum" type="sum" minOccurs="0"/>
<xs:element name="product" type="product" minOccurs="0"/>
......
......@@ -70,8 +70,11 @@ namespace vcsn {
void
XmlExpVisitor<M_, W_>::star(const Node<M_, W_>* node)
{
current_->setAttribute(STR2XML("star"), STR2XML("true"));
xercesc::DOMElement* tmp = current_;
current_ = doc_->createElement(STR2XML("star"));
weight_or_star(node);
tmp->appendChild(current_);
current_ = tmp;
}
template<typename M_, typename W_>
......
......@@ -410,23 +410,23 @@ namespace vcsn
if (xml2str(n->getNodeName()) == "product")
next_op_type = VCSN_XML_PRODUCT_TYPE;
// Add weight (and opening brace if complex expression)
// Add weight (and opening brace if complex expression).
if (element_n->hasAttribute(STR2XML("weight")))
res += xml2str(element_n->getAttribute(STR2XML("weight")))
+ " ";
// Add opening prace if attribute or complex starified/weighted
// expression or sum in product
// Add opening brace if attribute,complex weighted
// expression, sum in product, product in sum or star.
if ((element_n->hasAttribute(STR2XML("parenthesis")) &&
xml2str(element_n->getAttribute(STR2XML("parenthesis")))
== "true")
|| ((((element_n->hasAttribute(STR2XML("star")))
&& (xml2str(element_n->getAttribute(STR2XML("star")))
== "true"))
||(element_n->hasAttribute(STR2XML("weight"))))
|| ((element_n->hasAttribute(STR2XML("weight")))
&& (xml2str(n->getNodeName()) != "word"))
|| ((xml2str(n->getNodeName()) == "sum")
&& (op_type == VCSN_XML_PRODUCT_TYPE)))
&& (op_type == VCSN_XML_PRODUCT_TYPE))
|| ((xml2str(n->getNodeName()) == "product")
&& (op_type == VCSN_XML_SUM_TYPE))
|| (xml2str(n->getNodeName()) == "star"))
res += "(";
// Word, zero or identity
......@@ -458,13 +458,13 @@ namespace vcsn
&& (op_type == VCSN_XML_PRODUCT_TYPE))
// Or a product in a sum
|| ((xml2str(n->getNodeName()) == "product")
&& (op_type == VCSN_XML_SUM_TYPE)))
&& (op_type == VCSN_XML_SUM_TYPE))
// Or star.
|| (xml2str(n->getNodeName()) == "star"))
res += ")";
// Add star
if (element_n->hasAttribute(STR2XML("star"))
&& (xml2str(element_n->getAttribute(STR2XML("star")))
== "true"))
if (xml2str(n->getNodeName()) == "star")
res += "*";
// Add operator
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment