打印SqlInfo的日志信息.
@param nameSpace XML命名空间
@param zealotId XML中的zealotId
@param sqlInfo 要打印的SqlInfo对象
@param hasXml 是否包含xml的打印信息
195494
public void printZealotSqlInfo(SqlInfo sqlInfo, boolean hasXml, String nameSpace, String zealotId) {
        // 如果可以配置的打印SQL信息，且日志级别是info级别,则打印SQL信息.
        if (NormalConfig.getInstance().isPrintSqlInfo()) {
            StringBuilder sb = new StringBuilder(LINE_BREAK);
            sb.append(PRINT_START).append(LINE_BREAK);

            // 如果是xml版本的SQL，则打印xml的相关信息.
            if (hasXml) {
                sb.append("--zealot xml: ").append(XmlContext.INSTANCE.getXmlPathMap().get(nameSpace))
                        .append(" -> ").append(zealotId).append(LINE_BREAK);
            }

            sb.append("-------- SQL: ").append(sqlInfo.getSql()).append(LINE_BREAK)
                    .append("----- Params: ").append(Arrays.toString(sqlInfo.getParamsArr())).append(LINE_BREAK);
            sb.append(PRINT_END).append(LINE_BREAK);
            log.info(sb.toString());
        }
    }
883127
public static String getZealotXmlNameSpace(String xmlPath) {
        Document doc;
        try {
            InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(xmlPath);
            doc = new SAXReader().read(is);
        } catch (Exception expected) {
            // 由于只是判断该文件是否能被正确解析，并不进行正式的解析，所有这里就不抛出和记录异常了.
            log.warn("解析路径为:'" + xmlPath + "'的xml文件出错，请检查其正确性");
            return null;
        }

        // 获取XML文件的根节点，判断其根节点是否为'zealots'，如果是则获取其属性nameSpace的值.
        Node root = doc.getRootElement();
        if (root != null && ROOT_NAME.equals(root.getName())) {
            String nameSpace = getNodeText(root.selectSingleNode(ZealotConst.ATTR_NAMESPACE));
            if (StringHelper.isBlank(nameSpace)) {
                log.warn("zealot xml文件:'" + xmlPath + "'的根节点nameSpace命名空间属性为配置，请配置，否则将被忽略!");
                return null;
            }
            return nameSpace;
        }

        return null;
    }
1109579
@Override
    VoltXMLElement voltGetStatementXML(Session session)
    throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException
    {
        VoltXMLElement xml;
        switch (type) {

        case StatementTypes.INSERT :
            xml = new VoltXMLElement("insert");

            assert(insertExpression != null || queryExpression != null);

            if (queryExpression == null) {
            if (insertExpression.nodes.length > 1) {
                throw new org.hsqldb_voltpatches.HSQLInterface.HSQLParseException(
                    "VoltDB does not support multiple rows in the INSERT statement VALUES clause. Use separate INSERT statements.");
            }
                voltAppendTargetColumns(session, insertColumnMap, insertExpression.nodes[0].nodes, xml);
            } else {
                voltAppendTargetColumns(session, insertColumnMap, null, xml);
                VoltXMLElement child = voltGetXMLExpression(queryExpression, parameters, session);
                xml.children.add(child);
            }
            break;

        case StatementTypes.UPDATE_CURSOR :
        case StatementTypes.UPDATE_WHERE :
            xml = new VoltXMLElement("update");
            voltAppendTargetColumns(session, updateColumnMap, updateExpressions, xml);
            voltAppendChildScans(session, xml);
            voltAppendCondition(session, xml);
            break;

        case StatementTypes.DELETE_CURSOR :
        case StatementTypes.DELETE_WHERE :
            xml = new VoltXMLElement("delete");
            // DELETE has no target columns
            voltAppendChildScans(session, xml);
            voltAppendCondition(session, xml);
            voltAppendSortAndSlice(session, xml);
            break;

        case StatementTypes.MIGRATE_WHERE :
            xml = new VoltXMLElement("migrate");
            voltAppendChildScans(session, xml);
            voltAppendCondition(session, xml);
            break;

        default:
            throw new org.hsqldb_voltpatches.HSQLInterface.HSQLParseException(
                "VoltDB does not support DML statements of type " + type);
        }

        voltAppendParameters(session, xml, parameters);
        xml.attributes.put("table", targetTable.getName().name);
        return xml;
    }
