当前位置: 首页>>代码示例>>C#>>正文


C# VTDGen.setDoc方法代码示例

本文整理汇总了C#中com.ximpleware.VTDGen.setDoc方法的典型用法代码示例。如果您正苦于以下问题:C# VTDGen.setDoc方法的具体用法?C# VTDGen.setDoc怎么用?C# VTDGen.setDoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ximpleware.VTDGen的用法示例。


在下文中一共展示了VTDGen.setDoc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: parseString

        public static VTDNav parseString(String s)
        {
            VTDGen vg = new VTDGen();
            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();

            vg.setDoc(encoding.GetBytes(s));

            vg.parse(true);

            return vg.getNav();
        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:11,代码来源:Program.cs

示例2: Main

        static void Main(string[] args)
        {
            	VTDGen vg = new VTDGen();
		        vg.setDoc(getBytes("<root>good</root>"));
		        vg.parse(true);
		        VTDNav vn = vg.getNav();
		        int i=vn.getText();
		        //print "good"
		        Console.WriteLine("text ---> "+vn.toString(i));
		        if (vn.overWrite(i,getBytes("bad"))){
			        //overwrite, if successful, returns true
			        //print "bad" here 
			         Console.WriteLine("text ---> "+vn.toString(i));
		        }
        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:15,代码来源:Overwrite.cs

示例3: Main

        public static void Main(String[] args)
        {

            String xml = "<aaaa> <bbbbb> <ccccc> </ccccc> <ccccc/> <ccccc></ccccc> </bbbbb> </aaaa>";
            Encoding eg = Encoding.GetEncoding("utf-8");
            VTDGen vg = new VTDGen();
            vg.setDoc(eg.GetBytes(xml));
            vg.parse(false);
            VTDNav vn = vg.getNav();
            AutoPilot ap = new AutoPilot(vn);
            ap.selectXPath("//*");
            XMLModifier xm = new XMLModifier(vn);
            while (ap.evalXPath() != -1)
            {
                xm.updateElementName("d:/lalalala");
            }
            xm.output("lala.xml");
        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:18,代码来源:changeElementName.cs

示例4: readSeparateIndex

        public static void readSeparateIndex(System.IO.Stream index, System.IO.Stream XMLBytes, int XMLSize, VTDGen vg)
        {
            if (index == null || vg == null || XMLBytes == null)
            {
                throw new System.ArgumentException("Invalid argument(s) for readIndex()");
            }
            //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' 
            //which has a different behavior. 
            //"ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
            System.IO.BinaryReader dis = new System.IO.BinaryReader(index);
            byte b = dis.ReadByte(); // first byte
            // no check on version number for now
            // second byte
            vg.encoding = dis.ReadByte();
            int intLongSwitch;
            int endian;
            // third byte
            b = dis.ReadByte();
            if ((b & 0x80) != 0)
                intLongSwitch = 1;
            //use ints
            else
                intLongSwitch = 0;
            if ((b & 0x40) != 0)
                vg.ns = true;
            else
                vg.ns = false;
            if ((b & 0x20) != 0)
                endian = 1;
            else
                endian = 0;
            if ((b & 0x1f) != 0)
                throw new IndexReadException("Last 5 bits of the third byte should be zero");

            // fourth byte
            vg.VTDDepth = dis.ReadByte();

            // 5th and 6th byte
            int LCLevel = (((int)dis.ReadByte()) << 8) | dis.ReadByte();
            if (LCLevel != 4 && LCLevel != 6)
            {
                throw new IndexReadException("LC levels must be at least 3");
            }
            // 7th and 8th byte
            vg.rootIndex = (((int)dis.ReadByte()) << 8) | dis.ReadByte();

            // skip a long
            dis.ReadInt64();
            //Console.WriteLine(" l ==>" + l);
            dis.ReadInt64();
            //Console.WriteLine(" l ==>" + l);
            long l = dis.ReadInt64();

            int size;
            // read XML size
            if (BitConverter.IsLittleEndian && endian == 0
                || BitConverter.IsLittleEndian == false && endian == 1)
                size = (int)l;
            else
                size = (int)reverseLong(l);


            // read XML bytes
            byte[] XMLDoc = new byte[size];
            XMLBytes.Read(XMLDoc, 0, size);

            //dis.Read(XMLDoc, 0, size);
            /*if ((size & 0x7) != 0)
            {
                int t = (((size >> 3) + 1) << 3) - size;
                while (t > 0)
                {
                    dis.ReadByte();
                    t--;
                }
            }*/

            vg.setDoc(XMLDoc);
            // skip a long
            dis.ReadInt64();
            //Console.WriteLine(" l ==>" + l);
            dis.ReadInt64();
            //Console.WriteLine(" l ==>" + l);
            if (BitConverter.IsLittleEndian && endian == 0
                || BitConverter.IsLittleEndian == false && endian == 1)
            {
                // read vtd records
                int vtdSize = (int)dis.ReadInt64();
                while (vtdSize > 0)
                {
                    vg.VTDBuffer.append(dis.ReadInt64());
                    vtdSize--;
                }
                // read L1 LC records
                int l1Size = (int)dis.ReadInt64();
                while (l1Size > 0)
                {
                    vg.l1Buffer.append(dis.ReadInt64());
                    l1Size--;
                }
//.........这里部分代码省略.........
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:101,代码来源:IndexHandler.cs

示例5: outputAndReparse

 public VTDNav outputAndReparse()
 {
     XMLByteStream xbos = new XMLByteStream(getUpdatedDocumentSize());
     output(xbos);
     VTDGen vg = new VTDGen();
     vg.setDoc(xbos.getXML());
     vg.parse(this.md.ns);
     return vg.getNav();
 }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:9,代码来源:XMLModifier.cs


注:本文中的com.ximpleware.VTDGen.setDoc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。