闭月羞花猫

陆杨的Blog

  CSDN |  技术中心 |  BLOG首页 |  我的首页 |  我的文章 |  我的空间 |  联系作者 |  搜索 |  写文章
  26篇原创: 0篇翻译: 6篇转载: 6918次点击: 4个评论: 0个Trackbacks

公告


我的简历

订阅博客

  • XML聚合  FeedSky
  • 订阅到鲜果
  • 订阅到Google
  • 订阅到抓虾
  • 订阅到BlogLines
  • 订阅到Yahoo
  • 订阅到GouGou
  • 订阅到飞鸽
  • 订阅到Rojo
  • 订阅到newsgator
  • 订阅到netvibes

文章

收藏

相册

存档

最近评论



上一篇: [java日期处理]得到某个月的最后一天或者下个月的第一天(yyyymmdd) | 下一篇: 2006年底个人总结(好像是快过年前两天写的)

excel 格式:(省略)


=========================================================

程序:


Dim SRC_HEAD As String
Dim SRC_TAIL As String

Sub createSource()

    ' 选择的sheet
    Sheets("Sheet1").Select
   
    HEAD
   
    TAIL

    ' xm的位置
    Dim srcFile As String
    srcFile = ActiveWorkbook.Path & "\" & "AAA.xml"
   
    ' 开始行
    GYO = 3

    ' 内容
    Dim content As String

    content = ""

    Do While True
        If (Cells(GYO, 7).Value = "") Then
            Exit Do
        Else
        content = content & "  <cp-mapping>" + vbCrLf
       
        content = content & "    <cp-code>" & Cells(GYO, 7).Value & "</cp-code>" & vbCrLf

           content = content & "    <controller-class operation-code=""300"">jp.co.jip.trb.client.ju." _
                     & Cells(GYO, 17).Value & "." _
                     & Cells(GYO, 18).Value & "." _
                     & Cells(GYO, 19).Value & "." _
                     & "JU0S6" & Cells(GYO, 7).Value & "1McoFacade</controller-class>" & vbCrLf

           content = content & "    <display-class>jp.co.jip.trb.client.ju." _
                     & Cells(GYO, 17).Value & "." _
                     & Cells(GYO, 18).Value & "." _
                     & Cells(GYO, 19).Value & "." _
                     & "JU0S6" & Cells(GYO, 7).Value & "1McoFacade.INIT_FROM_JU0S610200</display-class>" & vbCrLf
           content = content & "  </cp-mapping>" & vbCrLf & vbCrLf

        End If
        GYO = GYO + 1
    Loop
   
createSourceFile srcFile, SRC_HEAD & content & SRC_TAIL


MsgBox "Ceate Message OK !"
End Sub

=====================================================================================================
Sub createSourceFile(fileName, fileContent)
    On Error GoTo ERR_CREATE
 
    Open fileName For Output As #1
   
    Print #1, fileContent
   
    Close #1
    
    Exit Sub
ERR_CREATE:
     MsgBox "错误:" & Error(Err.Number) & "(文件:" & fileName & "发现不到)"

End Sub


Function HEAD()
    SRC_HEAD = ""
    SRC_HEAD = SRC_HEAD & "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf
    SRC_HEAD = SRC_HEAD & " <nxml>" & vbCrLf
    SRC_HEAD = SRC_HEAD & "  <mode>" & vbCrLf
    SRC_HEAD = SRC_HEAD & "   <real-mode>" & vbCrLf
    SRC_HEAD = SRC_HEAD & "    <operation-code>100</operation-code>" & vbCrLf
    SRC_HEAD = SRC_HEAD & "    <operation-code>110</operation-code>" & vbCrLf
    SRC_HEAD = SRC_HEAD & "     <operation-code>120</operation-code>" & vbCrLf
    SRC_HEAD = SRC_HEAD & "    </real-mode>" & vbCrLf
    SRC_HEAD = SRC_HEAD & "  </mode>" & vbCrLf
End Function

Function TAIL()

    SRC_TAIL = ""
    SRC_TAIL = SRC_TAIL & " </nxml>" & vbCrLf
End Function

// ====================生成的xml结构如下==========================================================================
<?xml version="1.0" encoding="UTF-8"?>
 <nxml>
  <mode>
   <real-mode>
    <operation-code>100</operation-code>
    <operation-code>110</operation-code>
     <operation-code>120</operation-code>
    </real-mode>
  </mode>
  <cp-mapping>
    <cp-code>A010</cp-code>
    <controller-class operation-code="300">jp.co.jip.trb.client.ju.checkpoint.model.a010jutaku.JU0S6A0101McoFacade</controller-class>
    <display-class>jp.co.jip.trb.client.ju.checkpoint.model.a010jutaku.JU0S6A0101McoFacade.INIT_FROM_JU0S610200</display-class>
  </cp-mapping>

  <cp-mapping>
    <cp-code>A020</cp-code>
    <controller-class operation-code="300">jp.co.jip.trb.client.ju.checkpoint.model.a020mutan.JU0S6A0201McoFacade</controller-class>
    <display-class>jp.co.jip.trb.client.ju.checkpoint.model.a020mutan.JU0S6A0201McoFacade.INIT_FROM_JU0S610200</display-class>
  </cp-mapping>
 
。。。。。。。。。。

 </nxml>


 
   
     
    
  
  

 



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1534245


[收藏到我的网摘]   [发送Trackback]  闭月羞花猫发表于 2007年03月19日 22:21:00




上一篇: [java日期处理]得到某个月的最后一天或者下个月的第一天(yyyymmdd) | 下一篇: 2006年底个人总结(好像是快过年前两天写的)

评论

没有评论。

发表评论

大名:
网址:
校验码: 看不清,换一张
评论 
   
当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录