文档末尾的额外内容 - XML PArsing Error

时间:2014-11-12 14:35:50

标签: xml

我在第一次尝试时写了这一点XML,但不知怎的,它给出了一个错误。我已经阅读了关于该主题的其他帖子,该帖子告诉您有1个根父母;在我的情况下,这将是目录。我还给了属性一个没有空格的名字。任何想法可能是什么问题?

非常感谢任何帮助。

<?xml version="1.0"?>

<Catalog>
  <EnginePart1>
    <petrolType>Diesel</petrolType>                                         
    <GeneralInfo>   
        <CarBrand>ALFA ROMEO</CarBrand> 
        <NoOfCyl>4</NoOfCyl>
        <BoreDia>69.6mm</BoreDia>
        <Capacity>1,248cc</Capacity>
    </GeneralInfo> 
    <Image>
            <file type="PNG">Capture.PNG3.PNG</file>
    </Image>
    <LinerKit>                                          
        <ReferenceNo /> 
    </LinerKit> 
    <PistonRings>                                       
        <Name>PKAR406963DB</Name>
        <ReferenceNumber>
            <Name1>K-40659600</Name1>
            <Name2>N-8742560000</Name2>
        </ReferenceNumber>
    </PistonRings> 
    <PistonSet>                                         
        <Name>PTAR406963DB</Name>
        <ReferenceNo />
            <Description>
                <Name1>alfin and with oil gallery</Name1>
                <Name2>skirt MOS2 treated fits tapered con. rod</Name2>
            </Description>
            <Piston>
                <Length>62.5</Length>
                <Comp>40.5</Comp>
                <Height1>-6</Height1>
                <Height2>-12.3</Height2>
            </Piston>
            <Pin>
                <Diameter>23.0</Diameter>
                <Length>57.0</Length>
            </Pin>
    </PistonSet> 
    <RingsSet>
        <Name>PRAR406961D</Name>
        <ReferenceNo>
            <Name1>A-R66830</Name1>
            <Name2>G-0813760000</Name2>
            <Name3>K-800056240000</Name3>
            <Name4>M-01004N0</Name4>
        </ReferenceNo>
        <Description />
        <Rings>
            <Top>2.0</Top>
            <2nd>1.5</2nd>
            <Oil>2.0</Oil>
        </Rings>
    </RingsSet>
    <CylLiner>
        <Name></Name>
        <ReferenceNo />
        <Description />
        <LinerSleeve>
            <Lenght />
            <OutsideDiameter />
            <FlangeDiameter /> 
            <FlangeDepth />
        </LinerSleeve>
    </CylLiner>
  </EnginePart1>
</Catalog>

1 个答案:

答案 0 :(得分:0)

您遇到的问题是第54行的<2nd>标记。标记名称不能以数字开头。

这是一个用于识别XML问题根源的便捷工具:http://www.w3schools.com/xml/xml_validator.asp

为了将来参考,XML元素必须遵循以下命名规则:

  • 名称可以包含字母,数字和其他字符
  • 名称不能以数字或标点符号开头
  • 名称不能以字母xml(或XML,或Xml等)
  • 开头
  • 名称不能包含空格
相关问题