【问题标题】:Error in XML file: cvc-elt.1.a Cannot find the declaration of element?XML 文件中的错误:cvc-elt.1.a 找不到元素的声明?
【发布时间】:2013-05-08 13:17:41
【问题描述】:

从 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>

【问题讨论】:

    标签: xml xml-parsing xsd xml-validation


    【解决方案1】:

    您的问题是没有为元素 AST 定义(默认)命名空间。

    我会调整元素 AST,以便为其定义命名空间,并且在 PHP_Parser 的输出中,该元素以命名空间为前缀。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多