/[cvs]/nfo/php/libs/com.newsblob.phphtmllib/test/test11.php
ViewVC logotype

Contents of /nfo/php/libs/com.newsblob.phphtmllib/test/test11.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Thu Jan 30 03:29:40 2003 UTC (21 years, 5 months ago) by jonen
Branch: MAIN, no_vendor_tag
CVS Tags: v2-1-3, no_release_tag, HEAD
Changes since 1.1: +0 -0 lines

1 <?php
2
3 $doc_root = $DOCUMENT_ROOT;
4
5 $phphtmllib = $doc_root . "/phphtmllib";
6 include_once($phphtmllib . "/includes.php");
7
8 $babw_classes = $doc_root . "/babw_classes";
9 include_once($babw_classes . "/includes.php");
10
11 $page = new HTMLPageClass("Test 11 page", XHTML);
12 $page->set_text_debug( $debug );
13
14
15 function get_dom_attributes( $dom ) {
16 //try and get all the attributes for this
17 //dom tag.
18
19 if ($dom->attributes) {
20 foreach ($dom->attributes as $attr) {
21 $name = $attr->name;
22 $value = $attr->children[0]->content;
23 $attributes[$name] = $value;
24 }
25 return $attributes;
26 } else {
27 return NULL;
28 }
29
30 }
31
32 function build_tags( $dom ) {
33
34 //xmp_var_dump( $dom );
35
36 //walk through the tree and build
37 //HTMLTag objects
38 if ($dom->type == XML_ELEMENT_NODE) {
39 $tagstr= strtoupper($dom->name) . "tag";
40 $attributes = get_dom_attributes( $dom );
41 $tag = new $tagstr($attributes);
42 if ($dom->children) {
43 foreach( $dom->children as $child) {
44 $tag->push( build_tags( $child ) );
45 }
46 }
47 } elseif ($dom->type == XML_TEXT_NODE) {
48 if (ord($dom->content) != 10) {
49 return $dom->content;
50 } else {
51 return NULL;
52 }
53
54 }
55
56 return $tag;
57 }
58
59
60 $thehtml=join("", file("rick.html"));
61
62 $tree = xmltree( $thehtml );
63
64 $obj = build_tags( $tree->root );
65 //$page->push( $obj );
66 print $obj->render( 0, TRUE );
67
68
69
70
71 //print $page->render();
72 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed