Ask a Question related to PHP Development, Design and Development.
-
Hetfield #1
xml tree parsing
hi
i need to parse a tree structure definited in a xml document...dow you can
find a simple part...but structure is much longer with several levels.
every level must know his "sons" and not whole tree below it..
can u help me parsing it? it's very important.
Thx so much.
*********************
<?xml version="1.0"?>
<tree>
<level>
<name>Project doc1</name>
<files>doc di progetto1</files>
<level>
<name>secondo liv2</name>
<files>secondofiles2</files>
<level>
<name> liv3</name>
<files>liv3</files>
<level>
<name> liv4</name>
<files> liv44</files>
</level>
</level>
<level>
<name>secondo liv33</name>
<files>secondofiles33</files>
</level>
</level>
<level>
<name>secondo liv2</name>
<files>secondofiles2</files>
</level>
</level>
</tree>
Hetfield Guest
-
XML::DOM parsing pb
Hi, I have a simple parsing problem (I know it is simple but I just started with XML::DOM) that I do not know how to resolve : here is the xml... -
About XML tree
Hi I want to know about height of content because I want to move box below the tree menu (last menu) so I see if tree is over than that we create... -
tree
i want to add a node in a specific place after serching a specific node name can it be done note i try to serch a specific node whith the method... -
Pod-Tree
Hi, i have to perform the simple (!!!) task of generating the HTML doc out of a code distro. So i'm trying to make sense of pod2html, but i don't... -
Pod::Tree
Hey all, I wanna implement a weighted tree in perl, Pod::Tree looks like it'll help, but what's POD actually stand for? And are they are any... -
Andy Hassall #2
Re: xml tree parsing
On Mon, 01 Dec 2003 17:08:31 GMT, Hetfield <hetfield@email.it> wrote:
[url]http://php.net/xml[/url]>i need to parse a tree structure definited in a xml document
--
Andy Hassall (andy@andyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
Space: disk usage analysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
Andy Hassall Guest
-
Armenia #3
Re: xml tree parsing
<head>
<title>Treeview</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.6.1.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="js/jquery.treeview.js"></script>
</head>
<body>
<div>
<ul id="browser">
<?php
$filename = new DOMDocument();
$filename->load('test.xml');
$students = $filename->getElementsByTagName("level");
foreach( $students as $student )
{
$stu = $student->localName;
$names = $student->getElementsByTagName("name");
$name = $names->item(0)->nodeValue;
$files = $student->getElementsByTagName("files");
$file = $files->item(0)->nodeValue;
echo "
<li class='closed'>".$stu."
<ul><li>".$name."</li>
<li>".$file."</ul></li>";
}
?>
</ul>
</div>
<script type="text/javascript">
$(document).ready(function(){
// ---- TREE -----
$("#browser").treeview();
$("#navigation").treeview({
persist: "location",
collapsed: true,
unique: true
});
// ---- TREE -----
});
</script>
</body>Armenia Guest



Reply With Quote

