XML DOM: I'm doing it all wrong, right?

G

goodstufffilms

Story: (adds extra flavor)

I'm not much of a pro at web design, but I made a site for myself
and som
eone noticed and asked me to make a site for their organization.
Usually I
use just html and JavaScript, but they want to be able to edit their
site wi
thout having to wade through 3 feet of my enigmatic code. I'm
guessing PHP
is the ideal solution, but I managed to turn 2 weeks into 3 days. A
friend
I work with recommended I implement XML DOM.
I've been researching, copy/pasting code, and exhausting all sorts
of opt
ions and ultimately my ignorance prevails and I am unable to get the
results
I crave.

The Setup: (think mood lighting)

So far I've used PowerPoint, Paint, and Notepad... Yes, I know the
tools o
f a true master (except not) ...to create a website without any
information on
it. Sort of a skeleton if you will. I've been searching for a way
to read
in data from an xml file and so far the best I can get, calling a
JavaScrip
t function: loadXMLDoc(), is a read-in of a block of text with no
preservati
on of extra spaces or returns.

Questions: (No it's not just you, these are stupid)

What function or code should I use to retrieve data from a .txt
or .xml file
?
Is it easy preserve html code applied to the text if it has been read
this w
ay (such as a link)?
Lastly are any sites you could point me at that have a few examples of
what
I'm trying to do?

Thanks for reading,
-Andrew
 
J

Joe Kesselman

A friend I work with recommended I implement XML DOM.

Uhm. Do you really mean "implement" or "use the interfaces of"?
loadXMLDoc(), is a read-in of a block of text with no
preservation of extra spaces or returns.

XML will preserve only information which is meaningful to XML. That does
mean some (not all) whitespace will be disarded. If that isn't what you
want, you either mis-structured your XML document or you don't want XML.
What function or code should I use to retrieve data from a .txt
or .xml file

There are lots of good tutorials at http://www.ibm.com, starting from
"what is XML anyway" and working up through basic tools to fairly
sophisticated applications. I highly recommend that you do some homework.

What you're "doing all wrong" is that you're starting at the last moment.
 
P

Peter Flynn

Story: (adds extra flavor)

I'm not much of a pro at web design, but I made a site for myself and
som eone noticed and asked me to make a site for their organization.
Usually I use just html and JavaScript, but they want to be able to
edit their site wi thout having to wade through 3 feet of my
enigmatic code. I'm guessing PHP is the ideal solution, but I managed
to turn 2 weeks into 3 days. A friend I work with recommended I
implement XML DOM.

It sounds like what you really need is none of that at all, but a simple
content management system (CMS). There are dozens of these (leaving
aside the corporate-level ones which cost 000s), and many of them are
Open Source. You can even use a blog-like system to achieve this.

What you're doing is teaching yourself XML and related techniques --
which in itself is A Good Thing -- but not doing what your friend asked
and making them a web site :)

///Peter
 
J

Joe Kesselman

Peter said:
What you're doing is teaching yourself XML and related techniques --
which in itself is A Good Thing -- but not doing what your friend asked
and making them a web site :)

Good point. Focus on the goal, then pick the tools to suit the goal...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top