문제

이제는 www :: mechanize www :: www :: 를 통해 정보를 얻을 수 있습니다. href="http://p3rl.org/html%3a.p3rl.org/html%3a.patreebuilder%3a%3axpath"rel="nofollow"> html :: treeBuilder :: xpath id를 사용하여 HTML 트리의 레이아웃을 발견하기 위해 DOM을 읽으려면 Firebug . 캡처를 기계화하는 콘텐츠는 인간의 눈에 좋지 않고 비 구조화 된 HTML입니다.

는 Firebug를 사용하여 전형적인 접근 방식 이후의 ID를 확인하고 있습니까? 일단 ID를 얻으면 나는 가야 할 것이 좋다, 나는 더 많은 ID가 더 많은 ids와 페이지를 쫓아 내고, 나는 DOM의 형식이있는 레이아웃을 얻고 싶었습니다. 그 발견을 더 쉽게하기 위해서. 유의하지만, Firebug도 꽤 쉽게 만듭니다. 나는 더 쉬운 방법을 놓치는지 궁금합니다.

Perlmonks에서 costposted

도움이 되었습니까?

해결책

If you need text, xmllint --html --format (comes with libxml2) does a decent job.

If you want a tree and mess with it and test out various expressions in a GUI, then Xacobeo is your new best friend.

Xacobeo screenshot

Note: since both those tools rely on libxml, replace HTML::TreeBuilder::XPath with HTML::TreeBuilder::LibXML for compatibility. Evaluating XPath will be faster that way, too.


If you know Javascript/JQuery, then also install FireQuery. You can then test out CSS expressions in FireBug, and use them with modules that select HTML through CSS expressions, e.g. Web::Query.

FireQuery screenshot

다른 팁

I use XML Developer from Oxygen IDE for my recent development on XPath: http://www.oxygenxml.com/download.html It is a 30-day trial type of tool, but you can also search for XPath visualizer

It doesn't visualize a tree for you as far as I know (maybe there's a panel doing that). But it gives you some smart complete functionally that helps you to know what nodes you have available at any point. It is pretty big for XPath because it is hard to know where the parser pivot is really pointing at.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top