Package javax.xml.parsers

Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()


    try {
      // Transform the text representation to DOM
      DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
      fact.setNamespaceAware(true);
     
      DocumentBuilder builder=fact.newDocumentBuilder();
     
      // Check if XML document, and if not return as text node
      if (text.trim().length() == 0 || text.charAt(0) != '<') {
        org.w3c.dom.Document doc=builder.newDocument();
       
View Full Code Here


    private static Document buildDocument(InputStream is) {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        final Document doc;
        try {
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(is);
        } catch (Exception e) {
            throw new IllegalStateException("buildDocument failed!", e);
        }
        return doc;
View Full Code Here

    {

      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      factory.setNamespaceAware(true);
      factory.setValidating(true);
      DocumentBuilder builder = factory.newDocumentBuilder();

      ErrorHandler errorHandler = new ErrorHandler() {

        public void warning(org.xml.sax.SAXParseException e)
        {
View Full Code Here

        Document doc;
        try {
            // read the schema to DOM representation
            DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
            fact.setNamespaceAware(true);
            DocumentBuilder bldr = fact.newDocumentBuilder();
            doc = bldr.parse(m_wsdlProvider.getWSDL(req));
            Element schema = doc.getDocumentElement();
            NodeList services = schema.getElementsByTagNameNS(WSDLSOAP_NAMESPACE, "address");
            for (int i = 0; i < services.getLength(); i++) {
                Node node = services.item(i).getAttributes().getNamedItem("location");
View Full Code Here

    public static DocumentBuilder newDocumentBuilder()
            throws ParserConfigurationException {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        factory.setNamespaceAware(false);
        DocumentBuilder builder = factory.newDocumentBuilder();

        return builder;
    }

    public static Document getAsDocument(String xmlString) throws SAXException,
View Full Code Here

    public List<JavaOneInterval> parse(InputStream is) throws Exception {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        factory.setNamespaceAware(false);
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.parse(is);
        return parse(doc);
    }

    public List<JavaOneInterval> parse(Document doc) {
View Full Code Here

      return (T) new SAXSource(new InputSource(getBinaryStream()));
    } else if (sourceClass == DOMSource.class) {
      try {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
              Node doc = docBuilder.parse(new InputSource(getBinaryStream()));
              return (T) new DOMSource(doc);
      } catch (ParserConfigurationException e) {
        throw new SQLException(e);
      } catch (SAXException e) {
View Full Code Here

     */
    public MappingDocument loadDocument(InputStream stream) throws MappingException {
        try {
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setValidating(false);
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.parse(stream);
            return loadContents(doc);
        } catch (IOException e) {
            throw new MappingException(e);
        } catch (ParserConfigurationException e) {
View Full Code Here

  private Document loadXmlFrom(InputStream is) throws SAXException, IOException {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    DocumentBuilder builder = null;
    try {
      builder = factory.newDocumentBuilder();
    } catch (ParserConfigurationException ex) { }
    return builder.parse(is);
  }
 
  private void considerRepairs(Document doc, Element root) {
View Full Code Here

   * @exception Exception  unspecialized error
   */
  public String parse(InputStream in) throws Exception {
    StringBuffer buff = new StringBuffer();
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    Document doc = docBuilder.parse(in);

    NodeList nl = doc.getElementsByTagName("resourceadapter");
    for (int i = 0; i < nl.getLength(); i++) {
      Node node = nl.item(i);
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.