|
Home > Archive > BizTalk Server Applications Integration > July 2005 > XML to FLATFILE Serialize via BizTalk 2004 API
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
XML to FLATFILE Serialize via BizTalk 2004 API
|
|
| Andy Young (MCP) 2005-06-02, 7:48 am |
| I am trying to serialize XML data to FLATFILE via the BizTalk API's.
I am shooting blind here in VB.NET and seeking a working example / best
practices advise / resources. Any information will be MUCH appreciated.
Below is the code I use to accomplish the XML => FF conversion, however it
comes back in a weird, indented format. Am I doing this correctly? Is there
a 'more correct' way of accomplishing this?
CODE SNIP:
Dim strBuffer As System.IO.MemoryStream = New System.IO.MemoryStream
objXMLParsedDocument.Save(strBuffer)
strBuffer.Position = 0
Dim reader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(strBuffer)
Dim objBizTalkDocumentSchemaFF As
Microsoft.Biztalk.ParsingEngine.DocumentSchema = New
Microsoft.Biztalk.ParsingEngine.DocumentSchema(objXmlSchemaCollection,
"http:/Summit_HL7_Adapter.HL7_Version_2", New
System.Xml. XmlQualifiedName(objXmlSchemaCollection(
"http:/Summit_HL7_Adapter.HL7_Version_2").TargetNamespace,
objXmlSchemaCollection("http:/Summit_HL7_Adapter.HL7_Version_2").Namespace.ToString))
Dim objBizTalkFFStream As New
Microsoft.Biztalk.SerializingEngine.FFStream(objBizTalkDocumentSchemaFF,
reader)
Dim objBizTalkStream As New System.IO.StreamReader(objBizTalkFFStream)
Dim strBizTalkStreamStringValue As String =
objBizTalkStream.ReadToEnd.ToString
Console.WriteLine(strBizTalkStreamStringValue)
WEIRD FORMATED RESULT:
MSH
|^~\&|
|FACNAME|
|
|2008|
|ADT^A17|ADT.1.412|P|2.3|
|
|
|
|
|
|
|EVN
|A17|208|
|
|
|
|PID
|1|
|258|
|FOO^^^^|
|17|M|^^^^^|
| |
| Deepak Lakshmanan 2005-06-24, 5:54 pm |
| I have done this and to me the code looks good. You might want to check the
FlatFileSchema if you had set properties properly. To verify this you create
a test solution with Send Pipeline (FFAssembler component configuring you FF
schema in that) and test whether you get the same output.
"Andy Young (MCP)" wrote:
> I am trying to serialize XML data to FLATFILE via the BizTalk API's.
>
> I am shooting blind here in VB.NET and seeking a working example / best
> practices advise / resources. Any information will be MUCH appreciated.
>
> Below is the code I use to accomplish the XML => FF conversion, however it
> comes back in a weird, indented format. Am I doing this correctly? Is there
> a 'more correct' way of accomplishing this?
>
> CODE SNIP:
>
> Dim strBuffer As System.IO.MemoryStream = New System.IO.MemoryStream
> objXMLParsedDocument.Save(strBuffer)
>
> strBuffer.Position = 0
> Dim reader As System.Xml.XmlTextReader = New
> System.Xml.XmlTextReader(strBuffer)
> Dim objBizTalkDocumentSchemaFF As
> Microsoft.Biztalk.ParsingEngine.DocumentSchema = New
> Microsoft.Biztalk.ParsingEngine.DocumentSchema(objXmlSchemaCollection,
> "http:/Summit_HL7_Adapter.HL7_Version_2", New
> System.Xml. XmlQualifiedName(objXmlSchemaCollection(
"http:/Summit_HL7_Adapter.HL7_Version_2").TargetNamespace,
> objXmlSchemaCollection("http:/Summit_HL7_Adapter.HL7_Version_2").Namespace.ToString))
> Dim objBizTalkFFStream As New
> Microsoft.Biztalk.SerializingEngine.FFStream(objBizTalkDocumentSchemaFF,
> reader)
> Dim objBizTalkStream As New System.IO.StreamReader(objBizTalkFFStream)
> Dim strBizTalkStreamStringValue As String =
> objBizTalkStream.ReadToEnd.ToString
> Console.WriteLine(strBizTalkStreamStringValue)
>
> WEIRD FORMATED RESULT:
>
> MSH
> |^~\&|
> |FACNAME|
> |
> |2008|
> |ADT^A17|ADT.1.412|P|2.3|
> |
> |
> |
> |
> |
> |
> |EVN
> |A17|208|
> |
> |
> |
> |PID
> |1|
> |258|
> |FOO^^^^|
> |17|M|^^^^^|
>
>
| |
| Andy Young 2005-07-01, 5:54 pm |
| Deepak,
GOOD DEAL!!! Could I beg of you to send along your source?
Thanks,
Andy Young
"Deepak Lakshmanan" wrote:
[vbcol=seagreen]
> I have done this and to me the code looks good. You might want to check the
> FlatFileSchema if you had set properties properly. To verify this you create
> a test solution with Send Pipeline (FFAssembler component configuring you FF
> schema in that) and test whether you get the same output.
>
> "Andy Young (MCP)" wrote:
>
| |
|
|
|
|
|