Webmaster Key - Discussion Forums


Welcome, Guest. Please login or register.
Did you miss your activation email?
February 09, 2012, 06:17:50 PM

Login with username, password and session length
Welceome to Forums!

Important information for guests and new members:

In order to understand the full benefits of becoming an active member of this forum, please review the following information on guest and new member restrictions. These forum changes have been prompted by an overwhelming and unreasonable amount of bot postings and incoherent guest spam messages. We wish to prevent these events from happening in the future and make our community a more comfortable place for all of our members.

For guests:

Guests are not allowed to open new topics, polls, or posts attachments.
If you wish to open up new discussions on this forum, we encourage you to register.

For new members:

New members with less than five posts are not allowed to modify additional profile information such as avatars, contact information, biographies, and signatures. However, new members are encouraged to post their own topics or reply to topics initiated by other members. Become active on the forums and 5 posts should be an easy task!

We are a diverse community with members from all over the world. We encourage new ideas and interesting conversation. Do not be afraid to post webmaster/computer-related questions or problems, as our active members are always willing to help when they are able. Interested? Join us.

+ Webmaster Key Forums
|-+ Webmaster Corner
| |-+ Site Design and Web Authoring
| | |-+ XML Discussion
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print
Author Topic: XML Discussion  (Read 3216 times)
Andy
Administrator
Veteran
*****
Posts: 5 752



« on: March 01, 2007, 02:15:24 PM »

In case you didn't notice XML (Extensible Markup Language) is being used alot now to contain data. It is a very simple concept to understand.

This is the way the on-line world is moving now i.e. separation of data and presentation.

Data on pets could be stored in an XML file something like:

Code:
<pets>
  <dog>Scooby</dog>
  <cat>Felix</cat>
</pets>

Then you can specify the styles and positioning of the content in an XSLT file which is like an HTML page put has containing elements for the data. But it also can include looping statements like for-each which can repeat sections of code depending on how many pets you have for example.

To pull in the data from the XML file and the markup from the XSLT file you have something like a php file which is what you reference as a web page e.g.

Code:
<?php

$xmldoc 
domxml_open_file("MyPetData.xml")

$xsldoc  domxml_xslt_stylesheet_file ("MyPetPageAppearance.xslt");

$result  $xsldoc->process($xmldoc);

print 
$result->dump_mem();

?>


I have implemented this kind of thing for a feedback form. The input data is the options for drop-down lists from an XML file. The layout of the page is derived from an XSLT file and the php file is: http://www.sitesugu.com/feedback.php just to give you an idea. After data is submitted from the form, it is saved to another XML file. This can then be transformed into a report via another similar process later.

To read up on this you can go to www.w3schools.com where they have some free tutorials on XML, XSL etc.

Post here if you are stuck with any aspect of XML or XSLT so we can maybe learn more about it together.
Report to moderator   Logged

donecweb
Administrator
Veteran
*****
Posts: 1 303


DonecWeb


« Reply #1 on: March 01, 2007, 06:38:13 PM »

That sounds a lot like using a php include to insert text into a selected page or pages. So what would be the difference? For php your server must support php. Is there anything special about the server or any other conditions needed for using xml code like that. Do all browsers support this method.
Report to moderator   Logged

DonEc Web

Links and accurate information provide the best answer, while garbage in provides garbage out.
Andy
Administrator
Veteran
*****
Posts: 5 752



« Reply #2 on: March 02, 2007, 09:54:37 AM »

PHP Includes are files that are inserted at a particular point in the main php page. So they may be code or text. Unlike xml they are not structured data files.

xml files only contain tagged data and can be viewed and edited by non-programmers. For example the data may be a product range for a store with product names, descriptions and the latest prices. The store owner could edit this data themselves without needing the skills of a webmaster.

xml is an industry standard way to represent data on the web.

php4 and php5 have the necessary libraries to support xml and xslt.

The data processing is done server side so the browser only sees xhtml so there should not be a cross-browser issue unless the browser is out of date.
Report to moderator   Logged

donecweb
Administrator
Veteran
*****
Posts: 1 303


DonecWeb


