Welcome to ECF Forum Sign in | Join | Faq

Electronic Court Filing

Started by mgalaty at 07-21-2008 6:39 PM. Topic has 0 replies.

Print Search
Sort Posts:    
   07-21-2008, 6:39 PM
mgalaty is not online. Last active: 6/12/2008 10:59:37 PM mgalaty

Top 10 Posts
Joined on 06-12-2008
Posts 7
Portable Media SIP - some sample conversion code.
Reply Quote

Here's some VB.NET code which demonstrates the XML Serialization/Deserialization of the ECFOperations.XML file which is part of the Portable Media SIP.  This was just an exercise to figure out how to use the VS2005 XSD.EXE program to reverse engineer the XML/XSD which was supplied in the OASIS Specification.  If anyone has any Java classes like this, I'd like to see that code.

 

Imports System.Xml.Serialization

Imports System.io

<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")> _

<System.SerializableAttribute()> _

<System.Diagnostics.DebuggerStepThroughAttribute()> _

<System.ComponentModel.DesignerCategoryAttribute("code")> _

<System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True)> _

<System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)> _

Partial Public Class ECFOperation

Private eCFOperationNameField As String

Private eCFMessageField As ECFOperationECFMessage()

''' <remarks/>

<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _

Public Property ECFOperationName() As String

Get

Return Me.eCFOperationNameField

End Get

Set(ByVal value As String)

Me.eCFOperationNameField = value

End Set

End Property

''' <remarks/>

<System.Xml.Serialization.XmlElementAttribute("ECFMessage", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _

Public Property ECFMessage() As ECFOperationECFMessage()

Get

Return Me.eCFMessageField

End Get

Set(ByVal value As ECFOperationECFMessage())

Me.eCFMessageField = value

End Set

End Property

End Class

''' <remarks/>

<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")> _

<System.SerializableAttribute()> _

<System.Diagnostics.DebuggerStepThroughAttribute()> _

<System.ComponentModel.DesignerCategoryAttribute("code")> _

<System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True)> _

Partial Public Class ECFOperationECFMessage

Private eCFMessageSequenceIDField As String

Private eCFMessageFileNameField As String

''' <remarks/>

<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _

Public Property ECFMessageSequenceID() As String

Get

Return Me.eCFMessageSequenceIDField

End Get

Set(ByVal value As String)

Me.eCFMessageSequenceIDField = value

End Set

End Property

''' <remarks/>

<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _

Public Property ECFMessageFileName() As String

Get

Return Me.eCFMessageFileNameField

End Get

Set(ByVal value As String)

Me.eCFMessageFileNameField = value

End Set

End Property

End Class

''' <remarks/>

<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")> _

<System.SerializableAttribute()> _

<System.Diagnostics.DebuggerStepThroughAttribute()> _

<System.ComponentModel.DesignerCategoryAttribute("code")> _

<System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True)> _

<System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)> _

Partial Public Class NewDataSet

Private itemsField As ECFOperation()

''' <remarks/>

<System.Xml.Serialization.XmlElementAttribute("ECFOperation")> _

Public Property Items() As ECFOperation()

Get

Return Me.itemsField

End Get

Set(ByVal value As ECFOperation())

Me.itemsField = value

End Set

End Property

End Class

 

Public Class testForm

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim serializer As New XmlSerializer(GetType(ECFOperation))

Dim tr As TextReader = New StreamReader("c:\ecf\ECFOperations.xml")

Dim ecfOperation As ECFOperation = DirectCast(serializer.Deserialize(tr), ECFOperation)

Debug.Print(ecfOperation.ECFOperationName)

For Each ecfMessage As ECFOperationECFMessage In ecfOperation.ECFMessage

Debug.Print(ecfMessage.ECFMessageFileName)

Debug.Print(ecfMessage.ECFMessageSequenceID)

Next

End Sub

 

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim srECFOperation As New XmlSerializer(GetType(ECFOperation))

Dim ecfo As New ECFOperation

ecfo.ECFOperationName = "ReviewFiling"

ReDim ecfo.ECFMessage(1)

ecfo.ECFMessage(0) = New ECFOperationECFMessage()

ecfo.ECFMessage(0).ECFMessageFileName = "file1"

ecfo.ECFMessage(0).ECFMessageSequenceID = "1"

ecfo.ECFMessage(1) = New ECFOperationECFMessage()

ecfo.ECFMessage(1).ECFMessageFileName = "file2"

ecfo.ECFMessage(1).ECFMessageSequenceID = "2"

Dim writestream As New StreamWriter("c:\ecf\ecfoperations2.xml")

srECFOperation.Serialize(writestream, ecfo)

End Sub

End Class

 

================

Sample generated file:

<?xml version="1.0" encoding="utf-8"?>
<ECFOperation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ECFOperationName>ReviewFiling</ECFOperationName>
  <ECFMessage>
    <ECFMessageSequenceID>1</ECFMessageSequenceID>
    <ECFMessageFileName>file1</ECFMessageFileName>
  </ECFMessage>
  <ECFMessage>
    <ECFMessageSequenceID>2</ECFMessageSequenceID>
    <ECFMessageFileName>file2</ECFMessageFileName>
  </ECFMessage>
</ECFOperation>

Sample Debug Screen dump:

ReviewFiling

coreFillingMsg

1

caseTypeMsg

2

courtMsg

3

file1.txt

4

 


   Report 
ECF Forum » Administrators » Electronic Cour... » Portable Media SIP - some sample conversion code.

Powered by Community Server, by Telligent Systems