Package org.jdom2.input

Examples of org.jdom2.input.SAXBuilder


            throw new IllegalArgumentException("resultsDir must be a directory");

        // Extract from options XML file
        report(0.0, "Loading options file");

        SAXBuilder builder = new SAXBuilder();
        Element rootElement;
        try {
            rootElement = builder.build(optionsFile).getRootElement();
        } catch (JDOMException e) {
            throw new IOException(e);
        }

        OptionsExtractor extractor = new OptionsExtractor();
View Full Code Here


    protected Element rootNode;
    protected String path;

    protected JDOM(String path) {
        this.path = path;
        SAXBuilder sxb = new SAXBuilder();
        try {
            doc = sxb.build(new File(path));
            rootNode = doc.getRootElement();
        } catch (JDOMException ex) {
            doc = new Document(); // Permet lorsque le fichier vient d etre crée
            //Logger.getLogger(JDOM.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
View Full Code Here

                String cleanScmUrl = "not defined";
                try
                {
                    String content = ReleaseUtil.readXmlFile(pomFile, ls);
                    SAXBuilder builder = new SAXBuilder();
                    Document document = builder.build(new StringReader( content ));
                    Element root = document.getRootElement();

                    Element scmElement = root.getChild("scm", getNamespaceOrNull(root));

                    if(null != scmElement)
View Full Code Here

    InputStream messageFormatIS = FoundationLogger.class.getResourceAsStream("/messageFormat.xml");
    if (messageFormatIS == null) {
      logger.debug("file messageformat.xml not found in classpath");
    } else {
      try {
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(messageFormatIS);

        messageFormatIS.close();

        Element rootElement = document.getRootElement();
        List<Element> markers = rootElement.getChildren("marker");
View Full Code Here

            String content = ReleaseUtil.readXmlFile(pomFile, eol);
            // we need to eliminate any extra whitespace inside elements, as JDOM will nuke it
            content = content.replaceAll("<([^!][^>]*?)\\s{2,}([^>]*?)>", "<$1 $2>");
            content = content.replaceAll("(\\s{2,}|[^\\s])/>", "$1 />");

            SAXBuilder builder = new SAXBuilder();
            Document document = builder.build(new StringReader(content));

            // Normalize line endings to platform's style (XML processors like JDOM normalize line endings to "\n" as
            // per section 2.11 of the XML spec)
            normaliseLineEndings(document, eol);

View Full Code Here

        this.representationFactory = representationFactory;
    }

    public ReadableRepresentation read(Reader reader) {
        try {
            Document d = new SAXBuilder().build(reader);
            Element root = d.getRootElement();
            return readRepresentation(root).toImmutableResource();
        } catch (JDOMException e) {
            throw new RepresentationException(e);
        } catch (IOException e) {
View Full Code Here

     */
    @Override
    public List<String> parseResponse(String resource, String requestUrl, Model triples, InputStream in, String contentType) throws DataRetrievalException {
        // build a JDOM document
        try {
            SAXBuilder parser = new SAXBuilder(XMLReaders.NONVALIDATING);
            Document doc = parser.build(in);


            Set<Namespace> namespaces = new HashSet<Namespace>();
            for(Map.Entry<String,String> ns : getNamespaceMappings().entrySet()) {
                namespaces.add(Namespace.getNamespace(ns.getKey(), ns.getValue()));
View Full Code Here

   * @see #createPlayers(Game, Element)
   * @see #createTowers(Game, Element)
   */
  public static void createGame(Game game, String fileName) throws JDOMException, IOException {
   
    SAXBuilder sxb = new SAXBuilder();
   
    // Extraction of the root (normally named "game")
    Document document = sxb.build(new File("files/"+fileName));
    Element root = document.getRootElement();
   
    // Creation of the players from the Element "players"
    Element playersElement = root.getChild("players");
    createPlayers(game, playersElement);
View Full Code Here

   * @throws ErrNotFountOrMistake
   */
  public MissionsReader(String fileName) throws ErrNotFountOrMistake {
    this.fileName = new String(fileName + ".xml");

    SAXBuilder sxb = new SAXBuilder();

    try {
      document = sxb.build(new File(this.fileName));
    } catch (JDOMException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

   * @return The text that the character want to say.
   * @throws ErrNotFountOrMistake
   */
  public String getTextFromCharacter(String firstName, String lastName,
      int textId, int missionId) throws ErrNotFountOrMistake {
    SAXBuilder sxb = new SAXBuilder();

    try {
      document = sxb.build(new File(fileName));
    } catch (JDOMException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of org.jdom2.input.SAXBuilder

Copyright © 2018 www.massapicom. 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.