• <small id='pxEZo'></small><noframes id='pxEZo'>

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

    <legend id='pxEZo'><style id='pxEZo'><dir id='pxEZo'><q id='pxEZo'></q></dir></style></legend>

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

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

        PHP:DOMDocument - 带有冒号的属性?

        PHP: DOMDocument - attributes with a colon in it?(PHP:DOMDocument - 带有冒号的属性?)
        <i id='OzXpP'><tr id='OzXpP'><dt id='OzXpP'><q id='OzXpP'><span id='OzXpP'><b id='OzXpP'><form id='OzXpP'><ins id='OzXpP'></ins><ul id='OzXpP'></ul><sub id='OzXpP'></sub></form><legend id='OzXpP'></legend><bdo id='OzXpP'><pre id='OzXpP'><center id='OzXpP'></center></pre></bdo></b><th id='OzXpP'></th></span></q></dt></tr></i><div id='OzXpP'><tfoot id='OzXpP'></tfoot><dl id='OzXpP'><fieldset id='OzXpP'></fieldset></dl></div>
        <tfoot id='OzXpP'></tfoot>
        1. <small id='OzXpP'></small><noframes id='OzXpP'>

            • <bdo id='OzXpP'></bdo><ul id='OzXpP'></ul>
                <tbody id='OzXpP'></tbody>

                <legend id='OzXpP'><style id='OzXpP'><dir id='OzXpP'><q id='OzXpP'></q></dir></style></legend>
                  本文介绍了PHP:DOMDocument - 带有冒号的属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 DOMDocument 来解析 XML (SVG).

                  I'm using DOMDocument to parse an XML (SVG).

                  某些节点的属性中带有冒号,例如:

                  Some nodes have attributes with a colon in it, like :

                  <svg 
                     id="svg2"
                     width="1000"
                     height="1000"
                     sodipodi:version="0.32"
                     inkscape:version="0.48.1 "
                     ...
                  >
                  

                  但是当我这样做时:

                  $node= DOMDocument->documentElement;
                  foreach($node->childNodes as $key=>$childnode) {
                    foreach($childnode->attributes as $attribute) {
                      echo $attribute->name."
                  ";
                    }
                  }
                  

                  带有 : 的属性在没有第一部分(命名空间)的情况下打印

                  the attributes with a : are printed without the first part (namespace)

                  在像这样迭代属性时如何获取该属性的命名空间?

                  How do I get the namespace for that attribute when iterating through the attributes like this?

                  推荐答案

                  答案来自 OP 的评论,nodeName 来自 DOMNode.

                  Answer from OP's comment, nodeName from DOMNode.

                  $node= DOMDocument->documentElement;
                  foreach($node->childNodes as $key=>$childnode) {
                    foreach($childnode->attributes as $attribute) {
                      echo $attribute->nodeName."
                  ";
                    }
                  }
                  

                  原答案:

                  DOMNode 中的 prefix 怎么样?

                  $node= DOMDocument->documentElement;
                  foreach($node->childNodes as $key=>$childnode) {
                    foreach($childnode->attributes as $attribute) {
                      echo $attribute->prefix.":".$attribute->name."
                  ";
                    }
                  }
                  

                  这篇关于PHP:DOMDocument - 带有冒号的属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Converting string to MySQL timestamp format in php(在php中将字符串转换为MySQL时间戳格式)
                  datetime to timestamp(日期时间到时间戳)
                  PHP timestamp date to user timezone(PHP时间戳日期到用户时区)
                  Converting TIMESTAMP to unix time in PHP?(在 PHP 中将 TIMESTAMP 转换为 unix 时间?)
                  Convert ISO 8601 to unixtimestamp(将 ISO 8601 转换为 unixtimestamp)
                  Finding days between 2 unix timestamps in php(在php中查找2个unix时间戳之间的天数)

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

                      <legend id='PlPTW'><style id='PlPTW'><dir id='PlPTW'><q id='PlPTW'></q></dir></style></legend>

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

                            <tbody id='PlPTW'></tbody>

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