congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
XmlUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
XmlUtils
in
org.apache.karaf.util

Best Java code snippets using org.apache.karaf.util.XmlUtils (Showing top 19 results out of 315)

origin: apache/karaf

protected Document parse(File artifact) throws Exception {
  return XmlUtils.parse(artifact, new ErrorHandler() {
    public void warning(SAXParseException exception) throws SAXException {
    }
    public void error(SAXParseException exception) throws SAXException {
    }
    public void fatalError(SAXParseException exception) throws SAXException {
      throw exception;
    }
  });
}
origin: apache/karaf

public static void transform(Source xmlSource, Result outputTarget) throws TransformerException {
  Transformer t = transformer();
  try {
    t.transform(xmlSource, outputTarget);
  } finally {
    t.reset();
  }
}
origin: apache/karaf

public static Set<String> analyze(Source source) throws Exception {
  Set<String> refers = new TreeSet<>();
  ByteArrayOutputStream bout = new ByteArrayOutputStream();
  Result r = new StreamResult(bout);
  XmlUtils.transform(new StreamSource(SpringTransformer.class.getResourceAsStream("extract.xsl")), source, r);
  ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
  bout.close();
  BufferedReader br = new BufferedReader(new InputStreamReader(bin));
  String line = br.readLine();
  while (line != null) {
    line = line.trim();
    if (line.length() > 0) {
      String parts[] = line.split("\\s*,\\s*");
      for (String part : parts) {
        int n = part.lastIndexOf('.');
        if (n > 0) {
          String pkg = part.substring(0, n);
          if (!pkg.startsWith("java.")) {
            refers.add(part.substring(0, n));
          }
        }
      }
    }
    line = br.readLine();
  }
  br.close();
  return refers;
}
origin: apache/karaf

public static Document parse(String uri) throws TransformerException, IOException, SAXException, ParserConfigurationException {
  DocumentBuilder db = documentBuilder();
  try {
    return db.parse(uri);
  } finally {
    db.reset();
  }
}
origin: apache/karaf

private static Features unmarshalNoValidate(String uri, InputStream stream) {
  try {
    Unmarshaller unmarshaller = FEATURES_CONTEXT.createUnmarshaller();
    NoSourceAndNamespaceFilter xmlFilter = new NoSourceAndNamespaceFilter(XmlUtils.xmlReader());
    xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler());
    InputSource is = new InputSource(uri);
    if (stream != null) {
      is.setByteStream(stream);
    }
    SAXSource source = new SAXSource(xmlFilter, is);
    Features features = (Features) unmarshaller.unmarshal(source);
    features.setNamespace(xmlFilter.getNamespace());
    return features;
  } catch (RuntimeException e) {
    throw e;
  } catch (Exception e) {
    throw new RuntimeException("Unable to load " + uri, e);
  }
}
origin: apache/karaf

public static Set<String> analyze(Source source) throws Exception {
  Set<String> refers = new TreeSet<String>();
  ByteArrayOutputStream bout = new ByteArrayOutputStream();
  Result r = new StreamResult(bout);
  XmlUtils.transform(new StreamSource(BlueprintTransformer.class.getResourceAsStream("extract.xsl")), source, r);
  ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
  bout.close();
  BufferedReader br = new BufferedReader(new InputStreamReader(bin));
  String line = br.readLine();
  while (line != null) {
    line = line.trim();
    if (line.length() > 0) {
      String parts[] = line.split("\\s*,\\s*");
      for (String part : parts) {
        int n = part.lastIndexOf('.');
        if (n > 0) {
          String pkg = part.substring(0, n);
          if (!pkg.startsWith("java.")) {
            refers.add(pkg);
          }
        }
      }
    }
    line = br.readLine();
  }
  br.close();
  return refers;
}
origin: apache/karaf

public static Document parse(File f, ErrorHandler errorHandler) throws TransformerException, IOException, SAXException, ParserConfigurationException {
  DocumentBuilder db = documentBuilder();
  db.setErrorHandler(errorHandler);
  try {
    return db.parse(f);
  } finally {
    db.reset();
  }
}
origin: org.apache.karaf.deployer/org.apache.karaf.deployer.blueprint

