Application of phpxml regular expression array-php Tutorial

Source: Internet
Author: User
The application of the phpxml regular expression array receives an xml file similar to the following. what should I do if I want to divide the content of the file into the corresponding array for output?
For example:
I'm a fortune teller."I am a fortune teller" should be a field
Yi Zhi Is a field.
***Intermediate content
7507424758 "7507424758" in"
For example (obtain similar data at the end ):

$ Isbn10 = "7507424758 ";
$ Pages = "245 ";

 
 -
   
  
   
Http://api.douban.com/book/subject/10506822
   I'm a fortune teller.   
   -
   
    
Yi Zhi
        
      
      
      
      
   Description of "I am a fortune teller": fortune teller emerged in the pre-Qin dynasty, developed in the Sui and Tang dynasties, and spread in the Ming and Qing Dynasties. Zhang Liang of the Han Dynasty, Zhuge Liang of the Three Kingdoms, and Liu Bowen of the Ming Dynasty, the representative figures of different periods all identify the fate of mankind in their hands, faces, 8 characters, and gossip. Ye zuye, born in 1902, was unknown in the year of the Republic of China. The fortune-teller Group of the great Yangtze River in the Republic of China was the leader of the Jiangxiang school. He and yuan Shushan, Wei Qianli, and Xu Lewu are called "Four fortune tellers of the Republic of China" in the Shanghai newspaper. The so-called "South Yuan Bei Wei Dong Lewu," the three Immortals returned to ask his father ". When Ye was 15 years old, he began to be a fortune teller. every computation was an amazing thing. after more than 30 years, he left countless incredible legends and suspense. even before the Central Plains War, shanxi warlord Yan Xishan is also three Gu Mao Lu, finally obtained a grandfather. Zuye said, "What we look at is a face, which counts eight characters. what we capture is the desire to flash on a person's face: greedy, vanity, jealousy, fear, and arrogance ?? The fate of people is indeed written on the face. Ye never lost his hand in his life. the only thing he did not know was his own destiny. in the face of miserable evening scenes, he thought that he had leaked too many Tianji ...... Open "I am a fortune teller", and let an 82-year-old Fortune Teller show you the ancient wisdom behind fortune teller and the world's troubles. Poster:   
   
    
7507424758
      
   
    
9787507424751
      
   
    
I'm a fortune teller.
      
   
    
245
      
   
    
Yi Zhi
      
   
    
$29.90
      
   
    
China City Publishing House
      
   
    
Flat
      
   
    
2012-2
      
   
    
Yi Zhi, male, Jimo, Shandong. At the age of 8, he came into contact with the Taoist school. at the age of 12, he followed his local stranger, master Xuan, to study the four columns, and the university teacher, Duan Jinglian, a well-known Chinese Xuan scholar. He is currently the executive director of the China Zhouyi Association.
      
      
      
      
      
      
      
      
      
      
  
 


Reply to discussion (solution)

There is a piece of code provided by the old man:
Preg_match_all ('/> (. +)Print_r ($ m [1]);
This code can output the content I want, and I want to map it.

7507424758
9787507424751
I'm a fortune teller.
245
Yi Zhi
$29.90
China City Publishing House
Flat
$ Isbn10 = "7507424758 ";
$ Pages = "245 ";

Another problem is that Data items) isbn10, isbn13, title, pages, etc. some books have and some books do not, so I must be able to retrieve the data corresponding to the parameter.

$ S = <
 
  
7507424758   
  
   
9787507424751
     
  
   
I'm a fortune teller.
     
  
   
245
     
  
   
Yi Zhi
     
  
   
$29.90
     
  
   
China City Publishing House
     
  
   
Flat
  Html; preg_match_all ('/(name = "(. +)")?> (. +)
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.