Jump to content

Need Help Understanding Xml


Guest bgbs
 Share

Recommended Posts

XML Tutorials don't give me answers. Please Help.I'm not familiar with XML, I would like to get couple of questions answered to see how I can properly use xml file to my advantage for web design.On my website I have the same numeric data (number 3220) which is used in many different HTML files. This cause issues if I need to update that numeric data in many html files cause it is time consuming. I heard that xml file should take care of that.How could I do that with xml file? I assume I need to include the xml file in the html document. In the xml document I need to set the 3220 record number, then insert specific xml code into the html file that contains that record in the xml document. The problem is none of the tutorials tell me how to include xml file, and how to insert xml code in the html document where i need it to reside. They only tell me how to properly build xml.Can anyone help?At least point me in the right direction.

Link to comment
Share on other sites

Is this an existing XML file, or are you only thinking of using XML because you heard it would help?If the data is not currently stored as XML, how is it stored? In a database? On your desktop? Or is this project still in the planning stage?If you have access to PHP, you could go about this several different ways that are very simple. One involves XML. Another might simply use a plain text file.Would there be other data in the XML file, or would the XML file hold just this one piece of data for this one purpose? The first makes sense, and I could show you some PHP code that could handle that in just a few lines. The second sounds inefficient to me.The idea of "including" an XML file doesn't mean anything to me. But I do not know XML as well as some others. Maybe there's an obvious technique I just know know. Or maybe your source was confused. Or maybe your source only explained part of the solution. When I think of "including" in the context of HTML, I think of a server-side solution like PHP or ASP.Did the word AJAX come up in your discussion? It's another possibility, but it also seems inefficient for transmitting a small piece of static data.

Link to comment
Share on other sites

XML on its own doesn't "do" anything. You must still write the code that will handle it.You can use XML to create "hooks" for code that you can otherwise execute anyways. In the case of using XML with HTML... HTML can't read XML, and do something with it, since it isn't a programming language (it doesn't have conditions, loops, etc.). JavaScript can, and so can PHP, as well as pretty much all morern programming languages. Once any of these langauges gets ahold of XML, you can tell them what to do based on the XML contents.As far as including a single text across all pages on a site, using server side includes (whether it's with PHP or not) is the easiest, and probably the most efficient approach.

Link to comment
Share on other sites

  • 2 weeks later...

or learn XML Path Language:http://www.w3.org/1999/10/xquery-tree.htmlOf course on it's own XPath doesn't account for much but used with XSL, it's quite powerful, the problem then is support, which browser does it what way becomes the issue.If you are serious about XML, then you will need to understand entities, as well as DTD, which is the best way to learn about document structure.XSLT is an XML vocabulary that transforms xml nodes into HTML using XPath and XQL. When you create an xml file it can reference a standard Cascading Style Sheets (CSS) file but that won't let you use things like images, links and so on, for that you will need XSL which is a superset of css.There is also the W3CDOM, which is based on the ECMA scripting language or JavaScript and references nodes within a flat xml file. It's nice but XPath in XSL is really the way to go for most things as it effectively supplants the functionality of HTML altogether and merely uses it (html) as a rendering language.The book I read was called XML Unleashed by Michael Morrison. Some things are out of date now but the way the concepts were presented made it very exciting and it still is my go to reference until of course I find things like the above link.HTH's

Edited by compositor
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...