Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [XML][PHP]pobieranie danych z xml
Forum PHP.pl > Forum > Przedszkole
dentopolis
mam plik xml:
http://dentopolis.org/scr/pubfeed/pubmed.xml

pobieram z niego wprowadzenie:
$abstract=$text->MedlineCitation->Article->Abstract->AbstractText;

  1. <Abstract>
  2. <AbstractText Label="INTRODUCTION" NlmCategory="BACKGROUND">Periodontal disease broadly defines group of conditions in which the supportive structure of the tooth (periodontium) is destroyed. Recent studies suggested that the anti-diabetic drug metformin hydrochloride (MF) has an osteogenic effect and is beneficial for the management of periodontitis.</AbstractText>
  3. <AbstractText Label="OBJECTIVE" NlmCategory="OBJECTIVE">Development of strong mucoadhesive multiple layer film loading small dose of MF for intra-pocket application.</AbstractText>
  4. <AbstractText Label="METHODOLOGY" NlmCategory="METHODS">Multiple layer film was developed by double casting followed by compression method. Either 6% carboxy methyl cellulose sodium (CMC) or sodium alginate (ALG) constituted the inner drug (0.6%) loaded layer. Thiolated sodium alginate (TSA; 2 or 4%) constituted the outer drug free layers to enhance mucoadhesion and achieve controlled drug release. Optimized formulation was assessed clinically on 20 subjects.</AbstractText>
  5. <AbstractText Label="RESULTS" NlmCategory="RESULTS">Films were uniform, thin and hard enough for easy insertion into periodontal pockets. Based on water uptake and in vitro drug release, CMC based film with 4% TSA as an outer layer was the optimized formulation with enhanced mucoadhesion and controlled drug release (83.73% over 12h). SEM showed the effective fabrication of the triple layer film in which connective lines between the layers could be observed. FTIR examination suggests possibility of hydrogen bonding between the -NH groups of metformin and -OH groups of CMC. DSC revealed the presence of MF mainly in the amorphous form. Clinical results indicated improvement of all clinical parameters six months post treatment.</AbstractText>
  6. <AbstractText Label="CONCLUSION" NlmCategory="CONCLUSIONS">The results suggested that local application of the mucoadhesive multiple layer films loaded with metformin hydrochloride was able to manage moderate chronic periodontitis.</AbstractText>
  7. </Abstract>


ale w jaki sposób wyświetlić jedynie część AbstractText tzn:
  1. <AbstractText Label="CONCLUSION" NlmCategory="CONCLUSIONS">The results suggested that local application of the mucoadhesive multiple layer films loaded with metformin hydrochloride was able to manage moderate chronic periodontitis.</AbstractText>


źródło skryptu:
http://dentopolis.org/scr/pubfeed/skrypt.txt
ssstrz
  1.  
  2. <?php
  3.  
  4. $xml=simplexml_load_file('pubmed.xml');
  5.  
  6. foreach ($xml as $text) {
  7. foreach ($text->MedlineCitation->Article->Abstract->AbstractText as $abText) {
  8.  
  9. foreach($abText->attributes() as $a => $b) {
  10. if ($a === 'NlmCategory' && $b == 'CONCLUSIONS') {
  11. var_dump($abText);
  12. }
  13. }
  14. }
  15. }
dentopolis
super.dzięki. a jak wypisać tylko CONCLUSIONS? bo to jest array a ja jestem green. chciałbym otrzymać postać echo $conclusions;
ssstrz
ale w sensie jak jest NlmCategory to wtedy ma wypisać tekst? wtedy wystarczy tam gdzie jest var_dump dać
  1. echo $abText;

samo to wypisze CONCLUSIONS:
  1. echo $b;
dentopolis
dzięki.wszystko działa.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.