Examples of DocumentBuilderFactory


Examples of javax.xml.parsers.DocumentBuilderFactory

   * @param in  The input stream.
   * @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

Examples of javax.xml.parsers.DocumentBuilderFactory

   * @param map  The map containing the updates.
   * @exception Exception  unspecialized error
   */
  public String update(InputStream in, Map map) throws Exception {
    this.map = map;
    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

Examples of javax.xml.parsers.DocumentBuilderFactory

     * @throws IOException
     * @throws SAXException
     */
  public XmpReader(byte[] bytes) throws SAXException, IOException {
    try {
          DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
          fact.setNamespaceAware(true);
      DocumentBuilder db = fact.newDocumentBuilder();
          ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
          domDocument = db.parse(bais);
    } catch (ParserConfigurationException e) {
      throw new ExceptionConverter(e);
    }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

            public void abortWorkItem(WorkItem manager, WorkItemManager mgr) {
               
            }

            public void executeWorkItem(WorkItem workItem, WorkItemManager mgr) {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder;
        try {
          builder = factory.newDocumentBuilder();
        } catch (ParserConfigurationException e) {
          // TODO Auto-generated catch block
//          e.printStackTrace();
          throw new RuntimeException(e);
        }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

      return configs_.values();
   }

   private void parseConfiguration(InputStream is) throws Exception
   {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      factory.setIgnoringComments(true);
      factory.setCoalescing(true);
      factory.setNamespaceAware(false);
      factory.setValidating(false);
      DocumentBuilder parser = factory.newDocumentBuilder();
      Document document = parser.parse(is);
      NodeList nodes = document.getElementsByTagName("locale-config");
      for (int i = 0; i < nodes.getLength(); i++)
      {
         Node node = nodes.item(i);
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

    private List<ResultGeoCodeApi> parseResults(String xml){
        List<ResultGeoCodeApi> results = new ArrayList<ResultGeoCodeApi>();
        try {
           
            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
            Document doc = docBuilder.parse(new ByteArrayInputStream(xml.getBytes()));
              // normalize text representation
            doc.getDocumentElement ().normalize ();
            NodeList listOfResults = doc.getElementsByTagName("Result");
            for(int i= 0; i< listOfResults.getLength(); i++){
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

    }

    private static DocumentBuilder createDocumentBuilder()
        throws ParserConfigurationException {

        DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = fact.newDocumentBuilder();

        builder.setErrorHandler( null );
       
        return builder;
    }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

  private XMLParserFactory() {
  }

  public DocumentBuilder createParser() {
    DocumentBuilderFactory factory = createDocumentBuilderFactory();
    try {
      return createDocumentBuilder(factory);
    } catch (ParserConfigurationException e) {
      throw new MappingException("Failed to create XML Parser !", e);
    }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

   * @return the JAXP DocumentBuilderFactory
   * @throws javax.xml.parsers.ParserConfigurationException
   *          if thrown by JAXP methods
   */
  private DocumentBuilderFactory createDocumentBuilderFactory() {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(true);
    factory.setNamespaceAware(true);
    factory.setIgnoringElementContentWhitespace(true);
    factory.setAttribute(SCHEMA_FEATURE, true); // For Xerces implementation
    return factory;
  }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

        else if (xfa instanceof PRStream) {
            byte[] b = PdfReader.getStreamBytes((PRStream)xfa);
            bout.write(b);
        }
        bout.close();
        DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
        fact.setNamespaceAware(true);
        DocumentBuilder db = fact.newDocumentBuilder();
        domDocument = db.parse(new ByteArrayInputStream(bout.toByteArray()));  
        Node n = domDocument.getFirstChild();
        while (n.getChildNodes().getLength() == 0) {
          n = n.getNextSibling();
        }
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.