Package org.jdom2

Examples of org.jdom2.Document


    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


        "but with the same version, this can make version upgrades more difficult, due to the repetition.";
  }

  public void invoke(MavenProject mavenProject, final Map<String, Object> models, final ResultCollector resultCollector) {
   
    final Document document = (Document) models.get("jdom2");
   
    final XPathFactory xpathFactory = XPathFactory.instance();
    final Filter<LocatedElement> filter = Filters.fclass(LocatedElement.class);
    Namespace mavenNamespace = Namespace.getNamespace("m", "http://maven.apache.org/POM/4.0.0");
    final XPathExpression<LocatedElement> dependenciesXpath = xpathFactory.compile("/m:project/m:dependencies/m:dependency", filter, null, mavenNamespace);
View Full Code Here

            Transformer transformer = stylesheet.newTransformer();
            transformer.setParameter("serverurl", server_uri);

            JDOMResult result = new JDOMResult();
            transformer.transform(input,result);
            Document output = result.getDocument();

            XMLOutputter printer = new XMLOutputter(Format.getPrettyFormat());
            printer.output(output, writer);
            writer.flush();
        } catch (Exception ex) {
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

        try {
            log.trace("PARSE {}", urlDecode(requestUrl).replaceFirst(".*=xml&", ""));

            parseParams(requestUrl);
            final Context context = Context.fromUrl(requestUrl);
            final Document doc = new SAXBuilder(XMLReaders.NONVALIDATING).build(in);

            ArrayList<String> followUp = new ArrayList<String>();
            final RepositoryConnection con = repository.getConnection();
            final ValueFactory valueFactory = con.getValueFactory();

View Full Code Here

     * @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match.
     * @throws FeedException thrown if the XML representation for the feed could not be created.
     *
     */
    public String outputString(WireFeed feed, boolean prettyPrint) throws IllegalArgumentException,FeedException {
        Document doc = outputJDom(feed);
        String encoding = feed.getEncoding();
        Format format = prettyPrint ? Format.getPrettyFormat() : Format.getCompactFormat();
        if (encoding!=null) {
            format.setEncoding(encoding);
        }
View Full Code Here

     * @throws IOException thrown if there was some problem writing to the Writer.
     * @throws FeedException thrown if the XML representation for the feed could not be created.
     *
     */
    public void output(WireFeed feed,Writer writer,boolean prettyPrint) throws IllegalArgumentException,IOException, FeedException {
        Document doc = outputJDom(feed);
        String encoding = feed.getEncoding();
        Format format = prettyPrint ? Format.getPrettyFormat() : Format.getCompactFormat();
        if (encoding!=null) {
            format.setEncoding(encoding);
        }
View Full Code Here

     * @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match.
     * @throws FeedException thrown if the W3C DOM document for the feed could not be created.
     *
     */
    public org.w3c.dom.Document outputW3CDom(WireFeed feed) throws IllegalArgumentException,FeedException {
        Document doc = outputJDom(feed);
        DOMOutputter outputter = new DOMOutputter();
        try {
            return outputter.output(doc);
        }
        catch (JDOMException jdomEx) {
View Full Code Here

      SAXBuilder saxBuilder = createSAXBuilder();
        try {
            if (_xmlHealerOn) {
                reader = new XmlFixerReader(reader);
            }           
            Document document = saxBuilder.build(reader);
            return build(document);
        }
        catch (JDOMParseException ex) {
            throw new ParsingFeedException("Invalid XML: " + ex.getMessage(), ex);
        }
View Full Code Here

     *
     */
    public WireFeed build(InputSource is) throws IllegalArgumentException,FeedException {
      SAXBuilder saxBuilder = createSAXBuilder();
        try {
            Document document = saxBuilder.build(is);
            return build(document);
        }
        catch (JDOMParseException ex) {
            throw new ParsingFeedException("Invalid XML: " + ex.getMessage(), ex);
        }
View Full Code Here

TOP

Related Classes of org.jdom2.Document

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.