PROGRAMA con XPath y DOM:: AYUDAAAAAAAA

Nere
17 de Noviembre del 2003
Alguien me puede ayudar? LLevo 2 dias intentado entender lo que hace este programa, buscando informacion en internet, porque tengo que hacer yo luego cosas parecidas y no soy capaz, me ayuda alguien? No logro entender para que sirve Xalan y todo lo que aparece aqui. Estoy desesperada.

bool CTablesXML::LoadTableSchema (const string &tablename, CFieldList &FL) const
{
bool bRetval = true;

static XalanSourceTreeInit theSourceTreeInit;
static XalanSourceTreeDOMSupport theDOMSupport;
static XalanSourceTreeParserLiaison theLiaison(theDOMSupport);
static XalanDocument* theDocument = 0;

if (!theDocument)
{
theDOMSupport.setParserLiaison(&theLiaison);
LocalFileInputSource theInputSource(c_wstr(XalanDOMString(m_tablesFileFullPath.c_str())));
theDocument = theLiaison.parseXMLStream(theInputSource);
}

string srequest;
NUCCommonStr::format (srequest, "//table[@name='%s']/fields/field", tablename.c_str());

try
{
XPathEvaluator theEvaluator;

XalanNode* const theContextNode = theEvaluator.selectSingleNode(
theDOMSupport,
theDocument,
XalanDOMString("/").c_str(),
theDocument->getDocumentElement());

if (theContextNode)
{
const NodeRefList theResult =
theEvaluator.selectNodeList (
theDOMSupport,
theContextNode,
XalanDOMString(srequest.c_str()).c_str(),
theDocument->getDocumentElement());

FL.DeleteContents();
for (unsigned int i = 0; i < theResult.getLength(); i++)
{
const XalanNamedNodeMap *theAtrrs = theResult.item(i)->getAttributes();

CFieldItem *pI = new CFieldItem();
pI->SetName ((const char*)CXalanDOMString2char(theAtrrs->getNamedItem(XalanDOMString("name"))->getNodeValue()));
pI->SetNemo ((const char*)CXalanDOMString2char(theAtrrs->getNamedItem(XalanDOMString("nemo"))->getNodeValue()));
pI->SetMean ((const char*)CXalanDOMString2char(theAtrrs->getNamedItem(XalanDOMString("caption"))->getNodeValue()));
pI->SetFormat ((const char*)CXalanDOMString2char(theAtrrs->getNamedItem(XalanDOMString("fmt"))->getNodeValue()));
pI->SetVisible (atoi((const char*)CXalanDOMString2char(theAtrrs->getNamedItem(XalanDOMString("visible"))->getNodeValue())));
FL.AddTail (pI);
}
}
else
bRetval = false;
}
catch(...)
{
bRetval = false;
}

return bRetval;
}