Airwolf Data
Considering about this crazy thing. Hope it works!
– Post From My iPhone
XML - White Space Handling
White Space Handling
- White space consists of carriage returns, line feeds, tabs, and space characters
- You can freely add white space to your documents to make them more readable
- The XML parser ignores white space unless it is inside an element, then it passes the white space along to the application as part of the character data for the element
- XML spec says that the parser should not try to guess what the white space means
-
Use
xml:spaceattribute to control what happens - “default”: application should use default settings
- “preserve”: application should preserve all white space
XML - Namespaces
XML Namespaces
- Have the form <html xmlns=”http://www.w3.org/1999/xhtml” >
- What are namespaces?
- Namespaces provide a way to prevent tags with same names but different meanings from colliding with each other
- Exmaples:
-
<table>
<tr>
<td>Product</td>
<td>Price</td>
</tr>
<tr>
<td>Coffee Table</td>
<td>199.99</td>
</tr>
</table> -
<table sku=”12222221″>
<type>Coffee Table</type>
<price>199.99</price>
<inStock>yes</inStock>
<material>maple</material>
</table> - Namespaces solve this problem
-
<table xmlns=”http://www.w3.org/tr/xhtml”
xmlns:furn=”http://www.furniture.org/tables”>
<tr>
<td>Product</td>
<td>Price</td>
</tr>
<tr><td>
<furn:table sku=”1222221″>
<furn:type>Coffee Table</furn:type>
</furn:table>
</td><td>
<furn:table sku=”1222221″>
<furn:price>199.99</furn:price>
</furn:table>
</td></tr>
</table>
XML - What is XML
- What is XML?
- XML is the eXtensible Markup Language
- Became a W3C Recommendation in 1998
- Tag-based syntax, very much like HTML
- You get to make up your own tags (or you can use an existing tag set to solve a particular problem)
-
Foundation for several next-gen Web technologies
- XHTML, RSS (Blogs), AJAX, Web Services
- XML does not replace HTML
- What does XML do?
- XML is used to structure and describe information
- Intended to be used with the Internet
- XML can be used as a way to interchange data between disparate systems
XML - Entities
- Provide a way to help shorten and modularize your XML documents
- Provide a way to include characters that would otherwise be illegal to type in markup
- General Entities
- You can define these to be whatever you want, and they will be replaced by the parser with a full string
- ©right; or &author;
- Character Entities
- <
- & or "