void FDPLoader::parseSource(DOMNode* pSource) { DOMNodeIterator* iterator = m_pDoc->createNodeIterator(pSource, DOMNodeFilter::SHOW_ELEMENT | DOMNodeFilter::SHOW_ATTRIBUTE, NULL, true); // use the tree walker to print out the text nodes. for ( DOMNode* current = iterator->nextNode(); current != 0; current = iterator->nextNode() ) { if(XercesString(current->getNodeName()) == "entity") loadEntity(current); } }
int main() { try { XMLPlatformUtils::Initialize(); } catch (const XMLException& toCatch) { char *pMessage = XMLString::transcode(toCatch.getMessage()); fprintf(stderr, "Error during XMLPlatformUtils::Initialize(). \n" " Message is: %s\n", pMessage); XMLString::release(&pMessage); return -1; } // Create a XMLCh buffer for string manipulation XMLCh tempStr[4000]; XMLCh featureStr[100]; XMLString::transcode("Traversal",featureStr,99); // // Doc - Create a small document tree // { //creating a DOM Tree /* Tests are based on the tree structure below doc - root - E11 (attr01) - textNode1 - E111 - E112 - cdataSec - E12 (attr02) - textNode2 - E121 - E122 - E13 - E131 - docPI - comment */ DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(featureStr); DOMDocument* doc = impl->createDocument(); //Creating a root element XMLString::transcode("RootElement", tempStr, 3999); DOMElement* root = doc->createElement(tempStr); doc->appendChild(root); //Creating the siblings of root XMLString::transcode("FirstSibling", tempStr, 3999); DOMElement* E11 = doc->createElement(tempStr); root->appendChild(E11); XMLString::transcode("SecondSibling", tempStr, 3999); DOMElement* E12 = doc->createElement(tempStr); root->appendChild(E12); XMLString::transcode("ThirdSibling", tempStr, 3999); DOMElement* E13 = doc->createElement(tempStr); root->appendChild(E13); //Attaching texts to few siblings XMLString::transcode("Text1", tempStr, 3999); DOMText* textNode1 = doc->createTextNode(tempStr); E11->appendChild(textNode1); XMLString::transcode("Text2", tempStr, 3999); DOMText* textNode2 = doc->createTextNode(tempStr); E12->appendChild(textNode2); //creating child of siblings XMLString::transcode("FirstSiblingChild1", tempStr, 3999); DOMElement* E111 = doc->createElement(tempStr); E11->appendChild(E111); XMLString::transcode("Attr01", tempStr, 3999); DOMAttr* attr01 = doc->createAttribute(tempStr); DOMNode* rem = E11->setAttributeNode(attr01); if (rem) rem->release(); XMLString::transcode("FirstSiblingChild2", tempStr, 3999); DOMElement* E112 = doc->createElement(tempStr); E11->appendChild(E112); XMLString::transcode("SecondSiblingChild1", tempStr, 3999); DOMElement* E121 = doc->createElement(tempStr); E12->appendChild(E121); XMLString::transcode("Attr01", tempStr, 3999); DOMAttr* attr02 = doc->createAttribute(tempStr); rem = E12->setAttributeNode(attr02); if (rem) rem->release(); XMLString::transcode("SecondSiblingChild2", tempStr, 3999); DOMElement* E122 = doc->createElement(tempStr); E12->appendChild(E122); XMLString::transcode("ThirdSiblingChild1", tempStr, 3999); DOMElement* E131 = doc->createElement(tempStr); E13->appendChild(E131); XMLString::transcode("DocComment", tempStr, 3999); DOMComment* comment = doc->createComment(tempStr); root->appendChild(comment); XMLString::transcode("DocCDataSection", tempStr, 3999); DOMCDATASection* cdataSec = doc->createCDATASection(tempStr); E11->appendChild(cdataSec); XMLString::transcode("DocPI", tempStr, 3999); XMLCh piStr[] = {chLatin_D, chLatin_o, chLatin_c, chLatin_P, chLatin_I, chNull}; DOMProcessingInstruction* docPI = doc->createProcessingInstruction(piStr, tempStr); E13->appendChild(docPI); /* following are whatToShow types: SHOW_ALL = 0x0000FFFF, SHOW_ELEMENT = 0x00000001, SHOW_ATTRIBUTE = 0x00000002, SHOW_TEXT = 0x00000004, SHOW_CDATA_SECTION = 0x00000008, SHOW_ENTITY_REFERENCE = 0x00000010, SHOW_ENTITY = 0x00000020, SHOW_PROCESSING_INSTRUCTION = 0x00000040, SHOW_COMMENT = 0x00000080, SHOW_DOCUMENT = 0x00000100, SHOW_DOCUMENT_TYPE = 0x00000200, SHOW_DOCUMENT_FRAGMENT = 0x00000400, SHOW_NOTATION = 0x00000800 */ ////////// NodeIterator Test Cases //////////////// { // all node iterating test DOMNode* node = doc->getFirstChild(); UNUSED(node); // silence warning unsigned long whatToShow = DOMNodeFilter::SHOW_ALL; MyFilter* filter = new MyFilter(0); DOMNodeIterator* iter = ((DOMDocumentTraversal*)doc)->createNodeIterator(root, whatToShow, filter, true); TASSERT(iter->getWhatToShow() == 65535); TASSERT(iter->getExpandEntityReferences() == 1); DOMNode* nd; nd = iter->nextNode(); TASSERT (nd ==root); nd = iter->nextNode(); TASSERT (nd ==E11); nd = iter->nextNode(); TASSERT(nd == textNode1); nd = iter->nextNode(); TASSERT(nd == E111); nd = iter->nextNode(); TASSERT(nd == E112); nd = iter->nextNode(); TASSERT(nd == cdataSec); nd = iter->nextNode(); TASSERT(nd == E12); nd = iter->nextNode(); TASSERT(nd == textNode2); nd = iter->nextNode(); TASSERT(nd == E121); nd = iter->nextNode(); TASSERT(nd == E122); nd = iter->nextNode(); TASSERT(nd == E13); nd = iter->nextNode(); TASSERT(nd == E131); nd = iter->nextNode(); TASSERT(nd == docPI); nd = iter->nextNode(); TASSERT(nd == comment); nd = iter->previousNode(); TASSERT(nd == comment); nd = iter->previousNode(); TASSERT(nd == docPI); nd = iter->previousNode(); TASSERT(nd == E131); //test getRoot TASSERT(iter->getRoot() == root); TASSERT(iter->getRoot() != doc); delete filter; } { //element node iterating test DOMNode* node = doc->getFirstChild(); UNUSED(node); // silence warning unsigned long whatToShow = DOMNodeFilter::SHOW_ELEMENT; MyFilter* filter = new MyFilter(DOMNode::ELEMENT_NODE); DOMNodeIterator* iter = doc->createNodeIterator(root, whatToShow, filter, true); TASSERT(iter->getWhatToShow() == 1); TASSERT(iter->getExpandEntityReferences() == 1); DOMNode* nd; nd = iter->nextNode(); TASSERT (nd ==root); nd = iter->nextNode(); TASSERT (nd ==E11); nd = iter->nextNode(); TASSERT(nd == E111); nd = iter->nextNode(); TASSERT(nd == E112); nd = iter->nextNode(); TASSERT(nd == E12); nd = iter->nextNode(); TASSERT(nd == E121); nd = iter->nextNode(); TASSERT(nd == E122); nd = iter->nextNode(); TASSERT(nd == E13); nd = iter->nextNode(); TASSERT(nd == E131); nd = iter->previousNode(); TASSERT(nd == E131); nd = iter->previousNode(); TASSERT(nd == E13); nd = iter->previousNode(); TASSERT(nd == E122); delete filter; } { // Text node iterating test DOMNode* node = doc->getFirstChild(); UNUSED(node); // silence warning unsigned long whatToShow = DOMNodeFilter::SHOW_TEXT; MyFilter* filter = new MyFilter(DOMNode::TEXT_NODE); DOMNodeIterator* iter = ((DOMDocumentTraversal*)doc)->createNodeIterator(root, whatToShow, filter, true); TASSERT(iter->getWhatToShow() == 4); TASSERT(iter->getExpandEntityReferences() == 1); DOMNode* nd; nd = iter->nextNode(); TASSERT (nd ==textNode1); nd = iter->nextNode(); TASSERT (nd ==textNode2); nd = iter->previousNode(); TASSERT(nd == textNode2); delete filter; } { //CDataSection node itearating test DOMNode* node = doc->getFirstChild(); UNUSED(node); // silence warning unsigned long whatToShow = DOMNodeFilter::SHOW_CDATA_SECTION; MyFilter* filter = new MyFilter(DOMNode::CDATA_SECTION_NODE); DOMNodeIterator* iter = doc->createNodeIterator(root, whatToShow, filter, true); TASSERT(iter->getWhatToShow() == 8); TASSERT(iter->getExpandEntityReferences() == 1); DOMNode* nd; nd = iter->nextNode(); TASSERT(nd == cdataSec); nd = iter->nextNode(); TASSERT(nd == 0); delete filter; } { // PI nodes iterating test DOMNode* node = doc->getFirstChild(); UNUSED(node); // silence warning unsigned long whatToShow = DOMNodeFilter::SHOW_PROCESSING_INSTRUCTION; MyFilter* filter = new MyFilter(DOMNode::PROCESSING_INSTRUCTION_NODE); DOMNodeIterator* iter = ((DOMDocumentTraversal*)doc)->createNodeIterator(root, whatToShow, filter, true); TASSERT(iter->getWhatToShow() == 64); TASSERT(iter->getExpandEntityReferences() == 1); DOMNode* nd; nd = iter->nextNode(); TASSERT(nd == docPI); nd = iter->nextNode(); TASSERT(nd == 0); delete filter; } { DOMNode* node = doc->getFirstChild(); UNUSED(node); // silence warning unsigned long whatToShow = DOMNodeFilter::SHOW_COMMENT; MyFilter* filter = new MyFilter(DOMNode::COMMENT_NODE); DOMNodeIterator* iter = doc->createNodeIterator(root, whatToShow, filter, true); TASSERT(iter->getWhatToShow() == 128); TASSERT(iter->getExpandEntityReferences() == 1); DOMNode* nd; nd = iter->nextNode(); TASSERT(nd == comment); nd = iter->nextNode(); TASSERT(nd == 0); delete filter; } ////////// TreeWalker Test Cases //////////////// { unsigned long whatToShow = DOMNodeFilter::SHOW_ALL; DOMTreeWalker* tw = ((DOMDocumentTraversal*)doc)->createTreeWalker(doc, whatToShow, 0, true); TASSERT(tw->getCurrentNode() == doc); TASSERT(tw->firstChild() == root); TASSERT(tw->nextSibling() == 0); TASSERT(tw->lastChild() == comment); TASSERT(tw->firstChild() == 0); TASSERT(tw->lastChild() == 0); TASSERT(tw->nextSibling() == 0); TASSERT(tw->nextNode() == 0); TASSERT(tw->previousSibling() == E13); TASSERT(tw->previousNode() == E122); TASSERT(tw->parentNode() == E12); TASSERT(tw->firstChild() == textNode2); TASSERT(tw->previousSibling() == 0); TASSERT(tw->nextSibling() == E121); TASSERT(tw->nextNode() == E122); TASSERT(tw->parentNode() == E12); TASSERT(tw->previousSibling() == E11); TASSERT(tw->previousNode() == root); TASSERT(tw->previousNode() == doc); TASSERT(tw->previousNode() == 0); TASSERT(tw->parentNode() == 0); TASSERT(tw->getCurrentNode() == doc); } { MyFilter mf(DOMNode::ELEMENT_NODE); unsigned long whatToShow = DOMNodeFilter::SHOW_ALL; DOMTreeWalker* tw = doc->createTreeWalker(root, whatToShow, &mf, true); TASSERT(tw->getCurrentNode() == root); TASSERT(tw->parentNode() == 0); //should not change currentNode TASSERT(tw->getCurrentNode() == root); TASSERT(tw->nextNode() == E11); TASSERT(tw->nextNode() == E111); tw->setCurrentNode(E12); //when first is not visible, should it go to its sibling? TASSERT(tw->firstChild() == E121); //first visible child TASSERT(tw->previousSibling() == 0); } { MyFilter mf(DOMNode::ELEMENT_NODE, true); unsigned long whatToShow = DOMNodeFilter::SHOW_ELEMENT; DOMTreeWalker* tw = ((DOMDocumentTraversal*)doc)->createTreeWalker(root, whatToShow, &mf, true); tw->setCurrentNode(E12); TASSERT(tw->firstChild() == E121); //still first visible child } { MyFilter mf(DOMNode::TEXT_NODE); unsigned long whatToShow = DOMNodeFilter::SHOW_TEXT; DOMTreeWalker* tw = doc->createTreeWalker(root, whatToShow, &mf, true); //when first is not visible, should it go to its descendent? TASSERT(tw->firstChild() == textNode1); //E11 skipped TASSERT(tw->firstChild() == 0); TASSERT(tw->nextNode() == textNode2); TASSERT(tw->nextSibling() == 0); TASSERT(tw->parentNode() == 0); //no visible ancestor TASSERT(tw->getCurrentNode() == textNode2); tw->setCurrentNode(root); //when last is not visible, should it go to its sibling & descendent? TASSERT(tw->lastChild() == textNode2); //last visible child tw->setCurrentNode(E12); //when next sibling is not visible, should it go to its descendent? TASSERT(tw->nextSibling() == 0); } { MyFilter mf(DOMNode::TEXT_NODE, true); unsigned long whatToShow = DOMNodeFilter::SHOW_TEXT; DOMTreeWalker* tw = ((DOMDocumentTraversal*)doc)->createTreeWalker(root, whatToShow, &mf, true); TASSERT(tw->firstChild() == 0); //E11 rejected and no children is TEXT TASSERT(tw->getCurrentNode() == root); TASSERT(tw->nextNode() == 0); //E11 rejected so can't get to textNode1 //test getRoot TASSERT(tw->getRoot() == root); TASSERT(tw->getRoot() != doc); } doc->release(); }; // And call the termination method XMLPlatformUtils::Terminate(); if (errorOccurred) { printf("Test Failed\n"); return 4; } printf("Test Run Successfully\n"); return 0; };
void FDPLoader::loadFDPItem(DOMNode* pFDPItem) { DOMNamedNodeMap* attrList = pFDPItem->getAttributes(); FDPItem* pItem = 0; // get the name (id) DOMNode* attr = attrList->getNamedItem(XercesString("name")); if(attr) { char* name = XMLString::transcode(attr->getNodeValue()); // create a new item (will be deleted in dtor of FDP class) pItem = new FDPItem(name); XMLString::release(&name); } else return; // get the control vertex index attr = attrList->getNamedItem(XercesString("index")); if(attr) { char* index = XMLString::transcode(attr->getNodeValue()); pItem->setControlPoint((unsigned short)atoi(index)); XMLString::release(&index); } // get the affecting mesh name attr = attrList->getNamedItem(XercesString("affects")); if(attr) { char* affects = XMLString::transcode(attr->getNodeValue()); pItem->setAffects(affects); XMLString::release(&affects); } DOMNodeIterator* iterator = m_pDoc->createNodeIterator(pFDPItem, DOMNodeFilter::SHOW_ELEMENT | DOMNodeFilter::SHOW_ATTRIBUTE, NULL, true); // use the tree walker to print out the text nodes. for ( DOMNode* current = iterator->nextNode(); current != 0; current = iterator->nextNode() ) { if(XercesString(current->getNodeName()) == "indices") { DOMNodeList* children = current->getChildNodes(); // we should have only one child, text node, just a safety net here if ( (children->getLength() == 1) && (children->item(0)->getNodeType() == DOMNode::TEXT_NODE) )//(XercesString(children->item(0)->getNodeName()) == "#text") ) { char* pStr = XMLString::transcode(children->item(0)->getNodeValue()); std::string str(pStr); processIndices(str, pItem); XMLString::release(&pStr); } } else if (XercesString(current->getNodeName()) == "influence") // can have multiple of those { // sample: <influence weight="0.25" fap="3" type="RaisedCosInfluenceWaveY" /> DOMNamedNodeMap* influenceAttr = current->getAttributes(); // get the weight float w = toFloat(influenceAttr->getNamedItem(XercesString("weight"))->getNodeValue()); unsigned short fap = (unsigned short)toFloat(influenceAttr->getNamedItem(XercesString("fap"))->getNodeValue()); char* type = XMLString::transcode(influenceAttr->getNamedItem(XercesString("type"))->getNodeValue()); IInfluenceCalculator* pInfluence = InfluenceCalculatorMaker::newInfluenceCalculator(type, w, fap); if(pInfluence) pItem->addInfluenceCalculator(pInfluence); } } m_pFDP->insertItem(pItem); }
void FDPLoader::loadEntity(DOMNode* pSource) { DOMNamedNodeMap* attrList = pSource->getAttributes(); std::string alias, category; DOMNode* attr = attrList->getNamedItem(XercesString("alias")); if(attr) { char* aliasPtr = XMLString::transcode(attr->getNodeValue()); alias.assign(aliasPtr); XMLString::release(&aliasPtr); } attr = attrList->getNamedItem(XercesString("category")); if(attr) { char* catPtr = XMLString::transcode(attr->getNodeValue()); category.assign(catPtr); XMLString::release(&catPtr); } DOMNodeIterator* iterator = m_pDoc->createNodeIterator(pSource, DOMNodeFilter::SHOW_ELEMENT | DOMNodeFilter::SHOW_ATTRIBUTE, NULL, true); // use the tree walker to print out the text nodes. for ( DOMNode* current = iterator->nextNode(); current != 0; current = iterator->nextNode() ) { if(XercesString(current->getNodeName()) == "mesh") { XEngine::MeshInfo info; attrList = current->getAttributes(); attr = attrList->getNamedItem(XercesString("file")); if(attr) info.file = XMLString::transcode(attr->getNodeValue()); attr = attrList->getNamedItem(XercesString("format")); if(attr) info.format = XMLString::transcode(attr->getNodeValue()); attr = attrList->getNamedItem(XercesString("path")); if(attr) info.path = XMLString::transcode(attr->getNodeValue()); else info.path.assign(""); info.keyframe_alias = alias; info.keyframe_category = category; if(alias == "Rest") m_faceEntityMeshInfo.push_back(info); // push the Rest state into the morph target dictionary as well m_morphTargetsMeshInfos[alias].push_back(info); } else if(XercesString(current->getNodeName()) == "bind") { XEngine::MeshInfo info; std::string submesh, item; attrList = current->getAttributes(); attr = attrList->getNamedItem(XercesString("submesh")); if(attr) submesh = XMLString::transcode(attr->getNodeValue()); attr = attrList->getNamedItem(XercesString("item")); if(attr) item = XMLString::transcode(attr->getNodeValue()); if(item == "LeftEye" || item == "RightEye") // eye pivots { Vector3 eye(0, 0, 0); //std::string x, y, z; attr = attrList->getNamedItem(XercesString("pivotX")); if(attr) eye.x = toFloat(attr->getNodeValue()); attr = attrList->getNamedItem(XercesString("pivotY")); if(attr) eye.y = toFloat(attr->getNodeValue()); attr = attrList->getNamedItem(XercesString("pivotZ")); if(attr) eye.z = toFloat(attr->getNodeValue()); if(item == "LeftEye") m_pFDP->setLeftEyePivot(eye); else m_pFDP->setRightEyePivot(eye); } m_bindings.insert(std::make_pair(submesh, item)); } } }
bool FDPLoader::parseHeader(DOMNode* pHeader) { DOMNodeIterator* iterator = m_pDoc->createNodeIterator(pHeader, DOMNodeFilter::SHOW_ELEMENT | DOMNodeFilter::SHOW_ATTRIBUTE, NULL, true); // use the tree walker to print out the text nodes. for ( DOMNode* current = iterator->nextNode(); current != 0; current = iterator->nextNode() ) { // there are "file", "model", "fapu", "translation" and "rotation" elements in this chunk if (XercesString(current->getNodeName()) == "file") { // sample: <file version="0.2" /> DOMNamedNodeMap* attr = current->getAttributes(); if(!attr) // sth wrong return false; DOMNode* versionAttr = attr->getNamedItem(XercesString("version")); if(XercesString(m_version.c_str()) != versionAttr->getNodeValue()) // versions not matching, flee!! return false; } else if(XercesString(current->getNodeName()) == "fapu") { // sample: <fapu ES0="69.9977" IRISD0="16.0424" ENS0="51.8036" MNS0="30.1538" MW0="50.6392" /> DOMNamedNodeMap* attrList = current->getAttributes(); if(!attrList) // sth wrong return false; /////////////// ES0 DOMNode* attr = attrList->getNamedItem(XercesString("ES0")); if(attr) m_pFDP->setES0(toFloat(attr->getNodeValue())); /////////////// IRISD0 attr = attrList->getNamedItem(XercesString("IRISD0")); if(attr) m_pFDP->setIRISD0(toFloat(attr->getNodeValue())); /////////////// ENS0 attr = attrList->getNamedItem(XercesString("ENS0")); if(attr) m_pFDP->setENS0(toFloat(attr->getNodeValue())); /////////////// MNS0 attr = attrList->getNamedItem(XercesString("MNS0")); if(attr) m_pFDP->setMNS0(toFloat(attr->getNodeValue())); /////////////// MW0 attr = attrList->getNamedItem(XercesString("MW0")); if(attr) m_pFDP->setMW0(toFloat(attr->getNodeValue())); // debug << "fapu item" << std::endl; } else if(XercesString(current->getNodeName()) == "translation") { // sample: <translation x="0" y="-1" z="-659" /> DOMNamedNodeMap* attrList = current->getAttributes(); if(!attrList) // sth wrong return false; float x = 0, y = 0, z = 0; /////////////// x translation DOMNode* attr = attrList->getNamedItem(XercesString("x")); if(attr) x = toFloat(attr->getNodeValue()); /////////////// y translation attr = attrList->getNamedItem(XercesString("y")); if(attr) y = toFloat(attr->getNodeValue()); /////////////// z translation attr = attrList->getNamedItem(XercesString("z")); if(attr) z = toFloat(attr->getNodeValue()); m_pFDP->setGlobalTranslation(x, y, z); // debug << "translation item " << x << " " << y << " " << z << std::endl; } else if(XercesString(current->getNodeName()) == "rotation") { // sample: <rotation axis_x="-0.998192" axis_y="0.0596591" axis_z="0.00728935" axis_angle="0.444541" /> DOMNamedNodeMap* attrList = current->getAttributes(); if(!attrList) // sth wrong return false; float x = 0, y = 0, z = 0, a = 0; /////////////// x rotation DOMNode* attr = attrList->getNamedItem(XercesString("axis_x")); if(attr) x = toFloat(attr->getNodeValue()); /////////////// y rotation attr = attrList->getNamedItem(XercesString("axis_y")); if(attr) y = toFloat(attr->getNodeValue()); /////////////// z rotation attr = attrList->getNamedItem(XercesString("axis_z")); if(attr) z = toFloat(attr->getNodeValue()); /////////////// z rotation attr = attrList->getNamedItem(XercesString("axis_angle")); if(attr) a = toFloat(attr->getNodeValue()); m_pFDP->setGlobalRotation(x, y, z, a); } } return true; }
void ScriptProcessorLoader::loadScript(DOMNode* pScript) { DOMNamedNodeMap* scrAttrList = pScript->getAttributes(); boost::shared_ptr<IScriptProcessor> pItem; // get the name char *scripter_name, *lang; DOMNode* attr = scrAttrList->getNamedItem(XercesString("name")); if(attr) scripter_name = XMLString::transcode(attr->getNodeValue()); else // sth totally wrong return; attr = scrAttrList->getNamedItem(XercesString("type")); if(attr) { // create a new item if (XercesString(attr->getNodeValue()) == "external") pItem.reset(new wxScriptProcessor(scripter_name)); else if (XercesString(attr->getNodeValue()) == "SMIL") pItem.reset(new SMILProcessor(scripter_name)); } // language attr = scrAttrList->getNamedItem(XercesString("lang")); if(attr) { lang = XMLString::transcode(attr->getNodeValue()); pItem->setLanguage(lang); XMLString::release(&lang); } XMLString::release(&scripter_name); DOMNodeIterator* iterator = m_pDoc->createNodeIterator(pScript, DOMNodeFilter::SHOW_ELEMENT | DOMNodeFilter::SHOW_ATTRIBUTE, NULL, true); // use the tree walker to print out the text nodes. for ( DOMNode* current = iterator->nextNode(); current != 0; current = iterator->nextNode() ) { if (XercesString(current->getNodeName()) == "output") // can have multiple of those { // sample: <output filename="TempFile.wav"/> DOMNamedNodeMap* outputAttr = current->getAttributes(); std::string outfile; attr = outputAttr->getNamedItem(XercesString("filename")); if(attr) { char* dummy = XMLString::transcode(attr->getNodeValue()); outfile = dummy; XMLString::release(&dummy); } pItem->push_output(outfile); } else if (XercesString(current->getNodeName()) == "TTSEngine") // can have multiple of those { // sample: <TTS lang="english" engine="SAPI51"/> DOMNamedNodeMap* outputAttr = current->getAttributes(); std::string ttsLang, ttsEngine, ttsPath, ttsIni; attr = outputAttr->getNamedItem(XercesString("lang")); // for which language should we use it if(attr) { char* dummy = XMLString::transcode(attr->getNodeValue()); ttsLang = dummy; XMLString::release(&dummy); } attr = outputAttr->getNamedItem(XercesString("engine")); // which TTS engine (already loaded) if(attr) { char* dummy = XMLString::transcode(attr->getNodeValue()); ttsEngine = dummy; XMLString::release(&dummy); } attr = outputAttr->getNamedItem(XercesString("path")); // does it have a specific (external) executable path? if(attr) { char* dummy = XMLString::transcode(attr->getNodeValue()); ttsPath = dummy; XMLString::release(&dummy); } attr = outputAttr->getNamedItem(XercesString("ini")); // does it have a ini file? if(attr) { char* dummy = XMLString::transcode(attr->getNodeValue()); ttsIni = dummy; XMLString::release(&dummy); } pItem->push_ttsEngine(ttsEngine, ttsLang, ttsPath, ttsIni); } // are we using an external executable? else if (XercesString(current->getNodeName()) == "executable") // can have multiple of those { DOMNamedNodeMap* attrList = current->getAttributes(); // get the executable attr = attrList->getNamedItem(XercesString("exename")); if(attr) { char* exe = XMLString::transcode(attr->getNodeValue()); pItem->setExecutable(exe); XMLString::release(&exe); } // get the path attr = attrList->getNamedItem(XercesString("path")); if(attr) { char* path = XMLString::transcode(attr->getNodeValue()); pItem->setPath(path); XMLString::release(&path); } // get the parameters attr = attrList->getNamedItem(XercesString("parameters1")); if(attr) { char* param = XMLString::transcode(attr->getNodeValue()); pItem->setParameters1(param); XMLString::release(¶m); } attr = attrList->getNamedItem(XercesString("parameters2")); if(attr) { char* param = XMLString::transcode(attr->getNodeValue()); pItem->setParameters2(param); XMLString::release(¶m); } // should we use temp xml file attr = attrList->getNamedItem(XercesString("tempfile")); if(attr) { char* tmpfile = XMLString::transcode(attr->getNodeValue()); pItem->setTempFileName(tmpfile); XMLString::release(&tmpfile); } } } m_processors.push_back(pItem); }