2009-04-30 5 views
0

내가 주어진 파일의 모든 HTML 태그 목록을 표시하려면이 프로그램을 사용하고 DOM 트리 (libxml)에서 속성 예 : <a>의 경우 href="something")?얻기 HTML은

답변

0

거기 그런 분야입니다 보인다

[email protected]:~/Prog_zesp> g++ `xml2-config --cflags --libs` -o tester tester.cpp 
tester.cpp: In function ‘void print_element_names(xmlNode*)’: 
tester.cpp:17: error: ‘struct _xmlNode’ has no member named ‘attributes’ 

=== 편집 ===

나는 이런 식으로 뭔가 할 경우

if (strcmp((char *)cur_node->name, "a")==0) { 
     cout << cur_node->properties->name << endl; 

을 내가 이름을 얻을 속성 - "href"

한 걸음 더 나아가려면

if (strcmp((char *)cur_node->name, "a")==0) { 
      cout << cur_node->properties->children->name << endl; 

"텍스트"가 표시되지만 실제 링크는 표시되지 않습니다.