void MySAX2Handler::startElement(const XMLCh* const uri,
const XMLCh* const localname,
const XMLCh* const qname,
const Attributes& attrs)
{
char* message = XMLString::transcode(localname);
cout << "first element: "<< message << endl;
XMLString::release(&message);
}
我想读取该元素的属性,我无法显示
离。 -
<person pname="xyz">
<dept dname="abc"/>
</person>
我想显示属性名称,即pname及其值,即xyz
答案 0 :(得分:3)
http://xerces.apache.org/xerces-c/apiDocs-3/classAttributeList.html
for (int i=0; i< attrs.getLength(); i++)
{
std::cout << attrs.getName(i) << std::cout << attrs.getValue(i) << std::endl;
}
我将通过名称和/或转码和/或命名空间分辨率向上查找:)