« Reply #3 on: March 02, 2007, 10:12:46 PM »

You can use a php include to place data from a file within the html and style controlled by CSS yet the file can be edited by anyone that has access whether they have programing knowledge or not. So as you see I don't really follow how xml files work.
Report to moderator   Logged

DonEc Web

Links and accurate information provide the best answer, while garbage in provides garbage out.
Andy
Administrator
Veteran
*****
Posts: 5 752



« Reply #4 on: March 03, 2007, 09:49:44 AM »

If you use php to include text in a web page, unless you have code inside the include file, the text will only be inserted in one place in your html page. There is no structure to the data.

You can't allow non-programmers to edit files that can break your site if they make a typo (so this file could only contain text). With XML, they would typically use an XML editing tool which only lets them change the data.

Since XML is structured data it is easily extracted by the XSLT template into multiple places throughout the web page. To do this with php and a single include file, you would have to have constant definitions or such like in the include file.

The goal with using xml is to keep the data separate from the markup and css.
Report to moderator   Logged

donecweb
Administrator
Veteran
*****
Posts: 1 303


DonecWeb


« Reply #5 on: March 03, 2007, 09:16:05 PM »

I think I'm getting an idea of what you are talking about and it sounds interesting. By chance do you have an simple example online I could see?
Report to moderator   Logged

DonEc Web

Links and accurate information provide the best answer, while garbage in provides garbage out.
Andy
Administrator
Veteran
*****
Posts: 5 752



« Reply #6 on: March 04, 2007, 10:05:52 AM »

Sure, here's an example of using XML for data storage on a website. It shows the code I implemented with some commentry.
Report to moderator   Logged

donecweb
Administrator
Veteran
*****
Posts: 1 303


DonecWeb


« Reply #7 on: March 04, 2007, 06:05:08 PM »

Andy have you ever heard of docbooks? It seems that Quanta Plus is really an xml editor and has special features for working with xml and creating docbooks. I'm not sure since I am still just learning about Quanta Plus.
Report to moderator   Logged

DonEc Web

Links and accurate information provide the best answer, while garbage in provides garbage out.
Andy
Administrator
Veteran
*****
Posts: 5 752



« Reply #8 on: March 08, 2007, 01:13:03 PM »

Quote
have you ever heard of docbooks

No, but since I started coding a web authoring tool I find that I am learning alot of new things.

The last few days I have been studying HTML DOM which is the way modern web browsers store the HTML of a web site i.e. in an XML-like format with all HTML elements as nodes of a tree structure. DOM means Document Object Model. It sounds frightening but it is actually very simple and like my simple pets example at the beginning of this thread. Just replace the pets with HTML tags  Grin

So this provides a simple way to implement a WYSIWYG editor since you simply drag around nodes of a tree. So this is what I have been working on, a simple way to implement a WYSIWYG editor. I am playing around with the WebBrowser control in the .Net framework.

I didn't think this was feasible before, but with the HTML DOM approach, the user will be unable to select things that are not part of the DOM. I have noticed alot of use of Javascript to implement on-line WYSIWYG editing, they are making use of the DOM via the standard methods (functions) that are a part of it.

For people that are interested in this Geeky subject I have a detailed post about my experience of working out how to code a WYSIWYG page editor. This includes graphic images of the relationship of web page content to the actual DOM tree I mentioned. Here it is: Frustration Coding a WYSIWYG Editor
« Last Edit: March 08, 2007, 03:24:39 PM by Andy » Report to moderator   Logged

Pages: [1] Go Up Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print 
+ Webmaster Key Forums
|-+ Webmaster Corner
| |-+ Site Design and Web Authoring
| | |-+ XML Discussion

Jump to:  
« previous next »


Our Partners
RelmaxTOP Ranking System Web Hosting RelmaxTOP Ranking System
Staff Sites
12Noon[12Noon Gallery] Andy[Urgentclick]
Tamuril[Tamuril's Digital Art Exhibit] Sensovision
Powered by MySQL Powered by PHP We are hosted by Relmax Inc. |Our Privacy Policy | Sitemap
Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC
Forum design by Tamuril © 2005.
Valid XHTML 1.0! Valid CSS!