Witam. W ramach samorozwoju pracuję nad projektem planu lekcji. Wszystko idzie fajnie tylko napotykam problem przy parsowaniu XML do tabeli , a właściwie w ogóle przy parsowaniu
<!DOCTYPE>
<HTML>
<HEAD>
<TITLE>
Odczytywanie wartości atrybutów z dokumentu XML
</TITLE>
<XML ID="meetingsXML" SRC="ascIksemel.xml"></XML>
<SCRIPT LANGUAGE="JavaScript">
function readXMLDocument()
{
var xmldoc, timetableNode, periodsNode, periodNode
var attributes, periodAttribute, starttimeAttribute, endtimeAttribute
var outputText
xmldoc = document.all("meetingsXML").XMLDocument
timetableNode = xmldoc.documentElement
periodsNode = timetableNode.firstChild
periodNode = periodsNode.firstChild
attributes = periodNode.attributes
periodAttribute = attributes.GetNamedItem("period")
starttimeAttribute = attributes.GetNamedItem("starttime")
endtimeAttribute = attributes.GetNamedItem("endtime")
outputText = "Dziala: " + '' +
periodAttribute.value //+
"-" + starttimeAttribute.value +
"-" + endtimeAttribute.value
messageDIV.innerHTML = outputText
}
</SCRIPT>
</HEAD>
<BODY>
<CENTER>
<H1>Odczyt elementow</H1>
<INPUT TYPE="BUTTON" VALUE="wyswietl"
ONCLICK="readXMLDocument()">
<DIV ID="messageDIV"></DIV>
</CENTER>
</BODY>
</HTML>
<?xml version="1.0" encoding="windows-1250"?>
<timetable ascttversion="2016.17.1" importtype="database" options="export:idprefix:%CHRID,import:idprefix:%TEMPID,groupstype1,decimalseparatordot,lessonsincludeclasseswithoutstudents,handlestudentsafterlessons" defaultexport="1" displayname="aSc Timetables 2012 XML" displaycountries="">
<periods options="canadd,export:silent" columns="period,name,short,starttime,endtime">
<period name="0" short="0" period="0" starttime="6:55" endtime="7:40"/>
<period name="1" short="1" period="1" starttime="7:45" endtime="8:30"/>
<period name="2" short="2" period="2" starttime="8:40" endtime="9:25"/>
<period name="3" short="3" period="3" starttime="9:35" endtime="10:20"/>
<period name="4" short="4" period="4" starttime="10:30" endtime="11:15"/>
<period name="5" short="5" period="5" starttime="11:30" endtime="12:15"/>
<period name="6" short="6" period="6" starttime="12:25" endtime="13:10"/>
<period name="7" short="7" period="7" starttime="13:20" endtime="14:05"/>
<period name="8" short="8" period="8" starttime="14:15" endtime="15:00"/>
<period name="9" short="9" period="9" starttime="15:05" endtime="15:50"/>
</periods>
<daysdefs options="canadd,export:silent" columns="id,days,name,short">
<daysdef id="BD533C43ECD6A0C8" name="Dowolny dzie�" short="X" days="10000,01000,00100,00010,00001"/>
<daysdef id="C3BE3F39F158E3B3" name="Ka�dy dzie�" short="E" days="11111"/>
<daysdef id="A87EE794689C623F" name="Poniedzia�ek" short="Po" days="10000"/>
<daysdef id="B8BE35E5B6647C97" name="Wtorek" short="Wt" days="01000"/>
<daysdef id="53A9A335A5AD2FC5" name="�roda" short="�r" days="00100"/>
<daysdef id="89A1FF497F3708A0" name="Czwartek" short="Cz" days="00010"/>
<daysdef id="453F5EDF3F8855A8" name="Pi�tek" short="Pi" days="00001"/>
</daysdefs>
</timetable>
A tutaj kod ze strony na której się wzorowałem (to samo wrzucam niżej)
<?xml version="1.0" encoding="iso-8859-2"?>
<SPOTKANIA>
<SPOTKANIE TYP="nieformalne">
<TYTUŁ>XML w praktycznych zastosowaniach</TYTUŁ>
<NUMER>2079</NUMER>
<TEMAT>XML</TEMAT>
<DATA>6/1/2002</DATA>
<OSOBY>
<OSOBA STATUS="obecna">
<IMIE>Edward</IMIE>
<NAZWISKO>Samson</NAZWISKO>
</OSOBA>
<OSOBA STATUS="nieobecna">
<IMIE>Ernestyna</IMIE>
<NAZWISKO>Johnson</NAZWISKO>
</OSOBA>
<OSOBA STATUS="obecna">
<IMIE>Betty</IMIE>
<NAZWISKO>Richardson</NAZWISKO>
</OSOBA>
</OSOBY>
</SPOTKANIE>
</SPOTKANIA>
<HTML>
<HEAD>
<TITLE>
Odczytywanie wartości atrybutów z dokumentu XML
</TITLE>
<XML ID="meetingsXML" SRC="spotkania.xml"></XML>
<SCRIPT LANGUAGE="JavaScript">
function readXMLDocument()
{
var xmldoc, meetingsNode, meetingNode, peopleNode
var personNode, first_nameNode, last_nameNode, outputText
var attributes, attendancePerson
xmldoc = document.all("meetingsXML").XMLDocument
meetingsNode = meetingsXML.documentElement
meetingNode = meetingsNode.firstChild
peopleNode = meetingNode.lastChild
personNode = peopleNode.lastChild
first_nameNode = personNode.firstChild
last_nameNode = first_nameNode.nextSibling
attributes = personNode.attributes
attendancePerson = attributes.getNamedItem("STATUS")
outputText = "Trzecia osoba: " +
first_nameNode.firstChild.nodeValue + ' ' +
last_nameNode.firstChild.nodeValue +
" - " + attendancePerson.value
messageDIV.innerHTML = outputText
}
</SCRIPT>
</HEAD>
<BODY>
<CENTER>
<H1>
Odczytywanie atrybutów z dokumentów XML
</H1>
<INPUT TYPE="BUTTON" VALUE="Pobierz informacje o trzeciej osobie"
ONCLICK="readXMLDocument()">
<P>
<DIV ID="messageDIV"></DIV>
</CENTER>
</BODY>
</HTML>