How does PHP parse the contents of an XML tag?

Source: Internet
Author: User


Weekly ( %1s )


Want to keep weekly ( %1s )

Thank you


Reply to discussion (solution)

No one? The right way to add points

is the name in front fixed?

Xliff XML Localized Data Interchange format, used in Android text resource files
PHP does not support Android app development, so it does not provide relevant parsing support
You can work it out.

$s =<<< XML
 
  
 
       
  
   
    
   Weekly (
   
    
     
    %1s
   
    )
  
   
 
   XML; $x = simplexml_load_string ($s); Echo strip_tags ($x->string->asxml (), "
 
  
   
  );
 
  
Weekly (
 
  
   
  %1s
 
  )

You can use Simplexml_load_file or simplexml_load_string.
will be interpreted for the array.

There is a keyword part that needs to use CDATA to contain

$xml =<<
 <>
  
  
       
   
    Weekly(<xliff:g id="MONTH"> %1s)
   
   
  
   XML; $data = simplexml_load_string ($xml, ' simplexmlelement ', libxml_nocdata);  echo
  
  
   
   $data
  -&amp;gt;string;echo
  ';
 
  
  • 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.