Package org.jdom2.input

Examples of org.jdom2.input.StAXStreamBuilder.build()


  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


        XMLOutputter xmlOutput = new XMLOutputter();
        // display nice nice
        xmlOutput.setFormat(Format.getPrettyFormat());

        //parse the document
        Document doc = parser.build(originalPomFile);
        Element versionElem = findVersionElement(doc);
        versionElem.setText(newVersion);
        xmlOutput.output(doc, writer);
        writer.flush();
        writer.close();
View Full Code Here

   * Parse entry from reader.
   */
  public static Entry parseEntry(Reader rd, String baseURI) throws JDOMException, IOException, IllegalArgumentException, FeedException {
    // Parse entry into JDOM tree
    SAXBuilder builder = new SAXBuilder();
    Document entryDoc = builder.build(rd);
    Element fetchedEntryElement = entryDoc.getRootElement();
    fetchedEntryElement.detach();

    // Put entry into a JDOM document with 'feed' root so that Rome can handle it
    Feed feed = new Feed();
View Full Code Here

    saxBuilder.setJDOMFactory(locatedJDOMFactory);
   
    final MavenProject mavenProject = (MavenProject) models.get(MAVEN_PROJECT);
   
    try {
      Document document = saxBuilder.build(mavenProject.getFile());
      return document;
    } catch (JDOMException e) {
      throw new RuntimeException("Unable to build JDOM2 model", e);
    } catch (IOException e) {
      throw new RuntimeException("Unable to build JDOM2 model", e);
View Full Code Here

    @Override
    public List<String> parseResponse(String resource, String requestUrl, Repository 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

                tmpDocString.append("</tmpdoc>");
                StringReader tmpDocReader = new StringReader(tmpDocString.toString());
                Document tmpDoc;
                try {
                    SAXBuilder saxBuilder = new SAXBuilder();
                    tmpDoc = saxBuilder.build(tmpDocReader);
                }
                catch (Exception ex) {
                    throw new FeedException("Invalid XML",ex);
                }
                List children = tmpDoc.getRootElement().removeContent();
View Full Code Here

                StringReader tmpDocReader = new StringReader(tmpDocString.toString());
                Document tmpDoc;

                try {
                    SAXBuilder saxBuilder = new SAXBuilder();
                    tmpDoc = saxBuilder.build(tmpDocReader);
                }
                catch (Exception ex) {
                    throw new FeedException("Invalid XML",ex);
                }
View Full Code Here

     */
    public static Entry parseEntry(Reader rd, String baseURI)
        throws JDOMException, IOException, IllegalArgumentException, FeedException {
        // Parse entry into JDOM tree
        SAXBuilder builder = new SAXBuilder();
        Document entryDoc = builder.build(rd);
        Element fetchedEntryElement = entryDoc.getRootElement();
        fetchedEntryElement.detach();

        // Put entry into a JDOM document with 'feed' root so that Rome can handle it
        Feed feed = new Feed();
View Full Code Here

    if (settingIS == null) {
      logger.debug("file sniffingLogger.xml not found in classpath");
    } else {
      try {
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(settingIS);
        settingIS.close();
        Element rootElement = document.getRootElement();
        List<Element> sniffingloggers = rootElement
            .getChildren("sniffingLogger");
        for (Element sniffinglogger : sniffingloggers) {
View Full Code Here

      try {
        Enumeration< URL > resources = XmlUtil.class.getClassLoader().getResources( xml );
        while( resources.hasMoreElements() ) {
                  URL resource = resources.nextElement();
                  log.debug( "reading " + resource.toString() );
                  Document doc = builder.build( resource );
                  XPathFactory xpfac = XPathFactory.instance();
                  XPathExpression<Element> xp = xpfac.compile( requestedNodes, Filters.element() );
                  readed.addAll( xp.evaluate( doc ) ); // filter out repeated items
              }
        return new ArrayList<Element>( readed );
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.