⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 document.java

📁 A framework written in Java for implementing high-level and dynamic languages, compiling them into J
💻 JAVA
字号:
// Copyright (c) 2001, 2002, 2003, 2006  Per M.A. Bothner and Brainfood Inc.// This is free software;  for terms and warranty disclaimer see ./COPYING.package gnu.kawa.xml;import gnu.mapping.*;import gnu.lists.*;import gnu.xml.*;import java.net.URL;import gnu.text.*;/** Implement the XQuery function 'document'. */public class Document{  public static final Document document = new Document();  public static void parse (Object name, Consumer out) throws Throwable  {    SourceMessages messages = new SourceMessages();    if (out instanceof XConsumer)      ((XConsumer) out).beginEntity(name);    gnu.xml.XMLParser.parse(name, messages, out);    if (messages.seenErrors())      throw new SyntaxException("document function read invalid XML",				messages);    if (out instanceof XConsumer)      ((XConsumer) out).endEntity();  }  public static KDocument parse (Object uri) throws Throwable  {    NodeTree doc = new NodeTree();    parse(uri, doc);    return new KDocument(doc, 0);  }  /** Internal namespace used to mange cached documents. */  static String docNamespace = "http://gnu.org/kawa/cached-documents";  public static Object parseCached (Object uri)    throws Throwable  {    Symbol sym = Symbol.make(docNamespace, uri.toString());    Environment env = Environment.getCurrent();    synchronized (sym)      {        NamedLocation loc = env.getLocation(sym, null, true);        Object val = loc.get(null);        if (val != null)          return val;        NodeTree tree = new NodeTree();        SourceMessages messages = new SourceMessages();        tree.beginEntity(uri);        gnu.xml.XMLParser.parse(uri, messages, tree);        if (messages.seenErrors())          throw new SyntaxException("document function read invalid XML",                                    messages);        tree.endEntity();        val = new KDocument(tree, TreeList.BEGIN_ENTITY_SIZE << 1);        loc.set(val);        return val;      }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -