Solved

.WMF to XML

Posted on 2004-08-04
13
242 Views
Last Modified: 2010-04-23
Is there a program I can use to make .wmf file into an XML file in then in .NET make the XML back into a .WMF again?
0
Comment
Question by:thenrich
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 4
13 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11722434
Why do you want to do this?  What are you trying to accomplish?  What you describe is not advisable, and there might be a better solution.

Bob
0
 
LVL 8

Expert Comment

by:rfgkev
ID: 11724130
     Private Sub FromXML(ByVal XMLPath As String, ByVal FilePath As String)
            Dim oArray() As Byte
            Dim oStreamReader As System.IO.StreamReader
            Dim oSerialiser As New System.Xml.Serialization.XmlSerializer(GetType(Byte()))
            Dim oFileStream As System.IO.FileStream

            Try
                  oStreamReader = System.IO.File.OpenText(XMLPath)
                  oArray = oSerialiser.Deserialize(oStreamReader)
                  oStreamReader.Close()

                  oFileStream = System.IO.File.Open(FilePath, IO.FileMode.OpenOrCreate)
                  oFileStream.Write(oArray, 0, oArray.Length)
                  oFileStream.Close()
            Catch ex As Exception
                  MsgBox(ex.Message)
            End Try

      End Sub

      Private Sub ToXML(ByVal XMLPath As String, ByVal FilePath As String)
            Dim oArray() As Byte
            Dim oStreamWriter As System.IO.StreamWriter
            Dim oSerialiser As New System.Xml.Serialization.XmlSerializer(GetType(Byte()))
            Dim oFileStream As System.IO.FileStream

            Try
                  oFileStream = System.IO.File.Open(FilePath, IO.FileMode.Open)
                  ReDim oArray(oFileStream.Length - 1)
                  oFileStream.Read(oArray, 0, oFileStream.Length)
                  oFileStream.Close()

                  oStreamWriter = System.IO.File.CreateText(XMLPath)
                  oSerialiser.Serialize(oStreamWriter, oArray)
                  oStreamWriter.Close()
            Catch ex As Exception
                  MsgBox(ex.Message)
            End Try

      End Sub




Call the ToXML sub with the path you want to save the XML to and the file you want to create it from.
Call the FromXML sub with the path of the XML Document and the path you want to save the data to.

Will work for any file type.
0
 
LVL 5

Author Comment

by:thenrich
ID: 11725267
TheLearnedOne,
Why is this not advisable? I'm trying to pass a .wmf file from web-service to web-service?

rfgkev
I'll give'r a try.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 96

Expert Comment

by:Bob Learned
ID: 11725379
The concept is called "XML overhead", and basically is means that serializing binary data adds a lot of information which increases the file size, and reduces bandwidth.  If you are looking for a scalable product, with 1000's of users, then you would tend to avoid it, and move to a strictly binary transmission.

Bob
0
 
LVL 8

Expert Comment

by:rfgkev
ID: 11725419
/agree it more than doubles the file size, so binary transmission would be more resource effective, however if you are using xml web services, this is the way to do it.
0
 
LVL 5

Author Comment

by:thenrich
ID: 11725519
Yea, if you can come up with another way using xml webservices let me know I'll try it.
0
 
LVL 8

Accepted Solution

by:
rfgkev earned 125 total points
ID: 11725686
there is also an easier way,

To send the file, just add a Byte Array parameter to your webservice, and pass it a byte array
To recieve the file, just return a Byte Array from your web service.

All the conversion will be taken care of for you :)
0
 
LVL 5

Author Comment

by:thenrich
ID: 11725765
Really?
0
 
LVL 8

Expert Comment

by:rfgkev
ID: 11725823
yup
0
 
LVL 5

Author Comment

by:thenrich
ID: 11726156
Worked great! Exactly what I was looking for
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11726168
I should have taken the time to give a better explanation:)

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11726172
That's what you get for being swamped with integration testing:)

Bob
0
 
LVL 5

Author Comment

by:thenrich
ID: 11726183
I should have asked my question at a higher also ...
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question