Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 240:648df7d29d13 Implementation_of_communication
commandline inport
author | tatsuki |
---|---|
date | Mon, 15 Feb 2016 00:47:19 +0900 |
parents | 2fc1c4f19c02 |
children | 5a301161e36a |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/commandline.java |
diffstat | 1 files changed, 21 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/commandline.java Mon Feb 15 00:36:26 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/commandline.java Mon Feb 15 00:47:19 2016 +0900 @@ -28,9 +28,6 @@ Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); public void start() throws IOException { - //テストxmlの読み込み 後で消す - JungleTree tree = jungle.createNewTree("XMLTEST"); - new XmlReader().start("/Users/e115731/workspace/jungle-core/xml/drink.xml", tree); System.out.println("jungle 対話モード"); while (true) { System.out.println("入力受付中"); @@ -76,10 +73,31 @@ case "update"://attribute等のupdate treeName path <Path> keys key values attribute update(iterator); break; + case "inport"://attribute等のupdate treeName path <Path> keys key values attribute + inport(iterator); //xmlをinportする inport treeName xmlまでの絶対path + break; } } } + private void inport(Iterator<String> iterator) { + //テストxmlの読み込み 後で消す + String treeName = ""; + String path = ""; + if (iterator.hasNext()) + treeName = iterator.next(); + if (iterator.hasNext()) + path = iterator.next(); + if (treeName.equals("") || path.equals("")) { + System.out.println("faild"); + return; + } + JungleTree tree = jungle.createNewTree(treeName); + if (tree == null) + tree = jungle.getTreeByName(treeName); + new XmlReader().start(path, tree); + } + private void update(Iterator<String> iterator) { { DefaultNodePath path = new DefaultNodePath();