一个XML读写类
能读写任何XML配置文件,能实现用户层面的加解密,以下代码中的B64E函数为加密函数,B64D为解密函数,可以自己编写
生成的XML根节点为ZBS,可以替换为其它有意义的节点名称
Option Explicit
Public xmlDoc As DOMDocument
Public aNode As IXMLDOMElement '当前激活Node
Public xmlFilePath As String, ReadOnly As Boolean '保存路径,只读属性
Private sPassWd As String, sVer As Single
Private sChanged As Boolean
Public Property Get Changed() As Boolean '判断是否修改
Changed = sChanged
End Property
Public Property Let Changed(sValue As Boolean) '手工改动后要设置修改标志
sChanged = sValue
End Property
Public Property Let PassWd(ByVal sValue As String)
If sValue <> "" Then sValue = mG.B64E(sValue, , "32rv415")
If sValue = sPassWd Then Exit Property
Dim ddd As IXMLDOMNode, ddd1 As IXMLDOMNode, ddd2 As IXMLDOMAttribute, ddd3 As Boolean, ddd4 As String
For Each ddd In xmlDoc.selectNodes("//*")
Set ddd2 = ddd.Attributes.getNamedItem("Encode")
If ddd2 Is Nothing Then
ddd3 = True
Else
ddd3 = CBool(ddd2.Text)
End If
If ddd3 Then '需要加解密
For Each ddd1 In ddd.childNodes
If ddd1.nodeType = 3 Then
ddd4 = ddd1.Text
If sPassWd &
相关文档:
在不能上外网的情况下,我们在eclipse中写xml时无法得到标签的提示,因为xml中的dtd获取不到.
看了下外面的资料。说是选择"window"-->"preferences"--->"Myeclipse Enterprise Workbench"-->"Files and Editors"-->"xml"-->"xml category"
在user specified Entries中新增一个. ( ......
/############################################
版权声明:
文章内容为本站编辑,创作.你可以任意转载、发布、使用但请务必以明文标注文章原始出处及本声明
作者:浪淘沙
############################################/
/****************************************************************
* 更新内容: 1,根据父节点 ......
package com.kiloway.trace.utils;
import java.lang.reflect.Field;
/**
* @author Zhang Qi
* @Create Time 2010/01/09
* */
public class ObjectToXML {
public String toString(Object object) throws Exception {
StringBuilder sb = new StringBuilder();
//得到类的名称
String classname = obj ......
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XML文档操作管理器
&nb ......