Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-07
5
Medium Priority
?
275 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
[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
  • 3
5 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 1000 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 1000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

604 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