Jump to content

StupidRalph

Members
  • Posts

    7
  • Joined

  • Last visited

StupidRalph's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Depends. What does your XML file contain? I have some XML files that just contain the text for my site. And I just pull the text from the XML page for which ever page requests it. The reason I keep all my text in an XML file is if I want to change the language of my site I just use a different XML file with that diff language. Check out my post titled 'Accessing Other Elements' or something like that. It kind of explains what I'm doing and it contains the javascript I used to parse my XML.
  2. I think it may possibly be a bug with Dreamweaver MX. I purposely made my first begginig <link> tag lowercase and my closing <LINK> tag UPPERCASE and it parse correctly. So I opened my browser and tried to view the same page and got an error. Okay so now I am really confused. I then make all of my <link> tags lowercase save it clear my temporary internet files and try to view it and ERROR. I go to the actual page via my browser and not Dreamweaver and I do not get an error. So the only thing I can figure out is that when Dreamweaver creates the temporary file to show in the browser it converts my tag to UPPERCASE. ORWhich REALLY wouldn't suprise me either would be a bug in Explorer 6. Weird but true.I am running windows xp sp2,macromedia mx, apache 2.0.54, php 4.4.0, Internet Explorer 6.0.2900.2180.xpsp_sp2_gdr.050301-1519I think I'll d/l mozilla and report back.
  3. Yes I am very much aware that XML is case sensitive. However, before I had the link tag as uppercase. I had all 4 in lowercase. But when i went to parse my code it gave me the error as if I used UPPERCASE for a begginning tag when I really did not. I did a find and replace in Dreamweaver and changed all of my uppercase <LINK> to <link> and I got an error trying to parse. I then did another find and replace changing my <link> back to <LINK> and it parse correctly. Tell me if you can parse this page. <?xml version="1.0" encoding="iso-8859-1"?><website><page index="0"><name>Home</name><link>http://www.mydomain.com</link><title>CLW Technology</title><contentheader>• Totally Framed</contentheader><content><span style="width: 460px; padding-left: 20px; ">Something about art goes here.<p>blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p></span></content></page><page index="1"><name>Control Panel</name><link>http://www.mydomain.com/admin/index.php</link><title>CLW Technology</title><contentheader>• Control Panel</contentheader><content><span style="width: 460px; padding-left: 20px; ">RANDOM TEXT 2<br />Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui <p>blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p></span></content></page></website> As you can see I have all my <link> tags the same and in lowercase. But it still gives me a parse error like the first <link> is really <LINK> when it is not. This is the EXACT error that comes up from parsing the above XML. You can plainly see that all the <link> tags are the same. Can you figure it out?
  4. Why won't this parse? The posted XML will parse with no problem. However, if I was to change the <LINK> to <link> it won't parse. Its not a big deal but I'd still like to no why it won't parse. <?xml version="1.0" encoding="iso-8859-1"?><website><page id="0"><name>Home</name><LINK>http://www.mydomain.com</LINK><title>CLW Technology</title><contentheader>• Our Company</contentheader><content><span style="width: 460px; padding-left: 20px; ">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie <p>blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p></span></content></page><page id="1"><name>Control Panel</name><LINK>http://www.mydomain.com/admin/index.php</LINK><title>CLW Technology</title><contentheader>• Control Panel</contentheader><content><span style="width: 460px; padding-left: 20px; ">RANDOM TEXT 2<br />Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie <p>blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p></span></content></page></website>
  5. Okay class here is what to do. You see that last part part in my javascript?This part document.getElementById("content").innerHTML=xmlDoc.getElementsByTagName("content")[0].firstChild.nodeValue Well you see the 0 inside of the braces []. Yeah the second line of code just before it says firstChild-- that is called an index. Increase the index to which ever element you want to call. The reason it didn't work the first time I tried this was b/c I had errors on my XML page. Its really BASIC javascript that I was overthinking. It is also a good idea if you set your site up like me to set your page id equal to the index in the XML file. Tune in next week and I will show you how to declare a variable. DOH! I should've been past this.
  6. StupidRalph

    Added slashes

    Even still magic quotes will be removed completely in PHP 6.
  7. All right I have a javascript that parses my .xml files and writes the contents to individual elements in my page via the innerHTML method. That is okay for one page but what if I want to have all my pages in one xml file? Ex. I have a page called home.xml that has all the content for the home page. Another xml file for an About us page in about_us.xml and etc. What if I didn't want to have them in seperate files but in one xml file called site.xml? How would I tell my javascript which to node to use. I tried like changing firstChild to secondChild and so forth. I gave each page an id attribute but didn't know how to access it. Any help will be appreciated. parse_xml.js var xmlDocfunction loadXML(){//load xml file// code for IEif (window.ActiveXObject) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("xml/site.xml"); getmessage() }// code for Mozilla, etc.else if (document.implementation &&document.implementation.createDocument) { xmlDoc= document.implementation.createDocument("","",null); xmlDoc.load("xml/site.xml"); xmlDoc.onload=getmessage }else { alert("Your browser cannot handle this script"); }}function getmessage(){document.getElementById("contentheader").innerHTML=xmlDoc.getElementsByTagName("contentheader")[0].firstChild.nodeValuedocument.getElementById("content").innerHTML=xmlDoc.getElementsByTagName("content")[0].firstChild.nodeValue} site.xml <?xml version="1.0" encoding="iso-8859-1"?><page id="1"><name>Home</name><title>Company Name</title><contentheader>• Our Company</contentheader><content><span style="width: 460px; padding-left: 20px; ">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</span></content></page><page id="2"><name>About Us</name><title>Company Name2</title><contentheader>• About Us</contentheader><content><span style="width: 460px; padding-left: 20px; ">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</span></content></page>....etc. Suppose I wanted my Javascript to write the elements of page 2 and page 2 only.
×
×
  • Create New...