【发布时间】:2018-06-06 05:46:58
【问题描述】:
我正在解析一个 XML 文件,谁能帮我解析最后一个也是最里面的子节点。
<section index="2.2.4" title="Recommendation" ref="RECOMMENDATION">
<text>DWS strongly recommends that all authentication credentials should be configured with a strong password.</text>
<text>DWS recommends that:</text>
<list type="bullet">
<listitem>passwords should be at least eight characters in length;</listitem>
<listitem>characters in the password should not be repeated more than five times;</listitem>
<listitem>passwords should include both upper case and lower case characters;</listitem>
<listitem>passwords should include numbers;</listitem>
<listitem>passwords should include punctuation characters;</listitem>
<listitem>passwords should not include the username;</listitem>
<listitem>passwords should not include a device's name, make or model;</listitem>
<listitem>passwords should not be based on dictionary words.</listitem>
</list>
<text>Notes for Cisco Catalyst Switch devices:</text>
<text>The following commands can be used on Cisco Catalyst Switch devices to set the enable password, create a local user with a password and to delete a local user:<code><command>enable secret <cmduser>password</cmduser></command>
<command>username <cmduser>user</cmduser> secret <cmduser>password</cmduser></command>
<command>no username <cmduser>user</cmduser></command>
</code></text>
</section>
谁能帮助解析 PHP 中的这个最里面的子节点?
<code><command>enable secret <cmduser>password</cmduser></command>
<command>username <cmduser>user</cmduser> secret <cmduser>password</cmduser></command>
<command>no username <cmduser>user</cmduser></command>
</code></text>
</section>
尤其是这个命令cmd用户命令???
【问题讨论】:
-
到目前为止你尝试过什么?您发现哪些数据难以处理?
-
存在为此目的的库。如果您真的想自己做,请使用递归
-
我需要解析
<command>enable secret <cmduser>password</cmduser></command><command>username <cmduser>user</cmduser> secret <cmduser>password </cmduser></command><command>no username <cmduser>user</cmduser></command>特别是我需要输出,但我无法解析它,我获取数据直到 Cisco Catalyst Switch 设备上可以使用以下命令来设置启用密码、使用密码创建本地用户并删除本地用户:之后它不会出现???可以请提供任何代码 -
我厌倦了递归方法,但我想从这个
中解析出数据,如果可能,请提供一个 sudo 代码 ??<cmduser><command></command></cmduser>