XML Val Error 问题来源 如何进行
XML Val Error Source of issue How to proceed
我正在参加一项评估工作,试图学习 XML 但是当我验证它时,我得到了这个
19: 30 Element type "Name" must not be declared more than once.
20: 33 Element type "Company" must not be declared more than once.
21: 38 Element type "Date_Created" must not be declared more than once.
22: 33 Element type "Programmers" must not be declared more than once.
23: 29 Element type "P1" must not be declared more than once.
24: 29 Element type "P2" must not be declared more than once.
26: 37 Element type "Last_Update" must not be declared more than once.
27: 30 Element type "Link" must not be declared more than once.
29: 30 Element type "Name" must not be declared more than once.
30: 33 Element type "Company" must not be declared more than once.
31: 38 Element type "Date_Created" must not be declared more than once.
32: 37 Element type "Programmers" must not be declared more than once.
33: 29 Element type "P1" must not be declared more than once.
34: 37 Element type "Last_Update" must not be declared more than once.
35: 37 Element type "Link" must not be declared more than once.
64: 19 The content of element type "Programmers" must match "(P1+,P2+)".
67: 26 The content of element type "Accove_Address_Book" must match "null".
74: 19 The content of element type "Programmers" is incomplete, it must match "(P1+,P2+)".
79: 12 The content of element type "Link" must match "null".
80: 21 The content of element type "Accove_Notepad" must match "null".
这是我的文件
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Widgets [
<!ENTITY comp 'Accove Pty Ltd'>
<!ELEMENT Widgets (Catagory)>
<!ELEMENT Catagory (Tool,Storage)>
<!ELEMENT Tool (ACCOVE)>
<!ELEMENT ACCOVE (Name+,Company+,Date_Created+,Programmers+,Last_Update+,Link+)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Company (#PCDATA)>
<!ELEMENT Date_Created (#PCDATA)>
<!ELEMENT Programmers (P1+,P2+)>
<!ELEMENT P1 (#PCDATA)>
<!ELEMENT P2 (#PCDATA)>
<!ELEMENT Last_Update (#PCDATA)>
<!ELEMENT Link (#PCDATA)>
<!ELEMENT Storage (Accove_Address_Book,Accove_Notepad)>
<!ELEMENT Accove_Address_Book (#PCDATA)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Company (#PCDATA)>
<!ELEMENT Date_Created (#PCDATA)>
<!ELEMENT Programmers (P3*)>
<!ELEMENT P1 (#PCDATA)>
<!ELEMENT P2 (#PCDATA)>
<!ELEMENT P3 (#PCDATA)>
<!ELEMENT Last_Update (#PCDATA)>
<!ELEMENT Link (#PCDATA)>
<!ELEMENT Accove_Notepad (#PCDATA)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Company (#PCDATA)>
<!ELEMENT Date_Created (#PCDATA)>
<!ELEMENT Programmers (#PCDATA)>
<!ELEMENT P1 (#PCDATA)>
<!ELEMENT Last_Update (#PCDATA)>
<!ELEMENT Link (First*,Second*)>
<!ELEMENT First (#PCDATA)>
<!ELEMENT Second (#PCDATA)>
]>
<Widgets>
<Catagory>
<Tool>
<ACCOVE>
<Name>ACCOVE</Name>
<Company>∁</Company>
<Date_Created>01/07/2011</Date_Created>
<Programmers>
<P1>Lauren Mullican</P1>
<P2>Anthony Ellman</P2>
</Programmers>
<Last_Update>06/12/2015</Last_Update>
<Link>image/weath1.jpg</Link>
</ACCOVE>
</Tool>
<Storage>
<Accove_Address_Book>
<Name>Accove Address Book</Name>
<Company>∁</Company>
<Date_Created>23/04/2013</Date_Created>
<Programmers>
<P1>Charlie Darlington,</P1>
<P2>Nadine Pellegrin</P2>
<P3>Tobias Paniagua</P3>
</Programmers>
<Last_Update>25/04/2013</Last_Update>
<Link>N/A</Link>
</Accove_Address_Book>
<Accove_Notepad>
<Name>Accove Notepad</Name>
<Company>∁</Company>
<Date_Created>05/05/2016</Date_Created>
<Programmers>
<P1>Anthony Ellman</P1>
</Programmers>
<Last_Update>05/05/2016</Last_Update>
<Link>
<First>image/note1.jog</First>
<Second>image/note2.jpg</Second>
</Link>
</Accove_Notepad>
</Storage>
</Catagory>
</Widgets>
我不确定如何正确执行 DTD。?
我是否像在 XML. 中那样在 DTD 中嵌套元素?
我如何摆脱 Null?
任何帮助都将是 amzing PLS 或阅读概述我的问题的链接。
DO i nest the elements in the DTD the same as i do in the XML.
没有。您不需要 nest/indent 并且绝对不应该多次声明一个元素。
How do i get rid of the Null?
您未声明的元素获得 "Null"。
这是一个 XML 实例,它的内部子集 (DTD) 已修改为与 XML 一起工作而无需任何更改。不确定这是否是您需要的,但它至少应该为您提供一个更好的起点。
<!DOCTYPE Widgets [
<!ENTITY comp 'Accove Pty Ltd'>
<!ELEMENT Widgets (Catagory)>
<!ELEMENT Catagory (Tool,Storage)>
<!ELEMENT Tool (ACCOVE)>
<!ELEMENT ACCOVE (Name+,Company+,Date_Created+,Programmers+,Last_Update+,Link+)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Company (#PCDATA)>
<!ELEMENT Date_Created (#PCDATA)>
<!ELEMENT Programmers (P1+,P2*,P3*)>
<!ELEMENT P1 (#PCDATA)>
<!ELEMENT P2 (#PCDATA)>
<!ELEMENT P3 (#PCDATA)>
<!ELEMENT Last_Update (#PCDATA)>
<!ELEMENT Link (#PCDATA|First|Second)*>
<!ELEMENT Storage (Accove_Address_Book,Accove_Notepad)>
<!ELEMENT Accove_Address_Book (Name+,Company+,Date_Created+,Programmers+,Last_Update+,Link+)>
<!ELEMENT Accove_Notepad (Name+,Company+,Date_Created+,Programmers+,Last_Update+,Link+)>
<!ELEMENT First (#PCDATA)>
<!ELEMENT Second (#PCDATA)>
]>
<Widgets>
<Catagory>
<Tool>
<ACCOVE>
<Name>ACCOVE</Name>
<Company>∁</Company>
<Date_Created>01/07/2011</Date_Created>
<Programmers>
<P1>Lauren Mullican</P1>
<P2>Anthony Ellman</P2>
</Programmers>
<Last_Update>06/12/2015</Last_Update>
<Link>image/weath1.jpg</Link>
</ACCOVE>
</Tool>
<Storage>
<Accove_Address_Book>
<Name>Accove Address Book</Name>
<Company>∁</Company>
<Date_Created>23/04/2013</Date_Created>
<Programmers>
<P1>Charlie Darlington,</P1>
<P2>Nadine Pellegrin</P2>
<P3>Tobias Paniagua</P3>
</Programmers>
<Last_Update>25/04/2013</Last_Update>
<Link>N/A</Link>
</Accove_Address_Book>
<Accove_Notepad>
<Name>Accove Notepad</Name>
<Company>∁</Company>
<Date_Created>05/05/2016</Date_Created>
<Programmers>
<P1>Anthony Ellman</P1>
</Programmers>
<Last_Update>05/05/2016</Last_Update>
<Link>
<First>image/note1.jog</First>
<Second>image/note2.jpg</Second>
</Link>
</Accove_Notepad>
</Storage>
</Catagory>
</Widgets>
我正在参加一项评估工作,试图学习 XML 但是当我验证它时,我得到了这个
19: 30 Element type "Name" must not be declared more than once.
20: 33 Element type "Company" must not be declared more than once.
21: 38 Element type "Date_Created" must not be declared more than once.
22: 33 Element type "Programmers" must not be declared more than once.
23: 29 Element type "P1" must not be declared more than once.
24: 29 Element type "P2" must not be declared more than once.
26: 37 Element type "Last_Update" must not be declared more than once.
27: 30 Element type "Link" must not be declared more than once.
29: 30 Element type "Name" must not be declared more than once.
30: 33 Element type "Company" must not be declared more than once.
31: 38 Element type "Date_Created" must not be declared more than once.
32: 37 Element type "Programmers" must not be declared more than once.
33: 29 Element type "P1" must not be declared more than once.
34: 37 Element type "Last_Update" must not be declared more than once.
35: 37 Element type "Link" must not be declared more than once.
64: 19 The content of element type "Programmers" must match "(P1+,P2+)".
67: 26 The content of element type "Accove_Address_Book" must match "null".
74: 19 The content of element type "Programmers" is incomplete, it must match "(P1+,P2+)".
79: 12 The content of element type "Link" must match "null".
80: 21 The content of element type "Accove_Notepad" must match "null".
这是我的文件
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Widgets [
<!ENTITY comp 'Accove Pty Ltd'>
<!ELEMENT Widgets (Catagory)>
<!ELEMENT Catagory (Tool,Storage)>
<!ELEMENT Tool (ACCOVE)>
<!ELEMENT ACCOVE (Name+,Company+,Date_Created+,Programmers+,Last_Update+,Link+)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Company (#PCDATA)>
<!ELEMENT Date_Created (#PCDATA)>
<!ELEMENT Programmers (P1+,P2+)>
<!ELEMENT P1 (#PCDATA)>
<!ELEMENT P2 (#PCDATA)>
<!ELEMENT Last_Update (#PCDATA)>
<!ELEMENT Link (#PCDATA)>
<!ELEMENT Storage (Accove_Address_Book,Accove_Notepad)>
<!ELEMENT Accove_Address_Book (#PCDATA)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Company (#PCDATA)>
<!ELEMENT Date_Created (#PCDATA)>
<!ELEMENT Programmers (P3*)>
<!ELEMENT P1 (#PCDATA)>
<!ELEMENT P2 (#PCDATA)>
<!ELEMENT P3 (#PCDATA)>
<!ELEMENT Last_Update (#PCDATA)>
<!ELEMENT Link (#PCDATA)>
<!ELEMENT Accove_Notepad (#PCDATA)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Company (#PCDATA)>
<!ELEMENT Date_Created (#PCDATA)>
<!ELEMENT Programmers (#PCDATA)>
<!ELEMENT P1 (#PCDATA)>
<!ELEMENT Last_Update (#PCDATA)>
<!ELEMENT Link (First*,Second*)>
<!ELEMENT First (#PCDATA)>
<!ELEMENT Second (#PCDATA)>
]>
<Widgets>
<Catagory>
<Tool>
<ACCOVE>
<Name>ACCOVE</Name>
<Company>∁</Company>
<Date_Created>01/07/2011</Date_Created>
<Programmers>
<P1>Lauren Mullican</P1>
<P2>Anthony Ellman</P2>
</Programmers>
<Last_Update>06/12/2015</Last_Update>
<Link>image/weath1.jpg</Link>
</ACCOVE>
</Tool>
<Storage>
<Accove_Address_Book>
<Name>Accove Address Book</Name>
<Company>∁</Company>
<Date_Created>23/04/2013</Date_Created>
<Programmers>
<P1>Charlie Darlington,</P1>
<P2>Nadine Pellegrin</P2>
<P3>Tobias Paniagua</P3>
</Programmers>
<Last_Update>25/04/2013</Last_Update>
<Link>N/A</Link>
</Accove_Address_Book>
<Accove_Notepad>
<Name>Accove Notepad</Name>
<Company>∁</Company>
<Date_Created>05/05/2016</Date_Created>
<Programmers>
<P1>Anthony Ellman</P1>
</Programmers>
<Last_Update>05/05/2016</Last_Update>
<Link>
<First>image/note1.jog</First>
<Second>image/note2.jpg</Second>
</Link>
</Accove_Notepad>
</Storage>
</Catagory>
</Widgets>
我不确定如何正确执行 DTD。? 我是否像在 XML. 中那样在 DTD 中嵌套元素? 我如何摆脱 Null?
任何帮助都将是 amzing PLS 或阅读概述我的问题的链接。
DO i nest the elements in the DTD the same as i do in the XML.
没有。您不需要 nest/indent 并且绝对不应该多次声明一个元素。
How do i get rid of the Null?
您未声明的元素获得 "Null"。
这是一个 XML 实例,它的内部子集 (DTD) 已修改为与 XML 一起工作而无需任何更改。不确定这是否是您需要的,但它至少应该为您提供一个更好的起点。
<!DOCTYPE Widgets [
<!ENTITY comp 'Accove Pty Ltd'>
<!ELEMENT Widgets (Catagory)>
<!ELEMENT Catagory (Tool,Storage)>
<!ELEMENT Tool (ACCOVE)>
<!ELEMENT ACCOVE (Name+,Company+,Date_Created+,Programmers+,Last_Update+,Link+)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Company (#PCDATA)>
<!ELEMENT Date_Created (#PCDATA)>
<!ELEMENT Programmers (P1+,P2*,P3*)>
<!ELEMENT P1 (#PCDATA)>
<!ELEMENT P2 (#PCDATA)>
<!ELEMENT P3 (#PCDATA)>
<!ELEMENT Last_Update (#PCDATA)>
<!ELEMENT Link (#PCDATA|First|Second)*>
<!ELEMENT Storage (Accove_Address_Book,Accove_Notepad)>
<!ELEMENT Accove_Address_Book (Name+,Company+,Date_Created+,Programmers+,Last_Update+,Link+)>
<!ELEMENT Accove_Notepad (Name+,Company+,Date_Created+,Programmers+,Last_Update+,Link+)>
<!ELEMENT First (#PCDATA)>
<!ELEMENT Second (#PCDATA)>
]>
<Widgets>
<Catagory>
<Tool>
<ACCOVE>
<Name>ACCOVE</Name>
<Company>∁</Company>
<Date_Created>01/07/2011</Date_Created>
<Programmers>
<P1>Lauren Mullican</P1>
<P2>Anthony Ellman</P2>
</Programmers>
<Last_Update>06/12/2015</Last_Update>
<Link>image/weath1.jpg</Link>
</ACCOVE>
</Tool>
<Storage>
<Accove_Address_Book>
<Name>Accove Address Book</Name>
<Company>∁</Company>
<Date_Created>23/04/2013</Date_Created>
<Programmers>
<P1>Charlie Darlington,</P1>
<P2>Nadine Pellegrin</P2>
<P3>Tobias Paniagua</P3>
</Programmers>
<Last_Update>25/04/2013</Last_Update>
<Link>N/A</Link>
</Accove_Address_Book>
<Accove_Notepad>
<Name>Accove Notepad</Name>
<Company>∁</Company>
<Date_Created>05/05/2016</Date_Created>
<Programmers>
<P1>Anthony Ellman</P1>
</Programmers>
<Last_Update>05/05/2016</Last_Update>
<Link>
<First>image/note1.jog</First>
<Second>image/note2.jpg</Second>
</Link>
</Accove_Notepad>
</Storage>
</Catagory>
</Widgets>