在c++中使用xerces读取属性名
read attributes name in C++ using xerces
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
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;
}
我将把名称和/或转码和/或名称空间分辨率的查找留给你:)
相关文章:
- 如何在 C++ 中使用提升属性树从 JSON 文件中读取对象数组
- 从C++代码中直接读取成员属性
- C 从文件中读取对象具有数组属性
- 从C 读取QML数组属性
- 如何从C 中的HDF5文件中读取属性名称和数据集名称,在这里我不知道HDF5文件中存在什么属性
- 我如何使用GO语言读取可能是两种不同数据类型之一的HDF5属性
- 如何从提升属性树中读取字段类型
- 声明仅在C 中使用读取属性的接口
- MFC SDI在更改属性时从INI读取并更新视图字符串
- 组合框初始化错误:无法读取未定义的属性'constructor'
- 运行时未读取log4cplus属性文件更改
- Boost属性树Json读取包含LPWSTR的文件
- 我正在尝试通过 Boost 图形库从 Graphviz DOT 文件中读取图形.如何读取存储在数组中的未知数量的属性
- 如何从 TMXObjectGroup 读取对象定制属性
- 使用派生类"istream"读取基类的属性
- 读取配置属性的简单方法
- 通过boost::read_graphviz()读取boost动态属性时发生异常
- 在c++中使用xerces读取属性名
- 用c++从QML单例中读取属性
- HDF5 C++读取属性的内容