ASP操作XML的类

SAP PO动态参数传递全解析:从Message Mapping函数编写到REST Adapter配置 本文深入解析SAP PO动态参数传递技术,从Message Mapping函数编写到REST Adapter配置的全链路实现。重点介绍DynamicConfiguration API的两种调用方式、版本兼容性陷阱及企业级错误处理机制,帮助开发者高效解决复杂集成场景中的动态参数传递需求。 阅读详情
 ASP操作XML的类的说明:
可以完成ASP对XML节点的添加、删除、修改、清空。
进行上述操作,根据条件,操作类型包括:仅对第一个符合条件、及全部符合条件二种。

如:
'将第一条件值替换成新值
'call xml.r_node("/blog/sorts/sort[id='2']/name","分lei2")
'将全部条件值替换成新值
'call xml.r_nodes("/blog/sorts/sort[id='2']/name","分lei2")
<%
dim xml,xmlfile
xmlfile="/Person/3/7/fls975/blog.xml"
set xml=new QT_XML_Class

Class QT_XML_Class
'Projict : ASP操作XML
'Author : Missde
'Link : www.missde.cn
'Date : 15:25 2007-5-29
private dom,xmlpath,doc
Public iserr_
'初始化类
Private Sub Class_Initialize()
Set dom = Server.CreateObject("Microsoft.FreeThreadedXMLDOM")
xmlpath = Server.MapPath(xmlfile)
If not dom.Load(xmlpath) Then
SaveToFile "<?xml version=""1.0"" encoding=""utf-8""?>"&vbcrlf&"<blog>"&vbcrlf&"<sorts>"&vbcrlf&"</sorts>"&vbcrlf&"<blogs>"&vbcrlf&"</blogs>"&vbcrlf&"<re>"&vbcrlf&"</re>"&vbcrlf&"</blog>",xmlpath
dom.Load(xmlpath)
End If
end Sub

Private Sub Class_Terminate
If IsObject(dom) Then Set dom = Nothing
If IsObject(doc) Then Set doc = Nothing
End Sub

Private Function SaveToFile(ByVal strBody,ByVal SavePath)
dim ado
Set ado = Server.CreateObject("ADODB.Stream")
ado.Open
ado.Type = 2
ado.charset = "utf-8"
ado.WriteText strBody
ado.SaveToFile SavePath,2
ado.Close
Set ado = Nothing
End Function

function d_node(node)
iserr_=False
set doc=dom.documentElement.selectSingleNode(node)
if not doc is nothing then
doc.parentNode.removeChild(doc)
dom.save(xmlpath)
iserr_=True
end if
set doc=nothing
End Function

function d_nodes(node)
dim i
iserr_=False
set doc=dom.selectNodes(node)
if not doc is nothing then
for i=0 to doc.length-1
doc.item(i).parentNode.removeChild(doc.item(i))
next
iserr_=True
end if
dom.save(xmlpath)
set doc=nothing
End Function

function c_node(node)
iserr_=False
set doc=dom.documentElement.selectSingleNode(node)
if not doc is nothing then
doc.text=""
dom.Save(xmlpath)
iserr_=True
end if
set doc=nothing
end function
function c_nodes(node)
dim i
iserr_=False
set doc=dom.selectNodes(node)
if not doc is nothing then
for i=0 to doc.length-1
doc.item(i).text=""
next
dom.Save(xmlpath)
iserr_=True
end if
set doc=nothing
end function


function checknode(nodes,build)
dim doc2,doc3
dim i,f_node_,n_node,newnode
iserr_=True
Set doc = dom.documentElement.selectSingleNode(nodes)
if doc is nothing then
iserr_=False
if build then
nodes=split(nodes,"/")
f_node_=""
n_node=""
for i=0 to ubound(nodes)-1
if nodes(i)="" then
f_node_=f_node_&nodes(i)
f_node_=f_node_&"/"
n_node=f_node_&nodes(i+1)
else
f_node_=n_node
n_node=f_node_&"/"&nodes(i+1)
end if
Set doc2 = dom.documentElement.selectSingleNode(f_node_)
set doc3 = dom.documentElement.selectSingleNode(n_node)
if doc3 is nothing then
Set newnode = dom.createElement(nodes(i+1))
newnode.Text=""
doc2.AppendChild(newnode)
Set newnode=nothing
end if
set doc2=nothing
set doc3=nothing
next
dom.Save(xmlpath)
end if
end if
set doc=nothing
End Function

function joinxml(inset_node,xmlstr)
dim oldxml,newxml,rootNewNode
iserr_=False
Set oldXML = Server.CreateObject("Microsoft.XMLDOM")
oldXML.load(xmlpath)
set doc=oldxml.documentElement.selectSingleNode(inset_node)
if not doc is nothing then
iserr_=True
Set newXML = Server.CreateObject("Microsoft.XMLDOM")
newXML.loadXML(xmlstr&vbcrlf)
set rootNewNode=newXML.documentElement
doc.appendChild(rootNewNode)
oldxml.Save(xmlpath)
end if
set oldXML=nothing
set newXML=nothing
End Function

