Description |
Tip |
Avoid invalid XML characters in ASP pages | If you hard code XML data islands into a Web page, you'll want to avoid
several special characters that are part of XML's syntactic structure. XML
won't interpret these characters correctly if left within an XML data
source. The characters and the alternate character sequences to use in
their place are as follows: < < & & > > " " ' ' So, instead of <Greeting>Hello, 'World'! <This> will bomb!</Greeting> you'd want to enter <Greeting>Hello, 'World'! <This> will bomb!</Greeting> Of course, if you use the XML Document Object Model to create XML nodes, the XMLDOM takes care of this encoding for you. As a result, you won't need to use the alternate characters. So, MyGreetingNode.Text = "Hello, 'World'! <This> will bomb!" is perfectly valid. |
Build XML documents graphically with XML Notepad | XML is quickly becoming the data model for most Web applications.
However, if you've found yourself cringing at the thought of coding even
the smallest XML data island, then the Microsoft XML Notepad is for you.
This handy tool provides a nice UI for editing XML documents. With it, you
can add nodes, attributes, and values as well as see a graphical
representation of the data structure. Even better, XML Notepad takes care
of all the actual coding for you. You can download this utility for free
from http://msdn.microsoft.com/xml/notepad/intro.asp |
Convert ADO fields to XML tags without errors | XML tag names can't contain several special characters or spaces.
Therefore, when you use ADO field names as XML tags, make sure to rename
the fields, if necessary, in the SQL statement. For example, if you use
the following SQL statement: Select [Employ ID], Name FROM Employees and then use XMLDOM to convert the recordset fields into XML, the XML document will generate an error. That's because XMLDOM's creation methods convert the [Employ ID] fieldname into <Employ ID>. However, the space is an invalid character. To avoid this error, use an alias name in the SQL string, such as: Select [Employ ID] AS EmployID, Name FROM Employees |
Syntax requirements for integrating XSL into ASP and HTML | Since an XSL stylesheet is an XML document itself, its markup must
conform to XML grammar rules. Most notably, you must ensure that you close
all tags. Since HTML is considerably more forgiving in this regard, make
sure that the markup in XSL sheets will successfully parse. For example,
to use <BR> to express a line break, you must enter <BR/>
instead. To read more about the W3's recommendation for XHTML, which
addresses this issue, see http://www.w3.org/TR/xhtml1/ |