Firstly, I'd like to have a confirm of that, (XML attributes that are ID must start with a letter). Because I tried to put a date (dd/mm/yyyy) as a ID, but it gives me an error if I don't add a letter at the start. After, is there a way to identify the "date" in the DTD better than "CDATA"?
XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE TVchannel SYSTEM "TVchannel.dtd">
<TVchannel>
<dailyProgrammation date="28/11/2003">
<programs>
...
</programs>
</dailyProgrammation>
</TVchannel>
DTD:
<!ELEMENT TVchannel(dailyProgrammation)>
<!ELEMENT dailyProgrammation(programs?)>
<!ATTLIST dailyProgrammation data CDATA #REQUIRED>
...
CodePudding user response:
Yes, ID values in XML follow the same rules as element and attribute names, so they have to start with a letter (and can't contain characters such as "/"). The rule makes little sense in a pure XML context, but it was inherited from SGML, where it allowed IDs to be written in contexts other than as attribute values.
CodePudding user response:
(Partial answer)
I found useful answers here that explained me many things, however by trying NCName
in VS Code it doesn't recognize it and in the .xml it says: 'there is [1] error in the .dtd'.
<!ATTLIST dailyProgrammation data ID NCName #REQUIRED>