function r_node(node,newstr)
iserr_=False
set doc=dom.documentElement.selectSingleNode(node)
if not doc is nothing then
doc.text=newstr
iserr_=True
end if
set doc=nothing
dom.Save(xmlpath)
End Function
function r_nodes(node,newstr)
dim i
iserr_=False
set doc=dom.selectNodes(node)
if not doc is nothing then
for i=0 to doc.length-1
doc.item(i).text=newstr
next
iserr_=True
end if
set doc=nothing
dom.Save(xmlpath)
End Function
function replace_node(node,newstr)
call add_node(node,newstr,0)
End Function
function add_node(node,newstr,num)
set doc=dom.selectNodes(node)
if not doc is nothing then
if doc.length >=num then
call d_node(node)
end if
end if
set doc=nothing
call joinxml(left(node,instrrev(node,"/")-1),newstr)
End Function

function f_node(node)
dim getnode
set doc=dom.documentElement.selectSingleNode(node)
if not doc is nothing then
iserr_=True
getnode=doc.Text
else
getnode=""
iserr_=False
end if
set doc=nothing
f_node=getnode
end function

function count(node)
dim nodenum
nodenum=array(0,0,"")
iserr_=False
set doc=dom.selectNodes(node)
if not doc is nothing then
nodenum(0)=doc.length
nodenum(2)=doc.item(0).xml
if doc.item(0).hasChildNodes() then
nodenum(1)=doc.item(0).childNodes.length
end if
iserr_=True
end if
count=nodenum
end function

function id_(str)
id_=String(10-len(str),"0")
end function
function now_(dd)
dim m,d,h,mm
if not isdate(dd) then d=now()
dd=cdate(dd)
m=month(dd)
d=day(dd)
h=hour(dd)
mm=Minute(dd)
if m<10 then m="0"&m
if d<10 then d="0"&d
if h<10 then h="0"&h
if mm<10 then mm="0"&mm
now_=year(dd)&"-"&m&"-"&d&" "&h&":"&mm&":"&Second(dd)
end function
end class
%>
asp 操作 xml 类实例 XML.Class(读增删改+属性读取+附注释) 立即下载

相关推荐

Android11.0系统中适配EC20模块4G及GPS功能

本文主要描述在RK3568Android11中适配EC20模块,启用4G与GPS功能。

yjz_0314的博客 2802

asp操作XML的方法

ASP通过XMLDom在服务器端操作XML文件的主要方法和实现 对于小数据量,xml文件在检索更新上于ACCESS有很多优势。我曾经测试过不用数据库,把网站的会员信息,商品数据信息,交易信息,网站定制信息全部存放在三个xml文件中,运行结果十分正常,感觉上比数据库快多了,不过没有作测试,不能确定。下面说一下创建,查询,修改等对xml操作的主要方法‘创建DOM对象set objDom=s

shaily读书学习 1085

手把手教你用Wireshark抓包分析BLE广播包:从PDU结构到AD Type实战解析

本文详细介绍了如何使用Wireshark工具抓取并分析BLE广播包,从PDU结构到AD Type的实战解析。通过硬件设备选择、软件配置、协议栈解析及高级故障排查,帮助开发者深入理解蓝牙低功耗通信机制,提升物联网设备调试效率。

weixin_30482383的博客 423

asp 创建和读取xml文件

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Xml; using System.Collections; namespace WebAppli

ZhuangLiang 3329

告别Qweb!用ReportBro在Odoo 13-19版本中5步搞定动态报表

本文介绍了如何在Odoo 13-19版本中使用ReportBro替代Qweb快速实现动态报表设计。通过5步集成指南,包括环境准备、前端集成、后端服务搭建等,展示了ReportBro在可视化设计、即时预览和多格式输出(PDF/XLSX)方面的优势,显著提升开发效率和报表灵活性。

mac99的博客 806

Ansys口腔正畸有限元分析:从几何处理到接触设定的全流程解析

本文详细解析了Ansys在口腔正畸有限元分析中的全流程应用,从几何处理到接触设定,帮助医生精准预测牙齿移动趋势。通过有限元建模技术,可同时观察牙齿-牙周膜-牙槽骨的力学响应,显著提升矫治效果预测准确率。文章还分享了实用技巧和参数设置建议,适用于正畸医生和工程师。

weixin_30897233的博客 354

ASP生成XML文件

