コード例 #1
0
        public static __XDocument Parse(string text)
        {
            var r = default(__XDocument);

            try
            {
                // http://stackoverflow.com/questions/33262/how-do-i-load-an-org-w3c-dom-document-from-xml-in-a-string
                // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6238729

                var f = javax.xml.parsers.DocumentBuilderFactory.newInstance();
                var b = f.newDocumentBuilder();

                var s = new InputSource(new StringReader(text));


                var doc = b.parse(s);

                r = new __XDocument
                {
                    InternalDocument = doc,
                    InternalValue = doc
                };

            }
            catch
            {
                // X:\jsc.svn\examples\java\hybrid\Test\TestJVMCLRXElementParse\TestJVMCLRXElementParse\Program.cs
                // X:\jsc.svn\examples\javascript\LINQ\test\auto\TestSelect\TestAndroidOrderByThenGroupBy\Application.cs

                Console.WriteLine("XDocument Parse error: " + new { text });

                //throw new NotSupportedException();
                throw;
            }

            return r;
        }
コード例 #2
0
        public static __XDocument Parse(string text)
        {
            var r = default(__XDocument);

            try
            {
                // http://stackoverflow.com/questions/33262/how-do-i-load-an-org-w3c-dom-document-from-xml-in-a-string
                // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6238729

                var f = javax.xml.parsers.DocumentBuilderFactory.newInstance();
                var b = f.newDocumentBuilder();

                var s = new InputSource(new StringReader(text));


                var doc = b.parse(s);

                r = new __XDocument
                {
                    InternalDocument = doc,
                    InternalValue    = doc
                };
            }
            catch
            {
                // X:\jsc.svn\examples\java\hybrid\Test\TestJVMCLRXElementParse\TestJVMCLRXElementParse\Program.cs
                // X:\jsc.svn\examples\javascript\LINQ\test\auto\TestSelect\TestAndroidOrderByThenGroupBy\Application.cs

                Console.WriteLine("XDocument Parse error: " + new { text });

                //throw new NotSupportedException();
                throw;
            }

            return(r);
        }