The W
Views: 95542894
Main | FAQ | Search: Y! / G | Calendar | Color chart | Log in for more!
16.4.14 0837
The W - Internet & Computers - Programming project - advice? Help?
This thread has 5 referrals leading to it
Register and log in to post!
Thread rated: 7.50
Pages: 1
(76 newer) Next thread | Previous thread
User
Post (10 total)
AWArulz
Knackwurst








Since: 28.1.02
From: Louisville, KY

Since last post: 2 days
Last activity: 3 hours
AIM:  
Y!:
#1 Posted on | Instant Rating: 4.73
Early disclaimer - I am a programmer, but high level at best. I work with basic type code and then a block type programming language centered around programming heating and air conditioning control systems. I have done a couple small vba projects in the past within excel, but that has been quite a while back.

OK, here's my project.

I have a directory of zipped up XML files that I have an existing tool download from a system - it automatically places the zipped up XMLs in the directory. The name is drawn from data inside the files. If I unzip one of the files, and edit it, I can locate a certain phrase, which is one of the objects - within that phrase, it links to a phrase/object within one of the other files.

I can open the files, one by one, locate the phrases (and there might be more than one per file) and the targets and build a matrix of phrases and targets that helps us evaluate the entire system. It takes quite a while though. There can be up to 100 files.

I'd like to automate some or all of the process. Not being much of a programmer, my first thought was vba, but I haven't worked in that in some years.

I was wondering if any of The W's had any ideas on this process. Of course, no answers are wrong, I am just online brainstorming.

Thanks



We'll be back right after order has been restored here in the Omni Center.

That the universe was formed by a fortuitous concourse of atoms, I will no more believe than that the accidental jumbling of the alphabet would fall into a most ingenious treatise of philosophy - Swift

Promote this thread!
emma
Cherries > Peaches








Since: 1.8.02
From: Phoenix-ish

Since last post: 21 days
Last activity: 3 hours
#2 Posted on | Instant Rating: 9.71
Sed / awk / grep . But you're going to tell me this is all on a WIndows system, aren't you?
Big G
Morcilla








Since: 21.8.03
From: the people who brought you Steel Magnolias....

Since last post: 10 days
Last activity: 5 hours
#3 Posted on | Instant Rating: 8.15
Assuming Windows
{
If it were me having to complete this, I'd knock something up in .NET to do it. But then, I'm a .NET programmer so that's my answer to most things.

You mention
    Originally posted by AWArulz
    ...build a matrix of phrases and targets...
which I assume is some sort of spreadsheet or similar?

So if it were me, with the tools that I have at my disposal, this is what I'd do.

I would code up the solution as an Office Add-in for Excel (for Example) in Visual Studio.

Reasons:
If your destination state is Excel, then it makes sense that everything is done from there. Coding it as an Add-in means you can fire it from the Add-in tab on the ribbon tool bar.
Coding as a .NET Office Add-in rather than just in VBA makes it easier to access the System.Xml and potentially System.Xml.Serialization namespaces which are powerful and flexible and contain the functionality I would use.

I'd probably also poke something like XML Spy at the files to see if they were uniform, properly formed & whether they used the same schema (unless a schema file is provided/linked)

If you don't have a Visual Studio available, Microsoft do offer a free, cut down version. But I don't think you can make Office Add-ins with it though.

You've also got the VBA option.
A quick look at VBA for Excel (2010) on my PC shows that there are Microsoft XML references available. (eg. c:\Windows\System32\msxml6.dll) I've not used VBA for ages so I don't know how good those libraries are or how they come to be available (ie are they part of Windows, part of Office, or come with something else I installed?).
}
So there you go. Probably no help what so ever.

As an aside, I did something a little similar a while ago. The output of an iPad application was and XML document encoded and embedded within a tag of a parent document. I needed to extract the embedded document and reformat it back to properly formed XML and then use it to create a Work Breakdown Structure within MS-Project. I did it in the manner mentioned above.

Cheers

Guru Zim
SQL Dejection
Administrator








Since: 9.12.01
From: Bay City, OR

Since last post: 13 days
Last activity: 12 hours
AIM:  
#4 Posted on | Instant Rating: 8.69
This sounds like something you could knock out in SSIS in SQL server pretty easily. You'd use the directory as a variable and then change it per location you run this tool at, then have it use a foreach loop using the file name or file type as the input type, and then process the files inside of there.

You could use VBA or VBScript inside of the SSIS package if you wanted to and could just use the foreach and package to make it more portable.




Sign up for Folding@Home and join our team. PM me for details.

Ignorance is bliss for you, hell for me.
AWArulz
Knackwurst








Since: 28.1.02
From: Louisville, KY

Since last post: 2 days
Last activity: 3 hours
AIM:  
Y!:
#5 Posted on | Instant Rating: 4.73
Guru, I can't justify a copy of server on every PC that needs to do this - can I build this process (I still don't quite know how to start) and have the process run on a PC that SQL express or is it a server only process.

Big G - sounds like from your options, maybe the VBA sounds like what I need to look at the most. If I had the full visual studio - could I make it, then distribute to other users as an add in?



We'll be back right after order has been restored here in the Omni Center.

That the universe was formed by a fortuitous concourse of atoms, I will no more believe than that the accidental jumbling of the alphabet would fall into a most ingenious treatise of philosophy - Swift

Big G
Morcilla








Since: 21.8.03
From: the people who brought you Steel Magnolias....

Since last post: 10 days
Last activity: 5 hours
#6 Posted on | Instant Rating: 8.15
Yes, if you have Visual Studio you can deploy your created Add-in for installation on different PC's.

http://msdn.microsoft.com/en-us/library/ff937654.aspx
Guru Zim
SQL Dejection
Administrator








Since: 9.12.01
From: Bay City, OR

Since last post: 13 days
Last activity: 12 hours
AIM:  
#7 Posted on | Instant Rating: 8.69
can you be any more specific about what you need to do? Put a sample of the XML on google docs or something?

You could just use VBScript on any PC and call it using cscript against the .vbs file. You can use a folder as a data source for a FSO and then parse the text of the XML based on substringing.... i've done this before.




Sign up for Folding@Home and join our team. PM me for details.

Ignorance is bliss for you, hell for me.
AWArulz
Knackwurst








Since: 28.1.02
From: Louisville, KY

Since last post: 2 days
Last activity: 3 hours
AIM:  
Y!:
#8 Posted on | Instant Rating: 4.73
The file is here

http://dl.dropbox.com/​​​​u/​​​​35387476/​​​​df.caf.xml

This is the part I need to parse out

- <structElement>               
<BACoid id="2">6009</BACoid> [this information]
</structElement>
- <structElement>
<enum set="509">85</enum> [this information]
</structElement>
- <structElement>
<unsignedShort>65535</unsignedShort>
</structElement>
- <structElement>
<BACoid id="8">1005</BACoid> [and this informmation)
</structElement>


if you quote the message you'll see it. I thought putting stars in front might make it visible in the engine.

{ Changed "<" to "&lt;" - Ed. }

(edited by AWArulz on 27.8.11 0930)

(edited by CRZ on 27.8.11 1336)

We'll be back right after order has been restored here in the Omni Center.

That the universe was formed by a fortuitous concourse of atoms, I will no more believe than that the accidental jumbling of the alphabet would fall into a most ingenious treatise of philosophy - Swift

Guru Zim
SQL Dejection
Administrator








Since: 9.12.01
From: Bay City, OR

Since last post: 13 days
Last activity: 12 hours
AIM:  
#9 Posted on | Instant Rating: 8.69
Yeah, so, this looks really easy to me.

I'll find one of the .vbs that I use at work to read an XML file to find the mailbox ID so that I can put it on the file as a header prior to sending it our VAN.
{ Sorry, you must be logged in to see this text! }

(edited by Guru Zim on 27.8.11 1948)

(edited by Guru Zim on 27.8.11 1948)


Sign up for Folding@Home and join our team. PM me for details.

Ignorance is bliss for you, hell for me.
Guru Zim
SQL Dejection
Administrator








Since: 9.12.01
From: Bay City, OR

Since last post: 13 days
Last activity: 12 hours
AIM:  
#10 Posted on | Instant Rating: 8.69
So copy and paste that, then clean it up. There is a lot of crap in there you don't need.

Essentially, it's reading a source directory for a list of all of the files in the directory. Then, further down, you can see where I am parsing each line in the file looking for certain strings. Use your XML tag name here. I do some stuff with A, B, C which is just me substringing the data to find the opening and closing XML tags and then to grab the data in the middle.

When I'm writing the file, in this case I am adding a header, then putting in the whole file from the priginal, then closing the file out. You probably just need to write out your variables. Google search the FSO commands to append instead of overwriting your file and you can have it parse the whole directory for you.




Sign up for Folding@Home and join our team. PM me for details.

Ignorance is bliss for you, hell for me.
Thread rated: 7.50
Pages: 1
Thread ahead: What should I start studying for this programming application?
Next thread: Free speech analysis software for a Mac?
Previous thread: Steve Jobs Resigns as Apple's CEO
(76 newer) Next thread | Previous thread
Now that everyone has upgraded to 5.13, Secunia has advised us to upgrade to 5.2
The W - Internet & Computers - Programming project - advice? Help?Register and log in to post!

The W™ message board

ZimBoard
©2001-2014 Brothers Zim

This old hunk of junk rendered your page in 0.069 seconds.