错误:“根元素前面的文档中的标记必须格式正确”

时间:2016-06-08 17:52:34

标签: xml validation rdf-xml

我在创建RDF / XML时遇到错误:

  

根元素之前的文档中的标记必须是格式良好的

有人可以帮我解决这个错误吗?

struct num* deleteCell(struct num* point, int numdelete)
{
    struct num* tempdelete = point;
    if (point == NULL)  // found the tail and dont found any match to delete
    {
        printf("not found\n");
        return NULL;
    }
    else if (point->number == numdelete)// found one to delete
    { 
        tempdelete = point->pNext;
        free(point);
    }
    else// Just keep going 
    { 
        point->pNext = deleteCell(point->pNext, numdelete);
    }
    return tempdelete;
}

1 个答案:

答案 0 :(得分:0)

有许多语法错误导致XML格式不正确。

以下是您现在格式正确的文档的清理副本:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:g="http://schema.org/gen">
  <rdf:Description rdf:about="http://thisisjohnsmith.org">
    <dc:Title> Personal Webpage </dc:Title>
    <dc:Creator> John Smith </dc:Creator>
  </rdf:Description>
  <rdf:Person rdf:ID="john">
    <g:name>John Smith</g:name> 
    <g:age>40</g:age>
  </rdf:Person> 
  <rdf:Person rdf:ID="peter">
    <g:name>Peter</g:name>
  </rdf:Person> 
  <rdf:Lecturer rdf:ID="john">
    <g:name>John Smith</g:name> 
  </rdf:Lecturer> 
  <rdf:Lecture rdf:ID="john">
    <g:name>John Smith</g:name> 
    <g:status>crowded</g:status> 
    <g:student>
      <g:name> Peter</g:name>
    </g:student>
  </rdf:Lecture>
</rdf:RDF>