protected Document parse(File artifact) throws Exception {
  return XmlUtils.parse(artifact, new ErrorHandler() {
    public void warning(SAXParseException exception) throws SAXException {
    }
    public void error(SAXParseException exception) throws SAXException {
    }
    public void fatalError(SAXParseException exception) throws SAXException {
      throw exception;
    }
  });
}
origin: org.apache.karaf.deployer/org.apache.karaf.deployer.blueprint

public static Set<String> analyze(Source source) throws Exception {
  Set<String> refers = new TreeSet<String>();
  ByteArrayOutputStream bout = new ByteArrayOutputStream();
  Result r = new StreamResult(bout);
  XmlUtils.transform(new StreamSource(BlueprintTransformer.class.getResourceAsStream("extract.xsl")), source, r);
  ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
  bout.close();
  BufferedReader br = new BufferedReader(new InputStreamReader(bin));
  String line = br.readLine();
  while (line != null) {
    line = line.trim();
    if (line.length() > 0) {
      String parts[] = line.split("\\s*,\\s*");
      for (String part : parts) {
        int n = part.lastIndexOf('.');
        if (n > 0) {
          String pkg = part.substring(0, n);
          if (!pkg.startsWith("java.")) {
            refers.add(pkg);
          }
        }
      }
    }
    line = br.readLine();
  }
  br.close();
  return refers;
}
origin: apache/karaf

public static Document parse(InputStream stream) throws TransformerException, IOException, SAXException, ParserConfigurationException {
  DocumentBuilder db = documentBuilder();
  try {
    return db.parse(stream);
  } finally {
    db.reset();
  }
}
origin: apache/karaf

public static void transform(Source xsltSource, Source xmlSource, Result outputTarget) throws TransformerException {
  Transformer t = transformer(xsltSource);
  try {
    t.transform(xmlSource, outputTarget);
  } finally {
    t.reset();
  }
}
origin: apache/karaf

protected static Document parse(URL url) throws Exception {
  try (InputStream is = url.openStream()) {
    return XmlUtils.parse(is);
  }
}
origin: apache/karaf

out.putNextEntry(e);
XmlUtils.transform(new DOMSource(doc), new StreamResult(out));
out.closeEntry();
out.close();
origin: apache/karaf

public static Document parse(File f) throws TransformerException, IOException, SAXException, ParserConfigurationException {
  DocumentBuilder db = documentBuilder();
  try {
    return db.parse(f);
  } finally {
    db.reset();
  }
}
origin: apache/karaf

protected static Document parse(URL url) throws Exception {
  try (InputStream is = url.openStream()) {
    return XmlUtils.parse(is);
  }
}
origin: org.apache.karaf.deployer/org.apache.karaf.deployer.blueprint

out.putNextEntry(e);
XmlUtils.transform(new DOMSource(doc), new StreamResult(out));
out.closeEntry();
out.close();
origin: org.apache.karaf.deployer/org.apache.karaf.deployer.blueprint

protected static Document parse(URL url) throws Exception {
  try (InputStream is = url.openStream()) {
    return XmlUtils.parse(is);
  }
}
origin: apache/karaf

out.putNextEntry(e);
XmlUtils.transform(new DOMSource(doc), new StreamResult(out));
out.closeEntry();
out.close();
origin: apache/karaf

Document doc;
if (stream != null) {
  doc = XmlUtils.parse(stream);
  doc.setDocumentURI(uri);
} else {
  doc = XmlUtils.parse(uri);
org.apache.karaf.utilXmlUtils

Javadoc

Utils class to manipulate XML document in a thread safe way.

Most used methods

  • parse
  • transform
  • documentBuilder
  • transformer
  • xmlReader

Popular in Java

  • Running tasks concurrently on multiple threads
  • getResourceAsStream (ClassLoader)
  • onCreateOptionsMenu (Activity)
  • putExtra (Intent)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • JCheckBox (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now