来自不同 xml 模式的 xml 集成 [英] xml integration from different xml schemas

查看:37
本文介绍了来自不同 xml 模式的 xml 集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将来自不同供应商的产品添加到我的系统中.他们将向我发送他们的 XML 文件,我将整合它们.问题是 XML 文件的架构不同,标签不同,但它们提供相同的信息.我想制作一个通用结构,这样当新的 XML 出现时,我可以轻松地将这些产品添加到我的系统中,只需很少的更改.

I want to add products to my system from different suppliers. They will send me their XML files and i will integrate them. The problem is XML files are schema different and tags are different but they serve the same information. I want to make a generic structure so that when a new XML comes out, i can easily add these products to my system, with few changes.

我的项目是 Asp.net 和编码语言 C#.

My project is Asp.net and coding language C#.

可以做到吗?我应该采取什么方法?

Is it possible to make this? What approach should i take ?

这里是示例 XML 文件

Here are sample XML files

<products>
<prouduct>
    <code>1</code>
    <name>Tshirt</name>
    <price>10</price>
    <stock>5</stock>
    <category>Men > Shirts</category>
    <subproducts>
        <subproduct>
            <groupid>1<groupid>
            <code>12</code>
            <property>Blue L<property>
            <stock>2</stock>
        <subproduct>
        <subproduct>
            <groupid>1<groupid>
            <code>13</code>
            <property>Red S<property>
        <subproduct>
    </subproducts>
</product>
</prouducts>

另一个

<Urunler>
<Urun>
<UrunID>48826</UrunID>
<UrunAdi>PUMA 84075604 CAT LOGO ŞAPKA</UrunAdi>
<Kod>20YU18000010</Kod>
<Fiyat>28.00</Fiyat>
<Stoklar>
    <Stok>
        <Ozellik isim="Color-Size">STANDART STD</Ozellik>
        <Miktar>1</Miktar>
    </Stok>
</Stoklar>
</Urun>
</Urunler>

推荐答案

这是一个非常标准的场景.大多数人使用 XSLT 转换将各种不同的模式转换为一种规范格式,这可能是行业标准,也可能是您自己设计的(或者可能是输入格式之一).您还需要某种消息处理基础设施来控制将不同样式表应用于不同源文档的方式.你可以自己写这个,例如在 XProc 中,或者您可能使用某种框架,例如Cocoon 或 JBoss ESB - 这方面有很多产品,但我并不了解它们.

It's a very standard scenario. Most people use XSLT transformations to convert the variety of different schemas into one canonical format, which might be an industry standard or it might be one you design for yourself (or it might be one of the input formats). You'll also want some kind of message handling infrastructure to control the way different stylesheets are applied to different source documents. You might write this yourself e.g. in XProc, or you might use some kind of framework, e.g. Cocoon or JBoss ESB - there are lots of products in this area and I don't know them all.

这篇关于来自不同 xml 模式的 xml 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