简体   繁体   English

简单的XML问题

[英]Simple XML Question

Alright, using my XML editor to check the validation I'm getting "Validation stopped at line 2, column 8: no declaration found for element 'Staff'. Does anyone know why this is? 好的,使用我的XML编辑器检查验证,我得到“验证已停止在第2行第8列:没有找到元素'Staff'的声明。有人知道为什么吗?

Also, every three staff members are of a different type and each type include different elements (Adjunct staff members only have email, name, position for instance, while FullTime types have information for all of the elements.) Is it bad form to have element data left blank? 另外,每三名工作人员具有不同的类型,每种类型都包含不同的元素(例如,兼职工作人员仅具有电子邮件,姓名,职位,而全职类型具有有关所有元素的信息。)拥有元素是否不好?数据留空? If they're StaffMembers of a different type, is it alright to get rid of the extra elements or does every StaffMember need the same elements all the way through? 如果它们是不同类型的StaffMembers,是否可以消除多余的元素,还是每个StaffMember始终都需要相同的元素? Thanks! 谢谢!

<Staff>

    <StaffMember type="FullTime">
        <Name>Richard Baskerville</Name>
        <Position>Professor</Position>
        <OfficePhone>(404) 413-7362</OfficePhone>
        <Building>Robinson College</Building>
        <Room>919</Room>
        <URL>www.cis.gsu.edu/~rbaskerv</URL>
        <Email>rbaskerville@cis.gsu.edu</Email>
        <DegreeInfo>Ph. D., M.S., B.S.</DegreeInfo>
        <Research> Information systems security, interaction of information systems and organizations, qualitative research methods,      diffusion of IT innovations, knowledge management</Research>
    </StaffMember>

    <StaffMember type ="FullTime">
        <Name>Michael Gallivan</Name>
        <Position>Associate Professor</Position>
        <OfficePhone>(404) 413-7363</OfficePhone>
        <Building>Robinson College</Building>
        <Room>935</Room>
        <URL>www.cis.gsu.edu/~mgalliva</URL>
        <Email>mgalliva@cis.gsu.edu</Email>
        <DegreeInfo>Ph. D., M.B.A., M.P.H., B.A.</DegreeInfo>
        <Research> IT human resource management, management of IT outsourcing, adoption and diffusion of innovations, organizational learning from innovations </Research>
    </StaffMember>

      <StaffMember type ="FullTime">
        <Name>Sidney Harris</Name>
        <Position>Professor</Position>
        <OfficePhone>(404) 413-7017</OfficePhone>
        <Building>Robinson College</Building>
        <Room>427</Room>
        <URL>www2.gsu.edu/~wwwseh/</URL>
        <Email>sidneyharris@gsu.edu</Email>
        <DegreeInfo>Ph. D., M.S., B.S.</DegreeInfo>
        <Research> Strategic management of technology, global practices in technological innovation and management, regional studies on China and Asia culture of high performance organization</Research>
    </StaffMember>

      <StaffMember type ="Adjunct">
        <Name>Arash Akhlaghi</Name>
        <Position>Adjunct Professor</Position>
        <OfficePhone></OfficePhone>
        <Building></Building>
        <Room></Room>
        <URL></URL>
        <Email>aakhlaghi1@student.gsu.edu</Email>
        <DegreeInfo></DegreeInfo>
        <Research></Research>
    </StaffMember>

    <StaffMember type="Adjunct">
        <Name>Catherine Baird</Name>
        <Position>Adjunct Professor</Position>
        <OfficePhone></OfficePhone>
        <Building></Building>
        <Room></Room>
        <URL></URL>
        <Email>cbaird@cis.gsu.edu</Email>
        <DegreeInfo></DegreeInfo>
        <Research></Research>
    </StaffMember>

    <StaffMember type="Adjunct">
        <Name>David Bloomquist</Name>
        <Position>Adjunct Professor</Position>
        <OfficePhone></OfficePhone>
        <Building></Building>
        <Room></Room>
        <URL></URL>
        <Email>dbloomquist@cis.gsu.edu</Email>
        <DegreeInfo></DegreeInfo>
        <Research></Research>
    </StaffMember>

    <StaffMember type="Staff">
        <Name>Desiree Plummer</Name>
        <Position>PC System Specialist</Position>
        <OfficePhone>(404) 413-7440></OfficePhone>
        <Building>Robinson College</Building>
        <Room>908</Room>
        <URL></URL>
        <Email>dplummer@cis.gsu.edu</Email>
        <DegreeInfo></DegreeInfo>
        <Research></Research>
    </StaffMember>

    <StaffMember type="Staff">
        <Name>Walter Rich</Name>
        <Position>Manager, CIS External Affairs</Position>
        <OfficePhone>(404) 413-7398></OfficePhone>
        <Building>Robinson College</Building>
        <Room>929</Room>
        <URL></URL>
        <Email>wrich@cis.gsu.edu</Email>
        <DegreeInfo></DegreeInfo>
        <Research></Research>
    </StaffMember>

    <StaffMember type="Staff">
        <Name>James Sneed</Name>
        <Position>Information Technology Department Manager</Position>
        <OfficePhone>(404) 413-7383></OfficePhone>
        <Building>Robinson College</Building>
        <Room>907</Room>
        <URL></URL>
        <Email>jsneed@cis.gsu.edu</Email>
        <DegreeInfo></DegreeInfo>
        <Research></Research>
    </StaffMember>

  <StaffMember type="Ph.D">
        <Name>Anouck Adrot</Name>
        <Position></Position>
        <OfficePhone>(404) 413-7389></OfficePhone>
        <Building>Robinson College</Building>
        <Room>910</Room>
        <URL></URL>
        <Email>aadrot1@student.gsu.edu</Email>
        <DegreeInfo></DegreeInfo>
        <Research></Research>
    </StaffMember>

    <StaffMember type="Ph.D">
        <Name>Chad Anderson</Name>
        <Position></Position>
        <OfficePhone>(404) 413-7389></OfficePhone>
        <Building>Robinson College</Building>
        <Room>910</Room>
        <URL></URL>
        <Email>canderson32@comcast.net</Email>
        <DegreeInfo></DegreeInfo>
        <Research></Research>
    </StaffMember>

    <StaffMember type="Ph.D">
        <Name>Mathieu Chauvet</Name>
        <Position></Position>
        <OfficePhone>(404) 413-7389></OfficePhone>
        <Building>Robinson College</Building>
        <Room>910</Room>
        <URL></URL>
        <Email>mchauvet1@student.gsu.edu</Email>
        <DegreeInfo></DegreeInfo>
        <Research></Research>
    </StaffMember>

