Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2006
    Messaggi
    99

    errore validazione documento

    Ci stò sbattendo la testa sopra questo documento, ma non capisco perchè mi da l'errore alla linea 19 e 21 della dtd dove richiamo l'entità CH, sapreste aiutarmi??le cose che non funzionano non si lasciano mai da parte...detto del mio Prof. , cordiali saluti a tutti.
    <?xml version="1.0"?>

    <!DOCTYPE database[
    <!ELEMENT database ( book+ )>

    <!ENTITY HD "Harvey Deitel">
    <!ENTITY PD "Paul Deitel">
    <!ENTITY TN "Tem Nieto">

    <!ENTITY %CH "(chapter, description)">

    <!ELEMENT book ( author+, image*, content+, newchapters* )>
    <!ATTLIST book bookID ID #REQUIRED>

    <!ELEMENT author ( #PCDATA )>

    <!ELEMENT image ( #PCDATA )>

    <!ELEMENT content %CH;> <!-errore 1-->

    <!ELEMENT newchapters %CH;>
    <!ATTLIST newchapters added ( true | false ) "false">

    <!ELEMENT chapter ( #PCDATA )>
    <!ATTLIST chapter number CDATA #REQUIRED>

    <!ELEMENT description ( section*, resources*, summary? )>

    <!ELEMENT section ( #PCDATA )>

    <!ELEMENT resources ( #PCDATA )>

    <!ELEMENT summary ( #PCDATA )>]>



    <database>
    <book bookID="libro1">
    <author>&HD;</author>
    <author>&PD;</author>
    <image></image>
    <content>
    <chapter number="1"></chapter>
    <description>
    <summary></summary>
    </description>
    </content>
    <newchapters added="true">
    <chapter number="2"></chapter>
    <description>
    <summary></summary>
    </description>
    </newchapters>
    </book>
    </database>

  2. #2

    Problema risolto

    Ciao nella prima dichiarazione di entity tra % e CH manca uno spazio. Ho provato a validare su http://www.validome.org/ e mi dice che la seguente dtd è corretta! Questa dtd deve poi essere usata come esterna e ti funziona (se la dichiari all'interno dell'xml non ti funziona)!
    Quindi puoi usarla per creare l'xml che vuoi...
    L'errore che commettevi era la mancanza di spazio e la dichiarazione interna piuttosto che esterna. Sotto ti copio la versione corretta per l'xml e per la dtd esterna.
    Ciao.
    Flavio Capaccio

    DTD esterna:
    <!ELEMENT database ( book+ )>

    <!ENTITY HD "Harvey Deitel">
    <!ENTITY PD "Paul Deitel">
    <!ENTITY TN "Tem Nieto">

    <!ENTITY % CH "(chapter, description)">

    <!ELEMENT book ( author+, image*, content+, newchapters* )>
    <!ATTLIST book bookID ID #REQUIRED>

    <!ELEMENT author ( #PCDATA )>

    <!ELEMENT image ( #PCDATA )>

    <!ELEMENT content %CH;>

    <!ELEMENT newchapters %CH;>
    <!ATTLIST newchapters added ( true | false ) "false">

    <!ELEMENT chapter ( #PCDATA )>
    <!ATTLIST chapter number CDATA #REQUIRED>

    <!ELEMENT description ( section*, resources*, summary? )>

    <!ELEMENT section ( #PCDATA )>

    <!ELEMENT resources ( #PCDATA )>

    <!ELEMENT summary ( #PCDATA )>

    XML:
    <!DOCTYPE database SYSTEM "database.dtd">
    <database>
    <book bookID="libro1">
    <author>&HD;</author>
    <author>&PD;</author>
    <image></image>
    <content>
    <chapter number="1"></chapter>
    <description>
    <summary></summary>
    </description>
    </content>
    <newchapters added="true">
    <chapter number="2"></chapter>
    <description>
    <summary></summary>
    </description>
    </newchapters>
    </book>
    </database>
    Flavio Capaccio

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.