XSD到Delphi类没有XML绑定 [英] XSD to Delphi Classes without XML binding

查看:167
本文介绍了XSD到Delphi类没有XML绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能这之前已经被问过了,但是我没有发现Delphi的问题 - 我在Visual Studio中使用了一个XSD.exe:将XSD转换成 'plain vanilla' 表示XSD中指定的实体的类 - 未绑定到XML文档 - 用于在XSD中创建结构的类,不访问符合XSD中概述的结构的数据。

Perhaps this has been asked before, but I haven't found it with regards to Delphi - I have used a XSD.exe in Visual Studio that does exactly this: converts XSD into 'plain vanilla' classes representing the entities specified in the XSD - not bound to XML document - classes for creating the structures in the XSD, not accessing data that conforms to the structure outlined in the XSD.

我正在寻找一个可以做到这一点的实用程序或产品(这不花费大笔钱...):例如,我有一个这样的模式: / p>

I am looking for a utility or product that will do this (that doesn't cost big bucks...) : Example, I have a schema like this:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="TDelphiClass">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="ID"/>
                <xs:element ref="ConnectionString"/>
                <xs:element ref="Group"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="ID" type="xs:integer"/>
    <xs:element name="ConnectionString" type="xs:string"/>
    <xs:element name="Group"type="xs:double"/>
</xs:schema>

我想生成一个如下所示的Delphi单元/类:

I want to generate a Delphi unit/class that looks like this:

unit uDelphiClass;

interface

uses
  Classes, SysUtils;

type
  TDelphiClass = class(TObject)
    fID: Integer;
    fConnectionString: string;
    fGroup: Double;
  end;

implementation

end.


推荐答案

在线之间阅读(请使用较少的缩写,例如, VS具有多重含义,即使在计算中),而您可能使用 XSD.EXE 工具来生成源代码C#或VB.NET语言。

Reading between the lines (please use less abbreviations, for instance, VS has multiple meanings, even in computing), and You probably used the XSD.EXE tool in Visual Studio or the .NET SDK to generate your source code in the C# or VB.NET language.

如果您有 Delphi Prism ,你可以使用XSD.EXE生成Delphi Prism源代码

Delphi Prism语言非常接近到Delphi母语,所以这将给你一个开始。

The Delphi Prism language is very close to the Delphi native language, so that will give you a kick start.

这应该与Delphi Prism试用一样。

This should work with the Delphi Prism trial too.

BTW:为什么不要使用 XML数据绑定向导生成的Delphi本机代码独立的方式?它是基于界面的,但是相当快,效果很好。

BTW: Why do you not want to use the Delphi native code generated by the XML Data Binding Wizard in a standalone way? It is interface based, but is pretty fast and works very well.

这篇关于XSD到Delphi类没有XML绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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