该属性为必填项,必须指定 [英] Attribute is required and must be specified

查看:133
本文介绍了该属性为必填项,必须指定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我已经修复了所有其他错误,只有一个对我来说没有意义.我不断收到错误消息:

Ok I have fixed all other errors, only one remains that makes no sense to me. I keep getting the error:

在元素类型"viewer_rating"的声明中需要元素类型.

An element type is required in the declaration of element type "viewer_rating".

对我来说这没有意义,因为我以正确的方式声明了它,所有内容仍然一无所获.任何帮助将不胜感激.

It makes no sense to me cause I declared it in the right way and everything and still nothing. Any help would be appreciated.

DTD:

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT movies (movie*)>  
<!ELEMENT movie (title, genre, movie_rating, viewer_rating, summary, year, director+, runtime, studio, actors+)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT genre (#PCDATA|action|comedy|drama|family|foreign|horror|musical|other)*>
<!ELEMENT  movie_rating (#PCDATA|G|PG|PG-13|R|NC-17)*>
<!ELEMENT viewer_rating (#PCDATA|0|1|2|3|4|5)*>
<!ELEMENT summary (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT director (#PCDATA)>
<!ELEMENT runtime (#PCDATA)>
<!ELEMENT studio (#PCDATA)>
<!ELEMENT actors (#PCDATA)>
<!ATTLIST actors id CDATA #REQUIRED>

XML:

<?xml version="1.0" encoding="UTF-8"?>
<!-- New document created with EditiX at Sun Jul 13 10:41:29 AST 2014 -->


<!DOCTYPE movies SYSTEM "Movies2DTD.dtd">



<movies>
<movie>   
<title>Transcendence</title>  
<genre>Action</genre>  
<movie_rating>PG-13</movie_rating>  
<viewer_rating>4</viewer_rating>  
<summary>In Transcendence, Dr. Will Carter is an expert in Artificial Intelligence, and initially is excited by the promises it offers the world at large. Unfortunately, when he is diagnosed with a terminal disease, his motives change and he becomes focused on his own transcendence. Now he is racing against his own mortality as extremists attempt to stop him. Max Waters is his best friend and a researcher as well, and is torn between helping his friend and what that will mean for society at large.</summary>  
<year>2014</year>  
<director>Wall Pfistery</director>  
<runtime>119</runtime>  
<studio>Warner Bros.</studio>
<actors id="1000">Johnny Depp</actors>
<actors id="1001">Paul Bettany</actors>
<actors id="1002">Rebecca Hall</actors>  
</movie>

<movie>   
<title>Edge of Tomorrow</title>  
<genre>Action</genre>  
<movie_rating>PG-13</movie_rating>  
<viewer_rating>4</viewer_rating>  
<summary>Lieutenant Colonel Bill Cage is a skilled tactician who has honed his abilities through his experiences as a soldier. However, there is still much he can learn, and soon he is going to get his chance. It's the last day of a major battle on a futuristic Earth that is overrun with aliens. This battle may determine the fate of humanity. Bill is determined to fight it out to the end, but just what is that end? He is startled to discover that this day will not end for him. He is caught in a time loop. He wants to get out, but in the meantime, he is becoming a soldier of unsurpassed skill. What will it take to break free and win the battle?</summary>  
<year>2014</year>  
<director>Doug Liman</director>  
<runtime>113</runtime>  
<studio>Warner Bros.</studio>
<actors id="1003">Emily Blunt</actors>
<actors id="1004">Tom Cruise</actors>
<actors id="1005">Charlotte Riley</actors> 
</movie>

<movie>   
<title>22 Jump Street</title>  
<genre>Action</genre>  
<movie_rating>R</movie_rating>  
<viewer_rating>4</viewer_rating>  
<summary>Schmidt and Jenko Mike barely made it through high school the first time. Thanks to police program called 21 Jump Street, they went back a second time. The officers went undercover as high school students and made the school safe by taking down a huge drug operation. Since the program was so successful, more funding was made available and the operation moved across the street to 22 Jump Street. Schmidt and Jenko have been assigned to go to college. The guys get their own dorm, play college sports (well, kind of), and they get to party (they are college students, right?) all while investigating illegal drug activity.</summary>  
<year>2014</year>  
<director>Phil Lord, Chris Miller</director>  
<runtime>112</runtime>  
<studio>Columbia Pictures</studio>
<actors id="1006">Jonah Hill</actors>
<actors id="1007">Channing Tatum</actors>
<actors id="1008">Ice Cube</actors>  
</movie>

<movie>   
<title>The Matrix</title>  
<genre>Action</genre>  
<movie_rating>R</movie_rating>  
<viewer_rating>5</viewer_rating>  
<summary>A programmer by day and a computer hacker by night, Thomas A. Anderson lives two distinct lives. His night persona, Neo, has always harbored questions about the true nature of reality. Neo finds out that his suspicions were correct when he is suddenly targeted by the police after Morpheus, a legendary hacker, makes contact. Morpheus shows Neo the real world, a wasteland where humanity is captive to machines that live off of human electrochemical energy and body heat. Thomas Anderson's world, our world, is just an artificial reality known as the Matrix used to imprison the minds of captive humans. Neo joins the rebels in in their fight to defeat the machines. Within the Matrix, Neo must battle agents, powerful computer programs dedicated to eliminating the rebels.</summary>  
<year>1999</year>  
<director>Andy Wachowski, Lana Wachowski</director>  
<runtime>136</runtime>  
<studio>Warner Bros.</studio>
<actors id="1009">Keanu Reeves</actors>
<actors id="1010">Laurence Fishburne</actors>
<actors id="1011">Carrie-Anne Moss</actors> 
</movie>

<movie>   
<title>Star Trek Into Darkness</title>  
<genre>Science Fiction</genre>  
<movie_rating>PG-13</movie_rating>  
<viewer_rating>4</viewer_rating>
<summary>The Enterprise crew is asked to return home to take part in a battle. When they return home, they soon discover an evil force among their group has destroyed their fleet and its symbolism. Captain Kirk has his own personal agenda to take care of, and he heads a search to catch the villain who was responsible for such devastation. They enter into a war to try to uncover the villain who caused this extreme damage. Lives will be forever changed, and something must be given up for Kirk's crew, otherwise known as his family.</summary>  
<year>2013</year>  
<director>J.J. Abrams</director>  
<runtime>136</runtime>  
<studio>Paramount Pictures</studio>
<actors id="1012">Chris Pine</actors>
<actors id="1013">Zachary Quinto</actors>
<actors id="1014">Zoe Saldana</actors> 
</movie>

<movie>   
<title>Resident Evil</title>  
<genre>Action</genre>  
<movie_rating>R</movie_rating>  
<viewer_rating>3</viewer_rating>
<summary>In Umbrella Corporation's underground genetics experimentation and bioweapon research facility known as The Hive, a thief steals virus samples and purposely drops one during his escape. The Hive's administrator, an AI called the Red Queen, seals off the complex and kills everyone in an attempt to stop the virus's spread. She doesn't report the reason for her actions to the company. Believing that she has become homicidal, Umbrella dispatches a security force to determine what happened and shut her down. In the above-ground mansion that hides an emergency entrance, they find one of their own suffering from amnesia: Alice. Alice's mind contains many secrets. Yet, before she can remember, the team discovers one on their own: The Red Queen didn't permanently kill anyone.</summary>  
<year>2002</year>  
<director>Paul W.S. Anderson</director>  
<runtime>100</runtime>  
<studio>Constantin Film</studio>
<actors id="1015">Milla Jovovich</actors>
<actors id="1016">Michelle Rodriguez</actors>
<actors id="1017">Eric Mabius</actors> 
</movie>

<movie>   
<title>Divergent</title>  
<genre>Action</genre>  
<movie_rating>PG-13</movie_rating>  
<viewer_rating>4</viewer_rating>
<summary>Generations after a catastrophic event destroys the city of Chicago, the survivors have divided themselves into different factions based on personality type to prevent future discord. Beatrice Prior finds herself torn when the day comes for her to choose a faction of her own. Her family expects her to select the selfless Abnegation group that focuses on service to others, but she secretly yearns for the adventure that other factions could bring her. Meanwhile, a sinister plot brews among faction leaders that could destroy the city's status quo forever.</summary>  
<year>2014</year>  
<director>Neil Burger</director>  
<runtime>143</runtime>  
<studio>Red Wagon Entertainment</studio>
<actors id="1018">Shailene Woodley</actors>
<actors id="1019">Kate Winslet</actors>
<actors id="1020">Miles Teller</actors> 
</movie>

<movie>   
<title>X-Men: Days of Future Past</title>  
<genre>Action</genre>  
<movie_rating>PG-13</movie_rating>  
<viewer_rating>5</viewer_rating>  
<summary>Forming an alliance, Professor Xavier and Magneto send Wolverine back in time in an attempt to change circumstances which would lead to the demise of the mutant race and, possibly, the human race as we'll. The current Wolverine works with his younger self and younger versions of the X-men to change the past and protect the present status. Traveling between the time periods explores the past histories of some of our favorite X-men characters and what forces turned the into the people they are today.</summary>  
<year>2014</year>  
<director>Bryan Singer</director>  
<runtime>131</runtime>  
<studio>20th Century Fox</studio>
<actors id="1021">Patrick Stewart</actors>
<actors id="1022">James McAvoy</actors>
<actors id="1023">Michael Fassbender</actors> 
</movie>

<movie>   
<title>Transformers Age Of Extinction</title>  
<genre>Action</genre>  
<movie_rating>PG-13</movie_rating>  
<viewer_rating>3</viewer_rating>  
<summary>Set three years after the previous installment, the focus revolves around Cade Yeager and his daughter, Tessa. Together, the duo make a powerful discovery that brings them into the world of the Autobots and the Decepticons. Harold Attinger, a paranoid public servant, is also after them, but his motives are unclear. The humans must find a way to resolve the conflict with the machines. Cade, a mechanic by trade, assists the Autobots by performing crucial repairs. Together, they go against the Decepticons in a battle of explosions and twisted metal.</summary>  
<year>2014</year>  
<director>Michael Bay</director>  
<runtime>165</runtime>  
<studio>Paramount Pictures</studio>
<actors id="1024">Nicola Peltz</actors>
<actors id="1025">Mark Wahlberg</actors>
<actors id="1026">ZStanley Tucci</actors> 
</movie>

<movie>   
<title>Need for Speed</title>  
<genre>Action</genre>  
<movie_rating>PG-13</movie_rating>  
<viewer_rating>4</viewer_rating>  
<summary>Need for Speed is the epic saga of Tobey Marshall, a working-class mechanic and highly skilled muscle car enthusiast, on his race for revenge. In a last-ditch effort to redeem his failing garage, Tobey pairs with pompous Dino Brewster, a highly successful NASCAR driver. After an unsanctioned race goes awry, Dino frames Tobey for manslaughter. Fresh out of prison two years later, Tobey is keen to avenge himself by defeating Dino in the De Leon – underground racing's biggest race. Avoiding cops and bounty hunters along his entire journey and backed by his loyal crew, Tobey races across the country defying odds and proving to the supercar world that there's still hope for the underdog.</summary>  
<year>2014</year>  
<director>Scott Waugh</director>  
<runtime>102</runtime>  
<studio>Touchstone Pictures</studio>
<actors id="1027">Aaron Paul</actors>
<actors id="1028">Dominic Cooper</actors>
<actors id="1029">Imogen Poots</actors> 
</movie>
</movies>

推荐答案

您的DTD有点令人困惑.您具有为movie定义的相同名称的属性和元素.例如,genre.

Your DTD is a little confusing. You have attributes and elements with the same name defined for movie. For example, genre.

如果是我,我将保留属性并删除元素.这样,您仍然可以使用枚举来控制值.

If it were me, I would leave the attributes and remove the elements. That way you still have the enumeration to control the values.

如果不一定总是需要该属性,请将您的声明从#REQUIRED更改为#IMPLIED.

If the attribute isn't always required, change your declaration from #REQUIRED to #IMPLIED.

这篇关于该属性为必填项,必须指定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