private void initPack (InvarPackage pack, TokenNode node, InvarContext ctx) throws Exception
    {
        int len = node.numChildren();
        for (int i = 0; i < len; i++)
        {
            TokenNode n = node.getChild(i);
            String alias = getAttrOptional(n, "alias");
            if (!alias.equals("") && ctx.aliasGet(alias) != null)
            {
                throw new Exception(error(n, "Repeated alias: " + alias));
            }
            if (n.getName().equals("enum"))
            {
                String name = getAttr(n, "name");
                String comment = getAttrOptional(n, "doc");
                TypeEnum t = new TypeEnum(name, pack, comment);
                addToPack(pack, t, n);
                if (alias.equals(""))
                {
                    t.setAlias(name);
                    ctx.aliasAdd(t);
                }
                enumNodes.put(n, t);
            }
            else if (n.getName().equals("struct"))
            {
                String name = getAttr(n, "name");
                String comment = getAttrOptional(n, "doc");
                TypeStruct t = new TypeStruct(name, pack, comment);
                addToPack(pack, t, n);
                if (alias.equals(""))
                {
                    t.setAlias(name);
                    ctx.aliasAdd(t);
                }
                structNodes.put(n, t);
                t.setShortField(getAttrOptional(n, "short"));
            }
            else if (n.getName().equals("protoc"))
            {
                String name = getAttr(n, "name");
                String comment = getAttrOptional(n, "doc");
                TypeProtocol t = new TypeProtocol(name, pack, comment);
                addToPack(pack, t, n);
                protocNodes.put(n, t);
            }
            else
            {
                warn(n, "Unexpected XML node. It has been ignorned: ");
            }
        }
    }