Examples of DOMParser


Examples of org.apache.commons.jxpath.xml.DOMParser

        DesignerLogger.logInfo("InfoPath [DEBUG]: " + str);
    }

    private void transform() throws Exception {
        byte[] xsdData = readXsnFile(xsnFormFile, MYSCHEMA_XSD_FILE_NAME);
        Document xsd = (Document) new DOMParser().parseXML(new ByteArrayInputStream(xsdData));
        byte[] xsfData = readXsnFile(xsnFormFile, MANIFEST_FILE_NAME);
        Document xsf = (Document) new DOMParser().parseXML(new ByteArrayInputStream(xsfData));

        List<Variable> formVariables = new ArrayList<Variable>();

        String namespace = "my";
        String rootGroup = "myFields";
View Full Code Here

Examples of org.apache.ctakes.jdl.data.xml.DomParser

  public static String L2X = Resources.LOAD2X;

  @Theory
  public void getRoot(String xml) {
    xml = FileUtil.getFile(xml).toString();
    DomParser dom;
    dom = new DomParser(CX);
    assertThat(dom.getRoot().getTagName(), is(Resources.ROOT_CONN));
    dom = new DomParser(xml);
    assertThat(dom.getRoot().getTagName(), is(Resources.ROOT_LOAD));
  }
View Full Code Here

Examples of org.apache.excalibur.xml.dom.DOMParser

                        }
                        if (replaceNode != null) {
                            if (overwrite == true) {
                                if (parent.getNodeType() == Node.DOCUMENT_NODE) {
                                    // replacing of the document element is not allowed
                                    DOMParser parser = (DOMParser)this.manager.lookup(DOMParser.ROLE);
                                    try {
                                        resource = parser.createDocument();
                                    } finally {
                                        this.manager.release( (Component)parser );
                                    }

                                    resource.appendChild(resource.importNode(importNode, true));
                                    parent = resource;
                                    replaceNode = resource.importNode(replaceNode, true);
                                } else {
                                    parent.replaceChild(importNode, replaceNode);
                                }
                                message += ", replacing: " + replacePath;
                                if (reinsertPath != null) {
                                    Node insertAt = DOMUtil.getSingleNode(parent, reinsertPath);
                                    if (insertAt != null) {
                                        while (replaceNode.hasChildNodes() == true) {
                                            insertAt.appendChild(replaceNode.getFirstChild());
                                        }
                                    } else { // reinsert point null
                                        message = "replace failed, could not find your reinsert path: " + reinsertPath;
                                        resource = null;
                                    }
                                }
                            } else { // overwrite was false
                                message = "replace failed, no overwrite allowed.";
                                resource = null;
                            }
                        } else { // specified replaceNode was not found
                            parent.appendChild(importNode);
                        }
                    } catch (javax.xml.transform.TransformerException sax) {
                        throw new ProcessingException("TransformerException: " + sax, sax);
                    }
                } else { // no replace path, just do an insert at end
                    parent.appendChild(importNode);
                }
            } else if (create == true) {
                DOMParser parser = (DOMParser)this.manager.lookup(DOMParser.ROLE);
                try {
                    resource = parser.createDocument();
                } finally {
                    this.manager.release( (Component)parser );
                }
                // import the fragment
                Node importNode = resource.importNode(fragment, true);
View Full Code Here

Examples of org.apache.oodt.commons.util.DOMParser

    // It wasn't in the cache, so create a parser to parse the file.  We only
    // deal with correct files, so turn on validation and install an error
    // handler that will throw an exception.
    profiles = new ArrayList();
    DOMParser parser = XML.createDOMParser();
    parser.setErrorHandler(new ErrorHandler() {
      public void error(SAXParseException ex) throws SAXParseException {
        System.err.println("Parse error line " + ex.getLineNumber() + " column "
          + ex.getColumnNumber() + ": " + ex.getMessage());
        throw ex;
      }
      public void warning(SAXParseException ex) {
        System.err.println("Parse warning: " + ex.getMessage());
      }
      public void fatalError(SAXParseException ex) throws SAXParseException {
        throw ex;
      }
    });

    // Parse the file.
    InputSource inputSource = new InputSource(url.toString());
    parser.parse(inputSource);
    Document doc = parser.getDocument();

    // Normalize it and get the document element, and from that, create a list
    // of profiles, and add it to the cache.
    doc.normalize();
    Element root = doc.getDocumentElement();
View Full Code Here

Examples of org.apache.xerces.impl.xs.dom.DOMParser

                }

                // If this is the first schema this Handler has
                // parsed, it has to construct a DOMParser
                if (fSchemaParser == null) {
                    fSchemaParser = new DOMParser();
                    resetSchemaParserErrorHandler();
                    fSchemaParser.setPool(fDOMPool);
                }
                fSchemaParser.reset();
                fSchemaParser.parse(schemaSource);
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

        nameList = new String[0];
        restoreBackuped = false;
    }

    static Document parse(InputSource input) throws IOException, org.xml.sax.SAXException {
        DOMParser parser = new DOMParser();
        parser.parse(input);

        return parser.getDocument();
    }
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

    }

    public static void load(InputStream is) throws ChaiDBException {
        try {
            InputSource inputSource = new InputSource(is);
            DOMParser parser = new DOMParser();
            parser.parse(inputSource);
            Document document = parser.getDocument();
            if (document == null) {
                throw new ChaiDBException(ErrorCode.PARSE_ERROR, "Config File is not well-formed!");
            }
            Element rootElement = document.getDocumentElement();
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

      InputSource inputSource = createInputSource(context, source);
      if (source == null) {
        throw context.BadParameter("File, InputStream, URL or string expected");
      }
     
      DOMParser parser = new DOMParser();
      setupParser(context, parser, features);
      parser.parse(inputSource);
      return new AnyNode(parser.getDocument());

    } catch (SAXException e) {
      throw context.XMLError(e.getMessage(), null);
     
    } catch (IOException e) {
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

        }

        Document doc = null;
        try {
            InputSource input = new InputSource(new FileInputStream(storageMetaFile));
            DOMParser parser = new DOMParser();
            parser.parse(input);
            doc = parser.getDocument();
        } catch (Exception e) {
            String details = "The operation reading collection storage metadata from " + storageMetaFile + " failed" + ". " + e.toString() + ".";
            logger.info(details);
            //throw new ChaiDBException(ErrorCode.FILE_NOT_FOUND_ERROR, details);
        }
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

    static Document parse(byte[] in)
        throws SAXException, IOException
    {
        InputSource source = new InputSource(new ByteArrayInputStream(in));

        DOMParser parser = getParser(null, null, false);
        try {
            parser.parse(source);
            checkForParseError(parser);
        } catch (SAXParseException ex) {
            checkForParseError(parser, ex);
        }

        return parser.getDocument();
    }
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.