790423
private void loadZealotConfig(AbstractZealotConfig zealotConfig) {
        zealotConfig.configNormal(NormalConfig.getInstance());
        zealotConfig.configXml(XmlContext.INSTANCE);
        zealotConfig.configTagHandler();
        log.warn("Zealot的配置信息加载完成!");
    }
1138225
function (namespaces, defaultNamespace, name) {
    var self = this;

    assert(namespaces);
    assert(name);
    if (/^\{.+\}/.test(name)) {
      return name;
    }
    else if (/:/.test(name)) {
      var parts = name.split(':');
      assert(parts.length === 2, parts);
      if (!namespaces[parts[0]]) {
        throw new xml2js.ValidationError("Unknown namespace " + parts[0] + ", name: " + name + ", known namespaces: " + util.inspect(namespaces, false, null));
      }
      return '{' + namespaces[parts[0]] + '}' + parts[1];
    }
    else if (defaultNamespace) {
      return '{' + defaultNamespace + '}' + name;
    }
    else {
      throw new xml2js.ValidationError("Unqualified name and no default namespace: " + name);
    }
  }
1340647
public static function getFirstElementValueByXpath($node, $xpath_query, $namespaces = array())
    {
        $node = XMLTool :: getFirstElementByXpath($node, $xpath_query, $namespaces);

        if (isset($node))
        {
            return $node->nodeValue;
        }
        else
        {
            return null;
        }
    }
877769
private SqlInfo doBuildSqlInfo(BuildSource source, String valueText) {
        SqlInfo sqlInfo = source.getSqlInfo();
        Node node = source.getNode();
        this.concatSqlText(node, sqlInfo);
        return XmlSqlInfoBuilder.newInstace(source).buildTextSqlParams(valueText);
    }
628346
def namedb_get_num_names_in_namespace( cur, namespace_id, current_block ):
    
    unexpired_query, unexpired_args = namedb_select_where_unexpired_names( current_block )

    query = "SELECT COUNT(name_records.name) FROM name_records JOIN namespaces ON name_records.namespace_id = namespaces.namespace_id WHERE name_records.namespace_id = ? AND " + unexpired_query + " ORDER BY name;"
    args = (namespace_id,) + unexpired_args

    num_rows = namedb_select_count_rows( cur, query, args, count_column='COUNT(name_records.name)' )
    return num_rows
204405
static Logger createLogger(Namespace namespace) {
    String logConfig = namespace.getString("log_config");
    if (logConfig != null) {
      System.setProperty("logback.configurationFile", logConfig);
    }
    System.setProperty("atomix.log.directory", namespace.getString("log_dir"));
    System.setProperty("atomix.log.level", namespace.getString("log_level"));
    System.setProperty("atomix.log.console.level", namespace.getString("console_log_level"));
    System.setProperty("atomix.log.file.level", namespace.getString("file_log_level"));
    return LoggerFactory.getLogger(AtomixAgent.class);
  }
298108
public static Node getNodeBySpaceAndId(String nameSpace, String zealotId) {
        String filePath = XmlContext.INSTANCE.getXmlPathMap().get(nameSpace);
        Document doc = XmlNodeHelper.getDocument(filePath);
        return doc == null ? null : XmlNodeHelper.getZealotNodeById(doc, zealotId);
    }
585915
public static void logSQL(final String logicSQL, final boolean showSimple, final SQLStatement sqlStatement, final Collection<RouteUnit> routeUnits) {
        log("Rule Type: sharding");
        log("Logic SQL: {}", logicSQL);
        log("SQLStatement: {}", sqlStatement);
        if (showSimple) {
            logSimpleMode(routeUnits);
        } else {
            logNormalMode(routeUnits);
        }
    }
932822
function (namespace) {
			var result,
				aNamespaceParts = namespace.split(".");

			if (aNamespaceParts[0] === "Org" && aNamespaceParts[1] === "OData") {
				result = '<a href="' + this.ANNOTATIONS_NAMESPACE_LINK + namespace + '.xml">' + namespace + '</a>';
			} else {
				result = namespace;
			}

			result = this._preProcessLinksInTextBlock(result);
			return result;
		}
