Package org.dom4j

Examples of org.dom4j.Document.selectSingleNode()


    String linkTarget = computeDirLinkTarget(dirlinkFolder, target);
    SAXReader saxReader = new SAXReader();
    try {
      File dirlinkFile = new File(dirlink.getLocationURI().getPath());
      Document document = saxReader.read(dirlinkFile);
      Element ele = (Element)document.selectSingleNode("/dirlink/path");    //TODO use statics
      ele.addAttribute("location", linkTarget);                //TODO use statics
        XMLWriter output = new XMLWriter(new FileWriter(dirlinkFile));
        try {
          output.write( document );
        } finally {
View Full Code Here


          File catalinaBase = new File(WGADesignerPlugin.getDefault().getStateLocation().toFile(), "tomcat_current");
          File conf = new File(catalinaBase, "conf");
          File serverXML = new File(conf, "server.xml");
          SAXReader reader = new SAXReader();
          Document doc = reader.read(serverXML);
          Element serverElement = (Element) doc.selectSingleNode("/Server");
          String serverPort = serverElement.attributeValue("port", "8005");
          String shutdownCommand = serverElement.attributeValue("shutdown", "SHUTDOWN");
         
          // send shutdown command to specified port
          Socket socket = new Socket();
View Full Code Here

            File componentConfig = new File(componentDir, "component.xml");
            if (componentConfig.exists()) {
                SAXReader saxReader = new SAXReader();
                Document componentXML = saxReader.read(componentConfig);
                ComponentClassLoader classLoader = new ComponentClassLoader(componentDir);
                String className = componentXML.selectSingleNode("/component/class").getText();
                String subdomain = componentXML.selectSingleNode("/component/subdomain").getText();
                //component = (Component)classLoader.loadClass(className).newInstance();
                Class aClass = classLoader.loadClass(className);
                component = (Component)aClass.newInstance();
View Full Code Here

            if (componentConfig.exists()) {
                SAXReader saxReader = new SAXReader();
                Document componentXML = saxReader.read(componentConfig);
                ComponentClassLoader classLoader = new ComponentClassLoader(componentDir);
                String className = componentXML.selectSingleNode("/component/class").getText();
                String subdomain = componentXML.selectSingleNode("/component/subdomain").getText();
                //component = (Component)classLoader.loadClass(className).newInstance();
                Class aClass = classLoader.loadClass(className);
                component = (Component)aClass.newInstance();

                manager.addComponent(subdomain, component);
View Full Code Here

                File webXML = new File(componentDir, "web" + File.separator + "web.xml");
                if (webXML.exists()) {
                    ComponentServlet.registerServlets(this, component, webXML);
                }
                // If there a <adminconsole> section defined, register it.
                Element adminElement = (Element)componentXML.selectSingleNode("/component/adminconsole");
                if (adminElement != null) {
                    // If global images are specified, override their URL.
                    Element imageEl = (Element)adminElement.selectSingleNode(
                            "/component/adminconsole/global/logo-image");
                    if (imageEl != null) {
View Full Code Here

        try {
            File componentConfig = new File(componentDir, "component.xml");
            if (componentConfig.exists()) {
                SAXReader saxReader = new SAXReader();
                Document componentXML = saxReader.read(componentConfig);
                Element element = (Element)componentXML.selectSingleNode(xpath);
                if (element != null) {
                    return element.getTextTrim();
                }
            }
        }
View Full Code Here

    if(inputFile!=null){
      try{
        LOG.debug("Parsing xml transitions file "+inputFile.getAbsolutePath());   
        SAXReader reader = new SAXReader();
        Document document = reader.read(inputFile);
        Node rootNode = document.selectSingleNode("/transitions");
        if(rootNode != null){
          Node defType = rootNode.selectSingleNode("@defaulttype");
          Node defTransDur = rootNode.selectSingleNode("@defaulttduration");
          Node defDur = rootNode.selectSingleNode("@defaultduration");
          if(defType != null && defTransDur != null && defDur != null){
View Full Code Here

      //error reading qti file (existence check was made before)
      throw new AssertException("qti file could not be read " + ((LocalFileImpl)vfsQTI).getBasefile().getAbsolutePath());
    }
    // Extract min, max and cut value
    Float minValue = null, maxValue = null, cutValue = null;
    Element decvar = (Element) doc.selectSingleNode("questestinterop/assessment/outcomes_processing/outcomes/decvar");
    if (decvar != null) {
      Attribute minval = decvar.attribute("minvalue");
      if (minval != null) {
        String mv = minval.getValue();
        try {
View Full Code Here

  public void setUp(AssessmentInstance assessInstance) {
    this.assessInstance = assessInstance;
    init();

    Document el_questestinterop = assessInstance.getResolver().getQTIDocument();
    el_assessment = (Element) el_questestinterop.selectSingleNode("questestinterop/assessment");

    ident = el_assessment.attributeValue("ident");
    title = el_assessment.attributeValue("title");
    Element dur = (Element) el_assessment.selectSingleNode("duration");
View Full Code Here

    //if doc is null an error loading the document occured (IOException, qti.xml does not exist)
    if (doc == null) return;
   

    // extract title
    Element el_assess = (Element)doc.selectSingleNode("questestinterop/assessment");
    String title = el_assess.attributeValue("title");
    if (title != null) addFormElement("qti.title", new StaticTextElement("qti.title", title));
    else addFormElement("qti.title", new StaticTextElement("qti.title", "-"));
   
    // extract objectives
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.