- Intended Audience
- Deployment Assumptions
- How the Gateway Works
- Concepts of the Rewriter
- Adding and Removing Rewriter Rules
- Methodology for Rule Extraction
- Out-Of-Box Rule Set
- Rewriting HTML Attributes
- Rewriting FORM Tag Input
- Rewriting JavaScript Content
- Rewriting Applet Parameters
- Rewriting Cascading Style Sheets
- Rewriting XML
- Performance
- Order Importance
- CASE Studies: How to Configure the Gateway to Rewrite a Web-Based JavaScript Navigation Bar
- Third Party Application Cookbooks
- Exchange
- How to Get Hot Patches
- Glossary
- Acknowledgements
Rewriting XML
Currently, the Internet Explorer 5.5 browser is the only browser certified for use with the Portal Server that supports inline XML tags. The SP3 Hot Patch 1 release added two new gateway profile sections to handle the rewriting of XML data. They are Rewrite Text Data of XML Document and Rewrite Attribute Value of XML Document. The two lists are pre-populated with the entries required for Outlook Web Access 2000 to work through the gateway. See "Exchange" on page 79 for other necessary changes.
Rewriting XML PCDATA
PCDATA is essentially the text between the XML tags. It is defined as #PCDATA in the DTD. To rewrite PCDATA, you need only add the tag name to the Rewrite Text Data of XML Document section of the gateway profile.
The following is an example:
<?xml version="1.0"?> <mytag> http://www.iplanet.com </mytag> </xml>
To rewrite this URL, add mytag to the Rewrite Text Data of XML Document list. There may be cases where the PCDATA is dependent on the tag attribute values. In these cases, both the tag name and the attribute definition need to be added to the Rewrite Text Data of XML Document profile section.
The following is an example:
<?xml version="1.0"?> <mytag myattr1="desc"> iPlanet Home Page </mytag> < mytag myattr2="href"> http://www.iplanet.com </mytag> </xml>
In this case, it is clear that the PCDATA of the mytag element containing the attribute myattr1 should not be translated. To avoid this, the rule should be specified as: mytag,myattr2=href
Rewriting XML Tag Attributes
As with HTML attributes, XML attribute values can contain URLs. To rewrite XML attribute values, a rule containing the attribute name needs to be added to the Rewrite Attribute Value of XML Document section of the gateway profile.
The following is an example:
<?xml version="1.0"?> <mytag desc="iPlanet Home Page"/> <mytag url="http://www.iplanet.com"/> </xml>
In this example, the rule myattr2 would need to be added to the Rewrite Attributes Value of XML Document profile section. To differentiate specific tag names containing the same attribute names from having their values rewritten, specify a rule with the syntax attrName,tagName to the Rewrite Attribute Value of XML Document list.
The following is an example:
<?xml version="1.0"?> <mytag myattr="iPlanet Home Page"/> <urltag myattr="http://www.iplanet.com"/> </xml>
To rewrite the correct attribute value, the myattr,urltag rule would need to be added to the Rewrite Attribute Value of XML Document profile section.
Best PracticesXML Programming for Use Through the Gateway
You should use the following best practices:
Try to use unique attribute names specific to URLs.
You should be sure they are all used in the same context. The following is an example of what to avoid:
<?xml version="1.0"?> <myTag> <tag1 url="The URL is:">myValue</tag1> <tag2 url="http://www.iplanet.com">myValue</tag2> <tag3 url="http://www.sun.com">myValue</tag3> </myTag>
Do not generate XML content containing URLs dynamically using JavaScript content.
There are ways to parse HTML and JavaScript values created using JavaScript write methods, but there is no way to parse XML created in the same way.
The following is an example of what to avoid:
<SCRIPT> document.write('<mytag url="http://www.iplanet.com"/>\n'); </SCRIPT>
Perform user-agent checks to ensure that the browser supports XML before emitting XML code to be rendered by the browser.