1328278
def namedb_get_namespace_ready( cur, namespace_id, include_history=True ):
    

    select_query = "SELECT * FROM namespaces WHERE namespace_id = ? AND op = ?;"
    namespace_rows = namedb_query_execute( cur, select_query, (namespace_id, NAMESPACE_READY))

    namespace_row = namespace_rows.fetchone()
    if namespace_row is None:
        # no such namespace 
        return None 

    namespace = {}
    namespace.update( namespace_row )

    if include_history:
        hist = namedb_get_history( cur, namespace_id )
        namespace['history'] = hist

    namespace = op_decanonicalize('NAMESPACE_READY', namespace)
    return namespace
1196202
private static SqlInfo buildNewSqlInfo(String nameSpace, Node node, Object paramObj) {
        return buildSqlInfo(nameSpace, SqlInfo.newInstance(), node, paramObj);
    }
231491
function (namespace, schemaContent, cb) {
    var self = this;

    if (multivalue.hasValue(self.parsedSchemas, namespace, schemaContent)) {
      cb(null, {});
      return;
    }

    xml2js.parseString(schemaContent, function (err, result) {
      if (err) {
        cb(err);
        return;
      }

      // Only one root element expected
      if (!result || _.size(result) !== 1) {
        cb("Invalid schema for " + namespace + ": " + util.inspect(result, false, null));
        return;
      }

      parseNamespacePrefixes(result, function (err, defaultNamespace, namespaces, xsPrefix) {
        if (err) {
          cb(err);
          return;
        }

        assert(result[xsPrefix + 'schema'], result);

        var schema = result[xsPrefix + 'schema'];

        if (schema.$ && schema.$.targetNamespace && schema.$.targetNamespace !== namespace) {
          cb("Schema does not have expected target namespace " + namespace + ": " + util.inspect(result, false, null));
          return;
        }

        var schemaParser = new XsdSchema(self, namespace, defaultNamespace, namespaces, xsPrefix);

        var importsAndIncludes = schemaParser.parseImportsAndIncludes(namespace, schema);

        var newElements = schemaParser.parseElements(schema, null);
        // TODO: Check if we are overriding anything
        _.extend(self.elements, newElements);

        var newAttributes = schemaParser.parseAttributes(schema);
        // TODO: Check if we are overriding anything
        _.extend(self.attributes, newAttributes);

        var newTypes = schemaParser.parseTypes(schema);
        // TODO: Check if we are overriding anything
        _.extend(self.types, newTypes);

        // TODO: Add support for element and attribute groups
        delete schema[xsPrefix + 'group'];
        delete schema[xsPrefix + 'attributeGroup'];

        // Previous parsing calls are destructive and should consume schema so that it is empty now
        assert(_.isEmpty(schema), schema);

        multivalue.addValue(self.parsedSchemas, namespace, schemaContent);

        cb(null, importsAndIncludes);
      });
    });
  }
344958
public static Node selectSingleNode(Node node, String xpathQuery, Map<String, String> namespaceUris) {
        XPath xpath = DocumentHelper.createXPath(xpathQuery);
        xpath.setNamespaceURIs(namespaceUris);

        return xpath.selectSingleNode(node);
    }
665510
public Hashtable<String,List<Other>> attributesWithNamespace(String namespace) {


        Hashtable<String,List<Other>> result=namespaceIndex.get(namespace);
        if (result==null) {
            result=new Hashtable<String,List<Other>>();
            namespaceIndex.put(namespace,result);
        }

        for (Other attribute: attributes) {
            
            QualifiedName name=attribute.getElementName();
            if (namespace.equals(name.getNamespaceURI())) {
                List<Other> ll=result.get(name.getLocalPart());
                if (ll==null) {
                    List<Other> tmp=new LinkedList<Other>();
                    tmp.add(attribute);
                    result.put(name.getLocalPart(),tmp);
                } else {
                    ll.add(attribute);                        
                }
            }
        }
        return result;
    }