我想从中生成一个java swing应用程序,我可以在其中生成保存相同数据的xml文件,并且生成的文件数将由用户决定。我的xml文件包含xml架构和我的xml文件结构正在寻找这样java中的xml文件生成器
<transaction>
<xs:schema id="transaction" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="transaction" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="id">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0" />
<xs:element name="sn" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="data">
<xs:complexType>
<xs:sequence>
<xs:element name="dateTime" type="xs:dateTime" minOccurs="0" />
<xs:element name="key" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="productData">
<xs:complexType>
<xs:sequence>
<xs:element name="dateTime" type="xs:dateTime" minOccurs="0" />
<xs:element name="key" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<id>
<name>smith</tli>
<sn>1234567</sn>
</id>
<data>
<dateTime>2011-06-24T17:08:36.3727674+05:30</dateTime>
<key>book</key>
</data>
<productData>
<dateTime>2011-06-24T17:08:36.3727674+05:30</dateTime>
<key>game</key>
</productData>
</transaction>
我在新的java如果有一个人给一些代码斯奈普斯的帮助,这将是对我来说更有帮助。
我想生成XML文件,其中包含我的示例xml中给出的xml架构。
看的dom4j - http://dom4j.sourceforge.net/尝试写一些代码,然后回来,如果你有问题 – 2012-01-14 20:27:12
@GreenDay - 虽然我一直很喜欢的dom4j比JDOM好,除非有特定的需要,我强烈建议坚持使用像JAXP这样的标准API--而不是将代码与dom4j这样的特定实现紧密绑定。 – ziesemer 2012-01-14 20:31:27