Exemplo n.º 1
0
void BulletMLParserXercesSAXHandler::startElement(const XMLCh* const name,
												  AttributeList& attributes)
{
	BulletMLNode* node = parser_->addContent(parser_->uc2string(name));

	if (node->getName() == BulletMLNode::bulletml) {
		for (unsigned int i = 0; i < attributes.getLength(); i++) {
			if (parser_->uc2string(attributes.getName(i)) == "type" &&
				parser_->uc2string(attributes.getValue(i)) == "horizontal")
			{
				parser_->setHorizontal();
			}
		}
	}
	else {
		BulletMLParserXerces::MyAttributes mattr;
		for (unsigned int i = 0; i < attributes.getLength(); i++) {
			mattr.push_back(parser_->uc2string(attributes.getName(i)));
			mattr.push_back(parser_->uc2string(attributes.getValue(i)));
		}
		parser_->addAttribute(mattr, node);
	}

	if (curNode_ != 0) curNode_->addChild(node);
	curNode_ = node;
}
Exemplo n.º 2
0
void BulletMLParserYggdrasil::start_element(yggdrasil::ygg_node element) {
    BulletMLNode* xmlNode = addContent(trimString(element.get_name()));

	if (xmlNode->getName() != BulletMLNode::bulletml) {
		MyAttributes mattr;
		for (ygg_iterator ite = element["@*"].begin(); ite.is_not_end(); ++ite)
		{
			mattr.push_back(trimString(ite->get_name()));
			mattr.push_back(trimString(ite->get_value()));
		}
		if (!mattr.empty()) addAttribute(mattr, xmlNode);

		if (curNode_ != 0) curNode_->addChild(xmlNode);
	}
	curNode_ = xmlNode;
}
Exemplo n.º 3
0
BulletMLRunnerImpl::Parameters* BulletMLRunnerImpl::getParameters() {
	Parameters* para = 0;
	bool first = true;

	BulletMLNode::ChildIterator ite;
	for (ite = act_->childBegin(); ite != act_->childEnd(); ite++) {
		BulletMLNode* node = *ite;
		if (node->getName() != BulletMLNode::param) continue;

		if (first) {
			first = false;
			para = new Parameters;
			// 0番要素は使わない
			para->push_back(0);
		}

		para->push_back(getNumberContents(node));
	}

	return para;
}
Exemplo n.º 4
0
void BulletMLParserTinyXML::translateNode(TiXmlNode* node) {
    TiXmlElement* elem = node->ToElement();
    assert(elem != 0);

    BulletMLNode* xmlNode = addContent(elem->Value());

    if (xmlNode->getName() == BulletMLNode::bulletml) {
        TiXmlAttribute* attr;
        for (attr = elem->FirstAttribute(); attr; attr = attr->Next()) {
            if (attr->Value() == "horizontal") setHorizontal();
        }
    }
    else {
        MyAttributes mattr;
        TiXmlAttribute* attr;
        for (attr = elem->FirstAttribute(); attr; attr = attr->Next()) {
            mattr.push_back(attr->Name());
            mattr.push_back(attr->Value());
        }
        addAttribute(mattr, xmlNode);
        if (curNode_ != 0) curNode_->addChild(xmlNode);
    }
    curNode_ = xmlNode;
}