1. <tfoot id='X2gHN'></tfoot>

        <bdo id='X2gHN'></bdo><ul id='X2gHN'></ul>

      1. <i id='X2gHN'><tr id='X2gHN'><dt id='X2gHN'><q id='X2gHN'><span id='X2gHN'><b id='X2gHN'><form id='X2gHN'><ins id='X2gHN'></ins><ul id='X2gHN'></ul><sub id='X2gHN'></sub></form><legend id='X2gHN'></legend><bdo id='X2gHN'><pre id='X2gHN'><center id='X2gHN'></center></pre></bdo></b><th id='X2gHN'></th></span></q></dt></tr></i><div id='X2gHN'><tfoot id='X2gHN'></tfoot><dl id='X2gHN'><fieldset id='X2gHN'></fieldset></dl></div>

        <small id='X2gHN'></small><noframes id='X2gHN'>

        <legend id='X2gHN'><style id='X2gHN'><dir id='X2gHN'><q id='X2gHN'></q></dir></style></legend>
      2. Simplexml 使用命名空间获取属性

        Simplexml get attributes with a namespace(Simplexml 使用命名空间获取属性)
        • <bdo id='3zmmZ'></bdo><ul id='3zmmZ'></ul>
          <i id='3zmmZ'><tr id='3zmmZ'><dt id='3zmmZ'><q id='3zmmZ'><span id='3zmmZ'><b id='3zmmZ'><form id='3zmmZ'><ins id='3zmmZ'></ins><ul id='3zmmZ'></ul><sub id='3zmmZ'></sub></form><legend id='3zmmZ'></legend><bdo id='3zmmZ'><pre id='3zmmZ'><center id='3zmmZ'></center></pre></bdo></b><th id='3zmmZ'></th></span></q></dt></tr></i><div id='3zmmZ'><tfoot id='3zmmZ'></tfoot><dl id='3zmmZ'><fieldset id='3zmmZ'></fieldset></dl></div>

          <small id='3zmmZ'></small><noframes id='3zmmZ'>

                <tbody id='3zmmZ'></tbody>

              <legend id='3zmmZ'><style id='3zmmZ'><dir id='3zmmZ'><q id='3zmmZ'></q></dir></style></legend>
            1. <tfoot id='3zmmZ'></tfoot>
                • 本文介绍了Simplexml 使用命名空间获取属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个带有命名空间属性的 XML 文档.XML 看起来像:

                  I have an XML Document which has attributes with a namespace. The XML looks like:

                  <?xml version="1.0" encoding="utf-8"?>
                  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
                  package="com.sunil.tweet"
                  android:versionCode="1"
                  android:versionName="1.0" >
                  
                  <uses-sdk
                      android:minSdkVersion="11"
                      android:targetSdkVersion="16" />
                  
                  <application
                      android:allowBackup="true"
                      android:icon="@drawable/ic_launcher"
                      android:label="@string/app_name"
                      android:theme="@style/AppTheme" >
                      <activity
                          android:name="com.sunil.tweet.MainActivity"
                          android:label="@string/app_name" >
                          <intent-filter>
                              <action android:name="android.intent.action.MAIN" />
                  
                              <category android:name="android.intent.category.LAUNCHER" />
                          </intent-filter>
                      </activity>
                  </application>
                  

                  如何从 activity 标签中提取 android:name 属性?

                  How can I extract the android:name attribute from the activity tag?

                  推荐答案

                  获取属性时需要使用命名空间.android 命名空间定义为:

                  You need to use the namespace when getting the attribute. The android namespace is defined as:

                  http://schemas.android.com/apk/res/android

                  所以你需要将它传递给 attributes() 方法,像这样:

                  So you need to pass that to the attributes() method, like this:

                  $xml = simplexml_load_string($xmlStr);
                  
                  echo (string) $xml->application->activity->attributes('http://schemas.android.com/apk/res/android')->name;
                  

                  输出

                  com.sunil.tweet.MainActivity

                  com.sunil.tweet.MainActivity

                  键盘演示

                  这篇关于Simplexml 使用命名空间获取属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  • <legend id='wT92Q'><style id='wT92Q'><dir id='wT92Q'><q id='wT92Q'></q></dir></style></legend>
                      <i id='wT92Q'><tr id='wT92Q'><dt id='wT92Q'><q id='wT92Q'><span id='wT92Q'><b id='wT92Q'><form id='wT92Q'><ins id='wT92Q'></ins><ul id='wT92Q'></ul><sub id='wT92Q'></sub></form><legend id='wT92Q'></legend><bdo id='wT92Q'><pre id='wT92Q'><center id='wT92Q'></center></pre></bdo></b><th id='wT92Q'></th></span></q></dt></tr></i><div id='wT92Q'><tfoot id='wT92Q'></tfoot><dl id='wT92Q'><fieldset id='wT92Q'></fieldset></dl></div>
                        <tbody id='wT92Q'></tbody>
                      • <tfoot id='wT92Q'></tfoot>

                          <small id='wT92Q'></small><noframes id='wT92Q'>

                            <bdo id='wT92Q'></bdo><ul id='wT92Q'></ul>