我刚刚开始学习XML,但在我正在学习的教材中不断出现这个错误:
The element at this point in your instance has the wrong parent element. Most likely it is next to rather than inside the parent tag.
这就是我的代码的结构方式。
<?xml version="1.0" encoding="UTF-8"?>
<infoAssets>
<companyName></companyName>
<products>
<product/> <title/> <description/><specification/>
</products>
<services>
<service/>
<title/>
<description/>
</services>
</infoAssets>我不明白孩子在父母之外的什么地方。
发布于 2022-04-17 22:12:29
我认为问题在于XML文件的结构,而不是验证。<title>、<description>和<specification> at <products>和<services>不包括在正确的节点上,因为父节点<product>和<service>是空的,因为<product/>和<service/>是空的。
<?xml version="1.0" encoding="UTF-8"?>
<infoAssets>
<companyName></companyName>
</infoAssets>
<products>
<product>
<title/>
<description/>
<specification/>
</product>
</products>
<services>
<service>
<title/>
<description/>
</service>
</services>https://stackoverflow.com/questions/71899702
复制相似问题