BizTalk Gurus

Removing DTD instruction from inbound xml document

Latest post 10-06-2008 11:13 AM by nickh. 1 replies.
  • 10-01-2008 8:26 AM

    • sidhu
    • Top 25 Contributor
    • Joined on 04-08-2008
    • Posts 71

    Removing DTD instruction from inbound xml document

    I have an xml document incoming to BizTalk which is a DTD compliant. It has an instruction in the top of the document like

    <!DOCTYPE SYSTEM .....

    I prepared the schema for corresponding DTD.

    Now, how can I remove this statement from incoming xml document and change it to a schema instruction before passing to orchestration?

    Please help

     

  • 10-06-2008 11:13 AM In reply to

    • nickh
    • Top 10 Contributor
    • Joined on 03-14-2007
    • Cambridge, UK
    • Posts 215

    Re: Removing DTD instruction from inbound xml document

    Sidhu,

    Take a look at the Microsoft.BizTalk.Streaming namespace (http://technet.microsoft.com/en-us/library/microsoft.biztalk.streaming.aspx), specifically the XmlTranslatorStream (http://technet.microsoft.com/en-us/library/microsoft.biztalk.streaming.xmltranslatorstream.aspx).

    If you extend this class in a decode pipeline component (for example), you can override the TranslateDocType method and strip the DOCTYPE declaration from the incoming message; its a bit fiddly, but it is possible.

    If you want a more low-tech approach, load the Xml Message into a string and remove the DOCTYPE using a find/replace pattern, or stick it through some XSLT that maps back to itself but without the DOCTYPE. Both of these approaches are easily doable, but you will incur a large performance hit with large messages.

    Rgds, Nick.

    --

    Nick Heppleston

    http://www.modhul.com - At the Coalface: A BizTalk Blog

Page 1 of 1 (2 items) | RSS