Jump to content

XML newbie


Eivo

Recommended Posts

I'm looking for some help getting started in XML. Right now I know HTML and CSS, and have a decent grasp on ASP (classic) and JavaScript. I used what I know and have crafted a content management system that I am now using on several of my clients websites. But from what I understand, XML could really help me add more features and speed to my product, so I am very interested in learning it and how I can use it to my advantage.I have been going through the tutorials on here for a couple days now. I think that I understand some about the XML file, concerning that it must be well-formed and such, but I am getting completely lost when it comes to the DTD / Schema as well as how to actually use the XML file. So I have several questions...

  • Which is better to use, DTD or Schema? (I'm looking for things like which one will be used longer, which is faster, which is more robust, and easiest to learn)
  • Are there any good resources, other than w3schools.com, for learning XML and DTD / Schema?
  • How can I incorporate XML into the languages I already know?
  • Do you know of any good examples where I can see how someone used XML to improve their site / applications performance?

Any help will be greatly appreciated. Thank you.

Link to comment
Share on other sites

Schema... definetly. It's easier, more feature rich and there are more tools for it. The only thing DTDs have that XML Schema doesn't are named entities (think "& nbsp;" in (X)HTML).I don't know of any other resources, as in "tutorials". I've learned most of what I know about Schema thanks to Stylus Studio. It has a GUI Schema editor, and shows the source code at the same time. By using it + W3Schools tutorial and reference, I was able to grasp quite some stuff, though there is still a lot I don't get.Errm... by putting the XML as a string maybe? For example, in java script:

var myXML = '<?xml version="1.0" encoding="utf-8"?><myElement/>';

XML in it's essence is nothing more but a plain text file with a standard formatting. So it could be embed in other languages as text, though that pretty much kills the point of it which is... well... to put it more generally - separation.I don't really have any. Portability is what attracted me to XML, not performance. It really depends on the application and whether you use the XML file on the client or on the server. Very case specific... give me a scenario, and I can tell you where XML could be beneficial in it.

Link to comment
Share on other sites

Well my main goal with it right now is to apply it to the CMS I am working with.I have it working like this...We build a site for the client. The site is coded in ASP and calls information from a table, specific for the client, stored on a MSSQL database.The information stored on the database is HTML that has been edited by the client via a WYSIWYG Editor located in a "back-end" portal accessible by the client.This portal is where we plan to launch other features also, such as E-mail Management, Account Management, and a FAQ database in the immediate future. Right now it only contains the CMS and a User Management System.All of this is currently handled using ASP writing to a MSSQL Database. There is a lot of information I am currently trying to handle, and that is why I am interested in XML.I hope that helped.

Link to comment
Share on other sites

Khm... sorry about the long delay. I just didn't had the time to visit the forum until now.Well... it seems you've already figured most of the stuff out. There's not much where plain XML could help. Not on the server anyway.XML might serve better on the client side in the form of HTTP requests (in other words - add AJAX to the mix) that return XML documents that are processed with a cashed XSLT file.For example, in your Email management, you could add auto complete. To imlement it, every time there is a change, you'll send the new string, and the server will return a small XML document containing emails beginning with the string. With JS, you'll just then initiate an XSLT transformation to turn that into a list the user could select from. Using XSLT instead of plain DOM is usually faster on the client side, despite that it is sometimes slower on the server side. And transforming the XML instead of directly embedding the HTML in the response gives you the ability to control the markup without reworking the server side mechanism AND also saved bandwidth, as you may have a really small XML, and transform it to otherwise large HTML you'd then embed with the rest of the page.Another general scenario, not much impoving performance, but more of security... you may generate custom XMLs based on POST data and validate them with a custom chema. This again means you're not dependant on the server code for the validation (i.e. your app is easily portable in, say... PHP) but also means you're more secured of errors. Regardless of the programming language used, there's always the possiblity of say a flawed regular expression, or a missed check. With schema, built in datatypes can ensure most of that stuff, but they need an XML to work against.If you're going to do the above, you should probably also save your data as XML in the database, but as I see, that may not be completely feasable. In that case, you could just use the POST data directly if the generated XML validates, but if you do that, you should be extra careful.

Link to comment
Share on other sites

Guest FirefoxRocks

1. DTD is more easier to learn, but Schema is more powerful and robust.2. I have found sites that discuss XML and related technologies, however I haven't found any that actually teach it well.3. You can use XHTML, which is XML-based HTML. Otherwise I am confused on this question.4. XML is being used all over the place. iTunes libraries are stored via XML records. So are your MSN conversation histories. I just recently finished a small XML project on organizing data from sports teams.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...