Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very basic problem.

Status
Not open for further replies.

Nayture

IS-IT--Management
Dec 11, 2001
1
GB
Hi there..
I am just about pulling my hair out on this one.
OK here is the deal.. There is an XML file at which i want to pull data from and display on my website. The aforementioned XML page starts with :-

<?xml version=&quot;1.0&quot;?>

<!DOCTYPE server_status SYSTEM &quot;mythic.dtd&quot;>

<server_status>

<server name=&quot;Pendragon&quot; type=&quot;Test&quot;>
<population>214</population>
<status>Up</status>
<relic name=&quot;Scabbard of Excalibur&quot; type=&quot;Melee&quot; realm=&quot;Albion&quot;>
<owner>Albion</owner>
</server>

</server_status>

I cut it down quite a bit on here, but the original is much bigger. Now without the line <!DOCTYPE server_status SYSTEM &quot;mythic.dtd&quot;> I am able to at least query the XML file itself by using the following in my HTML file

<script type=&quot;text/javascript&quot; for=&quot;window&quot; event=&quot;onload&quot;>
var xmlDoc = new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);
xmlDoc.async=&quot;false&quot;;
xmlDoc.load(&quot;servers.xml&quot;);
nodes = xmlDoc.documentElement.childNodes;
server.innerText = nodes.item(0).text;
</script>

<span id=&quot;server&quot;>

But if i put back the DTD line i get nothing. I get an Oject missing error on the &quot;nodes = xml etc....&quot; line.
Why do I get this... I want to know how to pull any/some or all of the data from the XML page into an HTML document.
I understand that the DTD file is there to define the building blocks of the XML file, but why can i not extract data from the XML file now. What do i need to type in?

The DTD file is as follows

<!ELEMENT server_status (server+)>
<!ATTLIST server_status xmlns CDATA #REQUIRED>

<!ELEMENT server (population, status, relic+, keep+)>

<!ATTLIST server name CDATA #REQUIRED>
<!ATTLIST server type CDATA &quot;Normal&quot;>

<!ELEMENT population (#PCDATA)>
<!ELEMENT status (#PCDATA)>

<!ELEMENT relic (owner)>
<!ATTLIST relic name CDATA #REQUIRED>
<!ATTLIST relic type (Melee|Magic) &quot;Melee&quot;>
<!ATTLIST relic realm CDATA #REQUIRED>

<!ELEMENT keep (owner)>
<!ATTLIST keep name CDATA #REQUIRED>
<!ATTLIST keep realm CDATA #REQUIRED>

<!ELEMENT owner (#PCDATA)>

I really dont know much about this subject

Cheers
 
When you include the DTD line, the XML parser will usually look for the file that is specified. If possible, leave out this line. Otherwise you have to conatact camelotherald.com and ask them to make the dtd file available over the web - it is currently not to be found in its specified location.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top