Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jaxb/java在xml中排列元素_Java_Xml_Jaxb - Fatal编程技术网

使用jaxb/java在xml中排列元素

使用jaxb/java在xml中排列元素,java,xml,jaxb,Java,Xml,Jaxb,如何从以下位置重新排列xml元素: - <course> - <CourseType> - <GroupIndex> <index>1</index> <professor>James</professor> </GroupIndex> <classType>Lecture</classType>

如何从以下位置重新排列xml元素:

- <course>
  - <CourseType>
    - <GroupIndex>
         <index>1</index> 
         <professor>James</professor> 
      </GroupIndex>
      <classType>Lecture</classType> 
    </CourseType>
  <courseCode>3000</courseCode> 
 </course>
-
- 
- 
1.
詹姆斯
演讲
3000
致:

-
3000
- 
演讲
- 
1.
詹姆斯
这是关于如何安排它们,使不能展开的元素始终高于可以展开的元素


我在java中使用JAXB编组来转换我的对象以生成xml文件。

在要解组的类中使用比例器应该有助于解决这个问题

e、 g


注意:使用Propoder时,必须将对象中的所有元素添加到Propoder。

我还想引导您访问@BlaiseDoughan的博客,他和他的博客在JaxB相关问题上非常有用。非常感谢!解决了我的问题,这是一个很好的博客。再次感谢你的推荐。
- <course>
    <courseCode>3000</courseCode>
  - <CourseType>
      <classType>Lecture</classType>
    - <GroupIndex>
         <index>1</index> 
         <professor>James</professor> 
      </GroupIndex> 
    </CourseType> 
 </course>
@XmlType(propOrder = {
        "courseCode",
        "CourseType"
    })