</Staff>

This XML validator doesn't give any error with your xml. 这个XML验证器不会给您的xml提供任何错误。

Anyway, if you use a schema or a DTD to validate, you may have an error (if it doesn't correspond to the specification). 无论如何,如果您使用模式或DTD进行验证,则可能会出现错误(如果它不符合规范)。

For your second point, you can have empty node but the use depends on your needs, on the specification if you use one and the code that will use this xml. 第二点,您可以有一个空节点,但使用情况取决于您的需求,如果使用一个,则取决于规范,以及将使用此xml的代码。 You can delete them if you're not using a schema or a DTD like I suspect or if the code to parse it afterward take care of it. 如果您没有像我怀疑的那样使用架构或DTD,或者以后解析它的代码都照顾到了它们,则可以删除它们。

"Validation stopped at line 2, column 8: no declaration found for element 'Staff'. Does anyone know why this is? “验证在第2行第8列停止:找不到元素'Staff'的声明。有人知道为什么吗?

Because you have not declared a schema (XML Schema, DTD, RNG, etc.) against which to validate. 因为您尚未声明要验证的架构(XML Schema,DTD,RNG等)。 I don't know what XML editor you're using ... Apparently you told it to validate, and it's trying to say that it's unable to validate because there is no schema to validate against. 我不知道您使用的是哪种XML编辑器...显然,您告诉它进行验证,并且它试图说它无法验证,因为没有要验证的架构。 That does not mean your XML is invalid: instead it means that validity has no meaning for your XML (until you associate a schema with it). 并不意味着你的XML是无效的:相反,它意味着有效性已经为XML没有意义的(除非您的模式与之相关联)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM