Solved

Automation of re-formating from XML to XML???

Posted on 2011-09-07
5
265 Views
Last Modified: 2012-05-12
I have a new server which process data entry through XML files that it recieves attached with an email.  The problem is that some of my clients system shoot me and xml with different tag names and different format.  Anyone know of a software that i can setup a XML template and filter clients xml with this software so i can spit out their information in the format that my system needs... all automated would be great since we are looking at processing about 6500 xmls in the span of a year.

Ex.
FROM CLIENT
<cliente>
<noparte>partnumber</noparte>
<provedor>Provider</provedor>
</cliente>

NEEDS TO BE FORMATED AUTOMATICALLY TO
<client>
<partNumber>partnumber</partNumber>
<provider>Provider</Provider>
<otherFields>Defaulted value of template</otherFields>
</client>

Hopefully i make sense... Clients xml is in spanish and i need to designate them to the english version and then some fields arent present in the clients xml which i would like to add the through with some type of template.
0
Comment
Question by:Osram34
  • 3
5 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 250 total points
Comment Utility
The easiest way to deal with such a templated approach is using XSLT.

I have attached an XSLT that does exactly this for you
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:output indent="yes"/>
    <xsl:strip-space elements="*"/>
    <xsl:template match="node()">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="cliente">
        <xsl:element name="client">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
            <xsl:element name="otherFields">
                <xsl:text>Defaulted value of template</xsl:text>
            </xsl:element>
        </xsl:element>
    </xsl:template>
    <xsl:template match="noparte">
        <xsl:element name="partNumber">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>
    <xsl:template match="provedor">
        <xsl:element name="provider">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>

Open in new window

0
 
LVL 60

Expert Comment

by:Geert Bormans
Comment Utility
Your next task is to write a progam that scans the POP3 server (or whatever)
extract the XML from the mail message
and transforms using the XSLT

That should not be hard to do.
All depends on the programming infrastructure you want to use
If you want to do this in batch mode, you could use python or ruby I guess
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 250 total points
Comment Utility
Mapforce allow you to easily create a program doing the conversion after doing the mapping
the interface is pretty cool to use and you should be able to generate your first code in 1 hour.
there's a demo on the site, check it.

additionaly check this tools allowing you to really automate the processes:
http://www.opensyncro.org/
https://www.openadaptor.org/
0
 

Author Closing Comment

by:Osram34
Comment Utility
Two good answers just havent had time to even start on that project but u all helped a ton thanks
0
 
LVL 60

Expert Comment

by:Geert Bormans
Comment Utility
welcome
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now