简体   繁体   中英

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?

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? 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.

Anyway, if you use a schema or a DTD to validate, you may have an error (if it doesn't correspond to the specification).

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. 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.

"Validation stopped at line 2, column 8: no declaration found for element 'Staff'. Does anyone know why this is?

Because you have not declared a schema (XML Schema, DTD, RNG, etc.) against which to validate. 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. 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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