【问题标题】:XML generation in JAVAJAVA中的XML生成
【发布时间】:2018-10-01 16:55:28
【问题描述】:

我有如下架构

<xs:element name="Section">
    <xs:complexType>
        <xs:sequence>
            <xs:element ref="Class" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="WorkSpaceFolder" type="xs:string"></xs:attribute>
        <xs:attribute name="name" type="xs:string"></xs:attribute>
    </xs:complexType>
</xs:element>

但是当我生成 XML 时,我得到了

部分名称="xxxxxx" WorkSpaceFolder="xxxxxx"

但我想要“名称”之前的“WorkSpaceFolder”。

例如部分 WorkSpaceFolder="xxxxxx" name="xxxxxx"

有什么建议吗?

谢谢

【问题讨论】:

标签: java xml xml-schema-collection


【解决方案1】:

请看这个答案

https://stackoverflow.com/a/1682209/4491457

我认为你不能指定元素属性的顺序

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-27
    • 1970-01-01
    • 2018-06-24
    • 2023-04-10
    相关资源
    最近更新 更多