其他分享
首页 > 其他分享> > 海迅软件板件xml解析及生成

海迅软件板件xml解析及生成

作者:互联网

海迅板件xml解析

1. 文档结构
<?xml version="1.0" encoding="utf-8"?> <Plate> <Bandings> <Banding/> </Bandings> <Holes> <Hole/> </Holes> <Slottings> <Slotting/> </Slottings> <Points> <Point/> </Points> </Plate>
2. Plate板件(板件右上点为坐标原点)
2.1 plateNumber="1" ——数量 2.2 plateNickName="顶板" ——名称 2.3 width="964" ——宽度x 2.4 depth="600" ——深度y 2.5 height="18" ——高度z 2.6 barCode="12211" ——标题? 2.7 barCode1="12211K" ——?
3. Bandling (?)
3.1 bandingFront="1" ——? 3.2 bandingBack="1" ——? 3.3 bandingLeft="1" ——? 3.4 bandingRight="1" ——?
4. Hole孔
4.1 point="(68,649,18)" ——打孔起点的坐标(x,y,z),垂直孔z为(+)厚度,水平孔z为(-)厚度/2 4.2 diameter="15" ——孔的直径 4.3 depth="-14" ——孔的深度,垂直孔为负值,水平孔为正值 4.4 direction="1" ——方向 4.5 positionSide="1" ——所属面 反面垂直孔(direction:-1,positionSide:0) 正面垂直孔(direction:1,positionSide:1) 水平孔(drection:0,positionSide:1) 4.6 drillDirection="(0,0,-1)" ——钻头方向,(0,0,1)朝向正面,(0,0,-1)朝向反面,(0,-1,0)朝上,(0,1,0)朝下,(1,0,0)朝左,(-1,0,0)朝右
5. Slotting槽
5.1 positionSide="1" —— 所属面,1:正面 5.2 slottingStartX="13" —— 槽的起点x值 5.3 slottingStartY="0" —— 槽的起点y值 5.4 slottingStartZ="0" —— 槽的起点z值 5.5 slottingEndX="13" —— 槽的终点x值 5.6 slottingEndY="724" —— 槽的终点y值 5.7 slottingEndZ="0" —— 槽的终点z值 5.8 slottingWidth="6" —— 槽的宽度 5.9 slottingDepth="-7" —— 槽的深度

6. 使用DOM4J方式生成XML文件的步骤如下:
http://blog.csdn.net/u012325167/article/details/50961548

6.1 引入JAR包
6.2 通过DocumentHelper类的createDocument()创建Document对象
6.3 通过Document的addElement()方法创建节点
6.4 通过Element的addAttribute()方法为节点添加属性
6.5 通过Element的setText()方法为节点设置内容
6.6 通过OutputFormat的createPrettyPrint()方法创建OutputFormat对象(会自动缩进、换行)
6.7 创建XMLWriter对象,将目的文件包装成OutputStream传入构造方法中,并将OutputFormat对象一并传入其中
6.8 通过XMLWriter的write()方法生成XML文件,并将Document对象作为参数传入
6.9 关闭XMLWriter对象

在这里插入图片描述

标签:xml,海迅,板件,XMLWriter,direction,OutputFormat,positionSide,Document
来源: https://blog.csdn.net/Amen_Wu/article/details/78921675