XMLDLL操作说明文档(三)

  ''//*创建XMLDLL文档示例
        'Dim m_xmldll As New XMLDLL.XMLDLL()
        ''m_xmldll.CreateXmlFile("d:\test1.xml", "utf-8", "Envelope", "SOAP-ENV", "", "http://schemas.xmlsoap.org/soap/envelope/")
        'm_xmldll.CreateXmlFile("d:\test1.xml", System.Text.Encoding.UTF8, "Envelope", "SOAP-ENV", "", "http://schemas.xmlsoap.org/soap/envelope/")
        ''*//
        Dim m_xmldoc As New System.Xml.XmlDocument
        Dim m_attribute(2) As Xml.XmlAttribute
        m_attribute(0) = m_xmldoc.CreateAttribute("SOAP-ENC")
        m_attribute(0).Value = "http://schemas.xmlsoap.org/soap/encodings/"
        m_attribute(1) = m_xmldoc.CreateAttribute("xmlns:xsi")
        m_attribute(1).Value = "http://www.w4.org/2001/XMLSchema-instance"
        m_attribute(2) = m_xmldoc.CreateAttribute("xsd")
        m_attribute(2).Value = "http://www.w3.org/2001/XMLSchema"
        'Dim m_attribute1(0) As Xml.XmlAttribute
        'm_attribute1(0) = m_xmldoc.CreateAttribute("xmlns:m")
        'm_attribute1(0).Value = "http://webservice.clini.org/"
       
        Dim nt As New Xml.NameTable
        Dim m_xmldll As New mydll("d:\test1.xml")
        Dim nsmgr As New Xml.XmlNamespaceManager(nt)
        nsmgr.AddNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/")
        nsmgr.AddNamespace("m", "http://webservice.clini.org/")
        'Dim nsmgr1 As New Xml.XmlNamespaceManager(nt)
        'nsmgr.AddNamespace("m", "tttt")
        '//增加节点属性值
        'm_xmldll.Add_XML_Attribute("d:\test1.xml", "SOAP-ENV:Envelope", m_attribute, "", nsmgr)
        '//设置节点属性值
        'm_xmldll.Set_XMLnode_Attrib_Value("d:\test1.xml", "SOAP-ENV:Envelope", "xmlns:SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/1", "", nsmgr)
        '//得到节点属性值
        'Dim ss As String = m_xmldll.Get_XMLnode_Attrib_Value("d:\test1.xml", "SOAP-ENV:Envelope", "xmlns:SOAP-ENV", , nsmgr)
        'MessageBox.Show(ss)
        '//删除节点属性
        'm_xmldll.Remove_XMLnode_Attribute("d:\test1.xml", "SOAP-ENV:Envelope", , "xmlns:xsi", nsmgr)
        '元素带前缀的命名空间不允许删除

    
        '//增加节点元素
        'm_xmldll.Add_XML_Element("d:\test1.xml", "SOAP-ENV:Envelope", "Body", , , "", nsmgr)
        'm_xmldll.Add_XML_Element("d:\test1.xml", "Body", "getInHospType", , "m", "http://webservice.clini.org/", nsmgr)
        'm_xmldll.Add_XML_Element("d:\test1.xml", "m:getInHospType", "arg0", , , , nsmgr)
        'm_xmldll.Add_XML_Element("d:\test1.xml", "arg0", "areaId")
        'm_xmldll.Add_XML_Element("d:\test1.xml", "arg0", "inType")
        'm_xmldll.Add_XML_Element("d:\test1.xml", "arg0", "Remark1", "备注1")
        'm_xmldll.Add_XML_Element("d:\test1.xml", "arg0", "Remark2", "备注2")
        'XML规范:有前缀,必须有命名空间;无前缀,可以有命名空间,但无法使用
        '//删除节点元素
        'm_xmldll.Remove_XMLnode("d:\test1.xml", "Remark2", "arg0")
        'm_xmldll.Remove_XMLnode("d:\test1.xml", "m:getInHospType", , nsmgr)
        'm_xmldll.Remove_XMLnode("d:\test1.xml", "Body", , nsmgr)
        '//得到节点元素值
        'Dim sss As String = m_xmldll.Get_XMLnode_Value("d:\test1.xml", "Remark1", "arg0")
        'MessageBox.Show(sss)
        '//设置节点元素值
        'm_xmldll.Set_XMLnode_Value("d:\test1.xml", "Remark1", "备注me1")


        'm_xmldll.Add_XML_Element("d:\test1.xml", "Body", "m", "getInHospType", , Nothing, nsmgr)

        'm_xmldll.Remove_XMLnode_Attribute("d:\test1.xml", "m:getInHospType", "Body", , nsmgr)

        'm_xmldll.Remove_XMLnode_namespace("d:\test1.xml", "m:getInHospType", "Body", , nsmgr)

        'm_xmldll.Add_XML_Attribute("d:\test1.xml", "SOAP-ENV:Envelope", my_attribute.Name, "ccc")

        'm_xmldll.Add_XML_Attribute("d:\test1.xml", "body", Nothing, "", nsmgr)

        'm_xmldll.Add_XML_Element("d:\test1.xml", "SOAP-ENV:Envelope", "Body", "SOAP-ENV", "", Nothing, nsmgr)
        'm_xmldll.Add_XML_Element("d:\test1.xml", "SOAP-ENV:Body", "getInHospType", "m", "", "http://webservice.clini.org/", Nothing, nsmgr)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值