从PHP_Parser获取此XML,但在验证时它已损坏,出现错误: cvc-elt.1.a:找不到元素'AST'的声明。 我应该追加什么?
<?xml version="1.0" encoding="UTF-8"?>
<AST xmlns:node = "http://nikic.github.com/PHPParser/XML/node"
xmlns:subNode = "http://nikic.github.com/PHPParser/XML/subNode"
xmlns:attribute = "http://nikic.github.com/PHPParser/XML/attribute"
xmlns:scalar = "http://nikic.github.com/PHPParser/XML/scalar">
<scalar:array>
<node:Expr_Assign>
<attribute:startLine>
<scalar:int>3</scalar:int>
</attribute:startLine>
<attribute:endLine>
<scalar:int>3</scalar:int>
</attribute:endLine>
<subNode:var>
<node:Expr_Variable>
<attribute:startLine>
<scalar:int>3</scalar:int>
</attribute:startLine>
<attribute:endLine>
<scalar:int>3</scalar:int>
</attribute:endLine>
<subNode:name>
<scalar:string>user</scalar:string>
</subNode:name>
</node:Expr_Variable>
</subNode:var>
<subNode:expr>
<node:Scalar_LNumber>
<attribute:startLine>
<scalar:int>3</scalar:int>
</attribute:startLine>
<attribute:endLine>
<scalar:int>3</scalar:int>
</attribute:endLine>
<subNode:value>
<scalar:int>777</scalar:int>
</subNode:value>
</node:Scalar_LNumber>
</subNode:expr>
</node:Expr_Assign>
</scalar:array>
</AST>
答案 0 :(得分:0)
您的问题是没有为元素AST定义(默认)命名空间。
我会调整元素AST,以便为它定义命名空间,在PHP_Parser的输出中,元素以命名空间为前缀。