PHP + XML

PEAR, Smarty, ADOdb, OOP, PHP 5, XML, UML, Şabloane de proiectare, PHP-GTK.

Moderatori: coditza, Emil, Moderatori

tanatos
Senior Member
Mesaje: 269
Membru din: Vin Iun 06, 2008 8:01 pm
Localitate: Iasi
Contact:

PHP + XML

Mesajde tanatos » Joi Iun 12, 2008 1:28 pm

salut ! ma poate directiona cineva la un tutorial sau sau imi spuna cum as putea adauga noduri in root la un fisier xml existent ? Multumesc anticipat!



Daemon7
PHPRomania Supporter
Mesaje: 21
Membru din: Joi Iul 21, 2005 5:22 pm
Localitate: Timisoara
Contact:

Mesajde Daemon7 » Joi Iun 12, 2008 2:19 pm

Best regards,
Lapadat Bogdan aka Daemon7
www.lapadatbogdan.srv.ro

tanatos
Senior Member
Mesaje: 269
Membru din: Vin Iun 06, 2008 8:01 pm
Localitate: Iasi
Contact:

Mesajde tanatos » Joi Iun 12, 2008 3:23 pm

am rezolvat problema.Multumesc oricum

razvancg
Junior Member
Mesaje: 42
Membru din: Mar Dec 20, 2005 9:14 pm
Localitate: Cluj-Napoca
Contact:

Mesajde razvancg » Vin Iun 27, 2008 11:50 pm

pentri eventualele cautari ... recomand xpath ...se poate ajunge oricunde si se poate lua orice informatie dorita din xml
/* Select the first bar child of element foo */
// print_r($foo->xpath('foo/bar[1]'));

/* Select the last bar child of element foo */
// print_r($foo->xpath('foo/bar[last()]'));

/* Select bar elements which have attribute id */
// print_r($foo->xpath('//bar[@id]'));

/* Select bar elements which have any attribute */
// print_r($foo->xpath('//bar[@*]'));

/* Select bar elements without an attribute */
// print_r($foo->xpath('//bar[not(@*)]'));

/* Select all elements with name bar, equivalent with //bar */
// print_r($foo->xpath('//*[name()="bar"]'));

/* Select all elements name of which starts with letter f */
// print_r($foo->xpath('//*[starts-with(name(), "f")]'));

/* Select all elements name of which contain letter f */
// print_r($foo->xpath('//*[contains(name(), "f")]'));

/* Select aaa elements which have attribute name with value foo, leading and
trailing spaces are removed before comparison */
// print_r($foo->xpath('//aaa[normalize-space(@name)="foo"]'));

/* Select elements which have two children bar */
// print_r($foo->xpath('//*[count(bar)=2]'));

/* Select elements which have 2 children */
// print_r($foo->xpath('//*[count(*)=2]'));

/* Select elements with three-letter name */
// print_r($foo->xpath('//*[string-length(name())=3]'));

/* Select all elements bar and eee */
// print_r($foo->xpath('//bar | //eee'));

/* Equivalent of /child::AAA */
// print_r($foo->xpath('//child::aaa/bbb'));

/* Select all elements given in this absolute path */
// print_r($foo->xpath('aaa/bbb/ancestor::*'));

/* Select ancestors of eee element */
// print_r($foo->xpath('//ddd/ancestor::*'));

/* The following-sibling axis contains all the following siblings of the context node. */
// print_r($foo->xpath('/foobar/foo/following-sibling::*'));

/* The preceding-sibling axis contains all the preceding siblings of the context node */
// print_r($foo->xpath('/foobar/aaa/preceding-sibling::*'));

/* The descendant axis contains the descendants of the context node;
a descendant is a child or a child of a child and so on; thus the
descendant axis never contains attribute or namespace nodes */
// print_r($foo->xpath('aaa/bbb/descendant::*'));

/* Select elements ddd which have ccc among its ancestors */
// print_r($foo->xpath('//ccc/descendant::ddd'));

/* The following axis contains all nodes in the same document as the context node that
are after the context node in document order, excluding any descendants and excluding
attribute nodes and namespace nodes. */
// print_r($foo->xpath('/foobar/foo/following::*'));

/* The preceding axis contains all nodes in the same document as the context node that
are before the context node in document order, excluding any ancestors and
excluding attribute nodes and namespace nodes */
// print_r($foo->xpath('aaa/bbb/preceding::*'));

/* Select even bar elements */
// print_r($foo->xpath('//bar[position() mod 2 = 0]'));

/* Select middle bar element(s) */
// print_r($foo->xpath('//bar[position() = floor(last() div 2 + 0.5)]'));


Înapoi la “PHP Avansat”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 6 vizitatori