XMLDLL操作说明文档(三)

来源:互联网 发布:java什么是进程和线程 编辑:程序博客网 时间:2024/06/03 23:31
  ''//*创建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
原创粉丝点击