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


C# VTDGen.parse方法代码示例

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


在下文中一共展示了VTDGen.parse方法的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: Main

        static void Main(string[] args)
        {
            try
            {
                int t;
                System.IO.FileInfo f = new System.IO.FileInfo("./soap2.xml");
                System.IO.FileStream fis = 
                    new System.IO.FileStream(f.FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                System.IO.FileInfo f1 = new System.IO.FileInfo("./out.xml");
                System.IO.FileStream fos = new System.IO.FileStream(f1.FullName, System.IO.FileMode.Create);
                byte[] b = new byte[(int)f.Length];
                fis.Read(b, 0, (int)f.Length);
                AutoPilot ap = new AutoPilot();
                ap.declareXPathNameSpace("ns1", "http://www.w3.org/2003/05/soap-envelope");
                // get to the SOAP header
                ap.selectXPath("/ns1:Envelope/ns1:Header/*[@ns1:mustUnderstand]");
                Console.WriteLine("expr string is " + ap.getExprString());
                // instantiate the parser
                VTDGen vg = new VTDGen();
                int j = 0;
                VTDNav vn = null;
                while (j < 10)
                {
                    vg.setDoc_BR(b); // use setDoc_BR (instead of setDoc) to turn on buffer reuse
                    vg.parse(true);  // set namespace awareness to true 
                    vn = vg.getNav();
                    ap.bind(vn); // bind calls resetXPath() so
                    
                    while ((t = ap.evalXPath()) != -1)
                    {

                        Console.WriteLine("j t--> " + j + " " + t);
                        long l = vn.getElementFragment();
                        int len = (int)(l >> 32);
                        int offset = (int)l;
                        fos.Write(b, offset, len); //write the fragment out into out.txt
                        System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("ASCII");
                        byte[] bytes = encoder.GetBytes("\n=========\n");

                        fos.Write(bytes, 0, bytes.Length);
                    }
                    ap.resetXPath();
                    j++;
                }
                j = 0;
                Console.WriteLine("j -->" + j);
                vg.setDoc_BR(b); // use setDoc_BR (instead of setDoc) to turn on buffer reuse
                vg.parse(true);  // set namespace awareness to true 
                vn = vg.getNav();
                ap.bind(vn); // bind calls resetXPath() so
                t =-1;
                while (j < 10)
                {
                    while ((t = ap.evalXPath()) != -1)
                    {
                        Console.WriteLine("j t --> " + j + " " + t);
                        long l = vn.getElementFragment();
                        int len = (int)(l >> 32);
                        int offset = (int)l;
                        fos.Write(b, offset, len); //write the fragment out into out.txt
                        System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("ASCII");
                        byte[] bytes = encoder.GetBytes("\n=========\n");

                        fos.Write(bytes, 0, bytes.Length);
                    }
                    ap.resetXPath();
                    j++;
                }

                fis.Close();
                fos.Close();
            }
            catch (ParseException e)
            {
            }
            catch (NavException e)
            {
            }
            catch (XPathParseException e)
            {
            }
            catch (XPathEvalException e)
            {
            }
            catch (System.IO.IOException e)
            {

            }
        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:89,代码来源:SOAPProcessor2.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.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。