Log in

View Full Version : XML And Link


Raven_Writer
22-09-2003, 16:26
Does anyone know how to use links in an XML file, or how to link XML data at all?

Let's say i got an XML file w/ the following data:

<news>
<by>me</by>
</news>


And I want to link me to an e-mail:


<a href="mailto:my-email@here.com">me</a>


Does anyone know how to do link the data in <by> in the XML file?

Trashed20
22-09-2003, 18:49
well, its all in how you parse it. Usually you assign certain activities or text to each tag, for example, the by tag could have the site make a mysql query where the username is the given value, then reutrn <a href="mailto:$row[email]">$user</a>

Where are you planning on doing this and with what?

Raven_Writer
22-09-2003, 21:06
Originally posted by Trashed20
well, its all in how you parse it. Usually you assign certain activities or text to each tag, for example, the by tag could have the site make a mysql query where the username is the given value, then reutrn <a href="mailto:$row[email]">$user</a>

Where are you planning on doing this and with what?
This isn't dealing w/ PHP, I can only use ASP on my Brinkster account.

I'm planning on doing this on my news for my poetry site.

Trashed20
22-09-2003, 21:27
ok, for asp it would be the same type of thing. I'm sure it has some built in XML parsing functions since microsoft loves the stuff. You could also do an access or any other query. Or, you could add another field like

<news>
<email>hello@w00t.com</email>
<by> Whoever </by>
</news>

or

<news>
<by email="hello@w00t.com">Me</by>
</news>



It all depends on how you want the data to be delivered. I think for something like this it would be easier to have it in the XML instead of a query, but thats my preference.

Linking it is the easy part, getting something to parse it is a completly different story. Search the MSDN library and google to find an XML parser of some sort. Once you have the data into variables in your scripts, the rest is easy. My knowledge on ASP is very limited, so im just trying to point you in the general dirrection. Hope it helped.

HFWang
22-09-2003, 23:36
in the actual xml file itself, i do not believe you can make links to other stuff.

actually, i wanted to say something about cdata tags, or something. but i so rarely use xml... so... meh.

Raven_Writer
23-09-2003, 08:37
Originally posted by HFWang
in the actual xml file itself, i do not believe you can make links to other stuff.

actually, i wanted to say something about cdata tags, or something. but i so rarely use xml... so... meh.
You're right, you can't link in the actual XML file, that's why I'm trying to link in my ASP page.

HFWang
23-09-2003, 18:02
Just curious, why do people want to use XML as a datastorage mechanism?

I can understand how it is useful when moving from one format to another, but why keep it in XML? Its usually big/bulky, and its easier to just use a database, or save it in a propietary format on disk...

Trashed20
23-09-2003, 18:47
XML is supposedly supposed to be a standard format that can be read on ALL platforms. It also is usually used when you don't want someone to have access to the database, but you want them to have some data. An example of this would be an RSS formatted XML feed from a news site. You can get the info from the site, and then do whatever what you want with it. I'm not exxactly sure what Raven is trying to do, as he is very vauge with what he want to do so its pretty hard to help him. It sounds like he want to parse an XML feed, possibly from Listen-to, but maybe not. I dunno. I hate dealing with XML, but i did make a php parser for it. Whatever. :P

HFWang
23-09-2003, 18:56
PHP comes with an XML parser :D

though its rare to find servers with the more recent one...

Trashed20
23-09-2003, 18:59
just because it has a parser, doesn't mean it works right out of the can. I used the functions. It helps identifying tags, but there are tons of little kinks. Plus, if you want to parse the data into variables, it becomes a little harder. Its just not fun to work with.

try looking at the finctions and getting it to work... they are wonderful.

Raven_Writer
23-09-2003, 21:03
Originally posted by Trashed20
...I'm not exxactly sure what Raven is trying to do, as he is very vauge with what he want to do so its pretty hard to help him. It sounds like he want to parse an XML feed, possibly from Listen-to, but maybe not. I dunno. I hate dealing with XML, but i did make a php parser for it. Whatever. :P
What I'm trying to do is just make a BASIC news system (news is in a XML file, w/ a email link, and output the data [including the link] on the page).

I've already talked to Brandon about the L-T thing, and he said he's not really gonna do a RSS system for it.

HFWang
24-09-2003, 01:06
Why not just use a DB?

Save the trouble of writing stuff to the filesystem! :P

Trashed20
24-09-2003, 09:33
I'm goign to assume that he doesn't have database support on his brinkster account, so he wants to upload or create XML serverside so he has some sort of news system.

Raven_Writer
26-09-2003, 17:24
Originally posted by Trashed20
I'm goign to assume that he doesn't have database support on his brinkster account, so he wants to upload or create XML serverside so he has some sort of news system.
Actually I do have Access 2000 DB support, but there's two reasons why I am not using that:

1. I hate access' db's because they use up a lot more space than needed
2. I don't have Access 2000 on my computer anymore.