Solved

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

Posted on 2011-09-07
5
268 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
ID: 36501052
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
ID: 36501105
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
ID: 36502007
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
ID: 36519421
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
ID: 36519534
welcome
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 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

20 Experts available now in Live!

Get 1:1 Help Now