|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Storing URLs in XML files
I started with XML a bit recently, and have run into a little trouble. I have an XML file that I want to use as a source for a table. The table is a menu, so I want the link addresses to be specified in the XML file, so they can be changed in just the XML file to prevent having to change all the pages of the site. How can I do this?
I figured this wouldn't work, but I tried it anyway: Code:
...
<menu>
<item>
<href><a href='index.html'>Home</a></href>
<desc>Back to the homepage</desc>
</item>
...
</menu>
so, how can I have it so the url is specified in the XML file? any help much appreciated |
|
#2
|
|||
|
|||
|
The first thing to say, if you don't know it already, is that tags in XML have no predefined meaning, it's the author who will decide what to do with them. Some questions can be raised from this assumption:
Question n°1 : which application will use the XML file as input ? If you're willing to see the XML file in IE, you're gonna have to tell IE what the tags mean, this is done by transforming the file with XSLT, look for a tutorial if this is what you're trying to do. If it's a custom application, then this application will have to support any name you choose for your tags, and adjust the processing based on the tags. Question n°2 : Why sticking to HTML naming conventions ? Your XML file could have custom, more explicit tags, like this : <Link URL="http://www.anywhere.com" Text="A cool site" /> ... Don't forget that XML gives you the freedom to do what you want, but that YOU have to tell him what to do with the content. Hope this helps ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Storing URLs in XML files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|