PDA

View Full Version : Insert xml into html??


fnewsome
07-20-2009, 02:37 PM
Hi Guy's
I have a html page with VB Script on it?
My program gives me the results of my bridge club in a xml format?

How do I insert the results of the xml doc into the html?

Thanks

Frank :thumbsup:

ckeyrouz
07-20-2009, 03:29 PM
You can transform the xml using xsl into valid html.
If you are new to xsl check this site:

http://www.w3schools.com/XSL/xsl_intro.asp

fnewsome
07-20-2009, 04:02 PM
Hi Ckeyrouz,
First of all? Thanks for replying so quick!

I'm not a coder my friend!
(I know html like back of my hand old school)

I have an example xml?
Could you have a look at this for me plz?

Frank :thumbsup:

Fou-Lu
07-21-2009, 01:57 AM
This is not a php question, unless it has to do with directly transforming the xml into html rather than interpreting it.

Moving to the XML Forum.


As for you're question:

<?xml version="1.0" encoding="utf-8"?>
<root>
<news>
<item>
<title>This is news 1</title>
<description>This is an article dedicated to news 1</description>
</item>
<item>
<title>This is news 2</title>
<description>Following up from news article 1, this is number 2.</description>
</item>
</news>
</root>

XML is a structured language, so you must retain the rules for well-formed documents. There is no limitations for the tags you can use, with the exceptions of standard rules: you cannot have xml as a tag name (best I know, AV will probably confirm / deny that), cannot start with a number, and must follow the pattern: [a-zA-Z_][a-zA-Z_0-9]*. That is all, its up to the intermediate programming languages to actually control how the documents are handled.
This brings us from well-formed to correct. In order to be correct, a DTD or Schema must be used to enforce requirements and rulesets that must be used. Examples are telling what a news tag is, in this example it consists of 0 or more item. Item > title would be of type string, and must be cdata.
XML isn't hard to learn, but it is not the same as HTML. However, a well-formed document can be interpreted as HTML as previously mentioned by using XML-FO or XSLT.

fnewsome
07-21-2009, 07:39 AM
Many many thanks it's a lot clearer now!
As usual you guy's have surpassed yourselves

See you again

Frank :thumbsup: