Jump to content

XML Tutorial


AndyCanfield

Recommended Posts

In your XML documentation you never specify the format of the <?xml ... ?> line. You give some examples, but never specifications. The tutorial frequently recommends saving the file in UTF-8 format, but every example of the encoding attribute shows encoding="ISO-8859-1". I can only guess that what I want is <?xml version="1.0" encoding="UTF-8" ?> .Also, it is not clear from your write-up whether single quotes (') are legal as xml quotes, or only double quotes (") are legal. In many languages we use double quotes to surround the entire output string and so single quotes are easier to use inside the string. For exampoe, this PHP statement:

    echo "<?xml version='1.0' encoding='UTF-8' ?>\n";

creates an <?xml ... ?> line with apostrophes rather than double quotes. Is this legal XML?Suggestion for improvement: cover the <?xml ... ?> specifications, change your examples to UTF-8, and clarify single versus double quotes.

Link to comment
Share on other sites

W3C and W3Schools are two separate organizations that have absolutely no relation to each other.W3C - World Wide Web Consortium - define most of the standards we use on the web, such as HTML, CSS, XML, XHTML, etc.W3Schools - ... errr... W3Schools (no real acronym... just a fancy play with the "W3" bit) - offer tutorials for most of the languages we use on the web, including ones not from W3C.As for your question as to what's legal and what not... in both PHP and XML, both single and double quotes are acceptable. In the case of XML, they mean the same. In PHP, they mean slightly different things, but the difference is irrelevant most of the times.The value of the encoding attribute specifies the encoding of the XML document. By default, XML uses UTF-8, but can be in any other encoding. PHP always uses ISO-8859-1 internally, but depending on how you save your file, you can trick it into writing out UTF-8 by default.In the case of this example, for the outputted XML document to REALLY be in UTF-8, the PHP file must be saved as UTF-8. You can do that by clicking "Save As..." in Notepad and selecting "UTF-8" from the "encoding" dropdown menu.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...