本文提供一个ASP生成XML文件的一个简单例子,使用XMLDOM创建XML文档,可使用Save方法生成XML文档,使用createElement方法创建XML元素,一般使用createElement创建顶层(根)元素,使用createNode创建子节点(元素),在元素或节点被建立(createElement、createNode)时,其并没有加到文件树中,若要将节点加到文件树中,则需要插入,如appendChild。 <% dim xmlDoc,root,child 'create

kay523393的博客 537

6-Halcon-- var_threshold 函数功能(用于基于局部统计特性的动态阈值分割的算子)

var_threshold 是 HALCON 中用于基于局部统计特性的动态阈值分割的算子,特别适用于处理低对比度图像或纹理均匀但包含细微差异的场景。与 dyn_threshold 不同,它不依赖预处理生成的参考图像,而是直接在局部区域内计算灰度值的统计特性(均值和标准差),从而自适应调整阈值。

weixin_45590420的博客 1329

利用XSLT把ADO记录集转换成XML

利用XSLT把ADO记录集转换成XML孟宪会 由于XML(可扩展标记语言:eXtensible Markup Language)真正的平台无关性,它正在逐渐成为数据传输的主要介质。XML是一种自描述的语言,数据本身就已经包含了元数据,即关于数据本身的信息。例如:“孟子E章1757281793923net_lover1807581793923”这组数据,从字面很难看出它代表什么意思,也不清楚

【孟子E章】 3407

【图像去噪】论文复现:灵感源自MAE!进一步解决BSN的局限性,破坏真实噪声的空间相关性!AMSNet的Pytorch源码复现,跑通源码,原理详解!

论文题目:Asymmetric Mask Scheme for Self-Supervised Real Image Denoising —— 自监督真实图像去噪的非对称掩码方案【图像去噪】论文精读:Asymmetric Mask Scheme for Self-Supervised Real Image Denoising(AMSNet)AMSNet是基于PyTorch Lightning CLI深度学习框架编写的,比较适合复杂的大型任务,复用很方便,但是安装和环境配置问题太多。

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 551

【Microchip】微芯 MPLAB® X IDE开发环境新建项目(点亮1颗LED灯)(常用右键菜单快捷键)

1.新建项目2. 选择芯片型号和调试器3.选择编译器4.项目命名和选择文件路径5.新建成功,给项目添加main.c7.将新建的mainXC16.c文件添加进项目6000000UL这三个就是。

Naiva的博客 461

asp 操作xml

set xml=server.CreateObject("MicroSoft.XMLDom")      xml.load(server.mappath("style.xml"))       if   xml.parseError.errorCode     Response.Write   "xml.parseError.errorCode   =   "   &xml.p

天使的天空 443

09 SAP CPI 访问公共API接口

我在网上找了一个公共API,入参输入汉字返回拼音。至此,一个真正的访问API的接口就做好了。点击保存时可看到红叉报错。

SAP CPI 480

ASP版XML操作类

www.u8686.com-信息发布平台ASP版XML操作类[code]Class XMLClassPrivate objXmlPrivate xmlDocPrivate xmlPath//============================================================Sub Class_initializeSet objXml = Server

mrwu9902的专栏 494

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

[ASP.net(C#)]XML操作类(一)

[ASP.net(C#)]XML操作类(一)  public class XmlControl {  protected string strXmlFile;  protected XmlDocument objXmlDoc = new XmlDocument();  public XmlControl(string XmlFile)  {   //   // TODO: 在這裡加入建構函

斯斯细语 1122

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

ASP对XML的一个操作类

%----------------------------------------------------------------程序简介: 完成asp语言对XML文档中指定节点文本的增加、删除、修改、查看入口参数: 无出口参数: 无------------------------------------------------函数名字:ConnectXml()入口参数: fil

专栏 611

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

asp.net的XML通用操作类

using System;using System.Xml;using System.Data;namespace Message.Common{ /**//// /// XML相关通用功能 /// public class Xml { public

eee365的专栏 3120

asp.net常用操作类之c# xml操作基类cs

/**//********************************************************************************** *  * 功能说明:XML处理基类 *  * *******************************************************************************/using S

cefriend的专栏 1948

asp.net Xml操作类

using System;using System.Xml; namespace WebLayout.App_Code{ public class XmlHelper { public string XmlPath { get; set; } private XmlDocument xmldoc = new XmlDocument(); ...

weixin_30478619的博客 69

asp.net XML操作类

网上收集的;收藏一下;public class XmlControl{protected string strXmlFile;protected XmlDocument objXmlDoc = new XmlDocument();public XmlControl(string XmlFile){//// TODO: 在这里加入建构函式的程序代码//try{objXmlDoc.Load(...

weixin_30381793的博客 68
上一篇: ASP操作XML文件的完整实例
下一篇: asp.net xmlhttp post XML
CodingSir
博客等级 码龄21年 2149粉丝 812原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值