Solved

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

Posted on 2011-09-07
5
269 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xslt copy xml document for each occurance of a repeating node 4 13
C# SQL BULK INSERT CLASS 5 47
Extract XML Data from using TSQL 5 55
Transform XML to Excel using XSL 1 31
The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

773 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