Go to Google Groups Home    microsoft.public.biztalk.server
DOCTYPE and XML declaration

Marcel <marcel.e.savi...@nz.andersen.com>

This is crazy thing about BizTalk. There is no way to tell
BizTalk to generate the xml or DocType definitions through
any user interface (that I know of). There's even less in
the way of documention. The key is to use a BizTalk map
because the maps are basically just XSL transformations.

Create a map in the BizTalk mapper, and then open the map
file with a text editor and find the XSL portion. It
should look a bit like this:

<CompiledXSL><xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:var="urn:var" xmlns:user="urn:user" exclude-result-
prefixes="msxsl var user" version="1.0">
                        <xsl:output method="xml" omit-xml-
declaration="yes"/>

...
...

There-in lies the solution. The <xsl:output> tag has a
number of property, one of which is "omit-xml-declaration"
which you set to "no" to generate a <?xml version="1.0"?>
definition. The doctype can also be generated via the same
tag by using the doctype-public or doctype-system
properties. Here's an example:

<xsl:output method="xml" omit-xml-declaration="no" doctype-
system="http:/mysite.com/dtds/myxml.dtd"/>

This should generate the following:

<?xml version="1.0"?>
<!DOCTYPE PurchaseOrder
SYSTEM "http:/mysite.com/dtds/myxml.dtd">
...
...

Things to remember are that once you have edited the map
file with the text editor, if you open the file and save
it with the Biztalk mapper, you will loose your changes.
Also, when BizTalk generates the output file, it will try
to find the DTD file using the path above. If it can't
find the file or it does not understand the file address,
BizTalk will fail with the following error:

An error occurred in BizTalk Server.

Details:
------------------------------
The XML document could not be translated. The map
specified by reference "<PATH TO BIZTALK MAP>" failed.
Verify that the map is up to date.

The following channel configuration setting is not
valid: "<CHANNEL NAME>"

The server could not finish processing the document.

Hope that helps.. Took me almost a whole day to figure
this out through trial and error... though mostly error.

Marcel.

>-----Original Message-----
>Does anyone know how do I get BizTalk to output a DOCTYPE
>declaration

><!DOCTYPE ... ...>

>and an XML declaration

><? xml version="1.0">

>when producing XML from a flatfile?

>thanks in andvance

>Jo
>.