http://www.hansanderson.com/ me
/*
(c) 2000 Hans Anderson Corporation. All Rights Reserved.
You are free to use and modify this class under the same
guidelines found in the PHP License.
-----------
bugs/me:
http://www.hansanderson.com/php/
me@hansanderson.com
-----------
Version 1.0
- 1.0 is the first actual release of the class. It's
finally what I was hoping it would be, though there
are likely to still be some bugs in it. This is
a much changed version, and if you have downloaded
a previous version, this WON'T work with your existing
scripts! You'll need to make some SIMPLE changes.
- .92 fixed bug that didn't include tag attributes
(to use attributes, add _attributes[array_index]
to the end of the tag in question:
$xml_html_head_body_img would become
$xml_html_head_body_img_attributes[0],
for example)
-- Thanks to Nick Winfield
for reporting this bug.
- .91 No Longer requires PHP4!
- .91 now all elements are array. Using objects has
been discontinued.
-----------
What class.xml.php is:
A very, very easy to use XML parser class. It uses PHP's XML functions
for you, returning one array that has all the tag information. The only
hard part is figuring out the syntax of the tags!
-----------
Sample use:
require('class.xml.php');
$file = "data.xml";
$data = implode("",file($file)) or die("could not open XML input file");
$obj = new xml($data,"xml");
print $xml["hans"][0]->num_results[0];
for($i=0;$i
}
To print url attributes (if they exist):
print $xml["hans"][0]->attributes[0]["size"]; # where "size" was an attr name
(that's it! slick, huh?)
-----------
Two ways to call xml class:
$xml = new xml($data);
- or -
$xml = new xml($data,"jellyfish");
The second argument (jellyfish) is optional. Default is 'xml'.
All the second argument does is give you a chance to name the array
that is returned something besides "xml" (in case you are already using
that name). Normal PHP variable name rules apply.
----------
Explanation of xml class:
This class takes valid XML data as an argument and
returns all the information in a complex but loopable array.
Here's how it works:
Data:
Run the data through my class, then access the title like this:
$xml["html_head"][0]->title[0];
Or, loop through them:
for($i=0;$i
}
Yes, the variable names *are* long and messy, but it's
the best way to create the tree, IMO.
Here is a complex explanation I sent to one class.xml.php user:
---------
> Now I've run into another problem:
>
>
>
>
Senior
> Writer
>
>
> How do I get BYLINE_AUTHOR?
print $xml["STORY_BYLINE"][0]->BYLINE_AUTHOR[0];
> And just a little question: Is there an easy way to get TIMESTAMP?
print $xml["STORY"][0]->attributes[0]["TIMESTAMP"];
This is confusing, I know, but it's the only way I could really do
this. Here's the rundown:
The $xml part is an array -- an array of arrays. The first array is the

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

WebStorm Mac版
好用的JavaScript開發工具

記事本++7.3.1
好用且免費的程式碼編輯器

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中