当前位置:网站首页>Basic application of XMLBean
Basic application of XMLBean
2022-07-30 07:08:00 【victorkevin】
- 根据xml schema生成xml
- Schema文件定义如下:
- xml version="1.0" encoding="UTF-8"?>
- <xs:schema xmlns="http://mydomain.com/myApp" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://mydomain.com/myApp" elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:element name="e1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="e11" type="xs:int"/>
- <xs:element name="e12">
- <xs:complexType>
- <xs:attribute name="e121" type="xs:string" use="required"/>
- <xs:attribute name="e122" type="xs:long"/>
- xs:complexType>
- xs:element>
- xs:sequence>
- xs:complexType>
- xs:element>
- xs:schema>
- 请用xmlBean生成jar包,and write a program to generate onexml文件,其中e11=11 e121=”e121”.
PS:Before entering the following command,Be sure to set the loop variable
命令如下:
Scomp –src build\src –out build\myApp.jar myApp.xsd
如果成功运行,在当前目录下会生成一个myApp.jar文件,然后把它添加到classpath下
- 程序如下:
- 注— Version xmlbeans-2.3.0 The program has been tested successfully
- import com.mydomain.myApp.*;
- import com.mydomain.myApp.impl.*;
- import org.apache.xmlbeans.XmlOptions;
- import java.io.*;
- public class MyAppDemo{
- public static void main(String[] args)throws Exception{
- .E1Document e1Doc=E1Document.Factory.newInstance();
- E1Document.E1 e1=e1Doc.addNewE1();
- e1.setE11(11);
- E1Document.E1.E12 e12=e1.addNewE12();
- e12.setE121("e121");
- File file=new File("myApp.xml");
- e1Doc.save(file);
- }
- }
边栏推荐
- 七、Kotlin基础学习:1、创建类;2、构造函数;3、继承;4、封装;5、抽象类;6、接口;7、嵌套类;8、内部类;9、枚举类
- Twenty-two, Kotlin advanced learning: simply learn RecyclerView to achieve list display;
- Knowledge distillation method of target detection
- Arthas 命令解析(watch/tt/sc)
- SQL Server安装教程
- 十五、Kotlin进阶学习:一、子类与子类型;二、协变;三、逆变;
- MySQL - 多表查询与案例详解
- 【零基础搞定C语言——导航汇总篇】
- 【十年网络安全工程师整理】—100渗透测试工具使用方法介绍
- MySQL - Function and Constraint Commands
猜你喜欢

Servlet基本原理与常见API方法的应用

Trust anchor for certification path not found. Exception solution.

七、Kotlin基础学习:1、创建类;2、构造函数;3、继承;4、封装;5、抽象类;6、接口;7、嵌套类;8、内部类;9、枚举类

MySQL data types and footprint

Using PyQt5 to add an interface to YoloV5 (1)

十七、Kotlin进阶学习:1、守护线程;2、线程和协程之间的效率对比;3、取消协程;

基于R语言地理加权回归、主成分分析、判别分析等空间异质性数据分析

Pytorch(三):可视化工具(Tensorboard、Visdom)

Trust anchor for certification path not found.异常解决方法。

MATLAB怎么在图像中显示nii文件切片信息?
随机推荐
Oracle数据库SQL优化详解
CNN经典模型发展进程
Servlet basic principles and application of common API methods
MySQL 索引优化及失效场景
Function functional interface and application
用pop3收取gmail的邮件
MySQL special statement and optimizer
什么是过拟合、欠拟合现象以及如何缓解?
MySQL - 函数及约束命令
Arthas 命令解析(jvm/thread/stack/heapdump)
Kaggle-M5
XMLBean的基础运用
Trust anchor for certification path not found. Exception solution.
配置MMdetection环境并训练
使用kotlin扩展插件/依赖项简化代码(在最新版本4.0以后,此插件已被弃用,故请选择性学习,以了解为主。)
SQL Server database generation and execution of SQL scripts
Jdbc & Mysql timeout analysis
MySQL - Function and Constraint Commands
二叉树(一):深度优先遍历与广度优先遍历
Jdbc & Mysql timeout分析