Package org.apache.xerces.parsers

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


    }

    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

      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

        }

        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

    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

        throws SAXNotRecognizedException, SAXNotSupportedException
    {
        boolean doingValidation =
            (validate || (schemaLocationPropertyValue != null));

        DOMParser parser = new DOMParser();

        parser.setEntityResolver(entityResolver);
        parser.setErrorHandler(new ErrorHandlerImpl());
        parser.setFeature(DEFER_NODE_EXPANSION, false);
        parser.setFeature(NAMESPACES_FEATURE_ID, true);
        parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, doingValidation);
        parser.setFeature(VALIDATION_FEATURE_ID, doingValidation);

        if (schemaLocationPropertyValue != null) {
            parser.setProperty(
                SCHEMA_LOCATION,
                schemaLocationPropertyValue.replace('\\', '/'));
        }

        return parser;
View Full Code Here

            Constants.FILE_SEPERATOR).toString();

        String systemId = new File(systemString).toURL().toString();
        inputSource.setSystemId(systemId);

        DOMParser parser = new DOMParser();

        parser.setFeature("http://xml.org/sax/features/validation",
            getValidating(messageName, system));
        parser.setFeature("http://xml.org/sax/features/namespaces",
            getNamespaceAware(messageName, system));
        String schema = getXMLSchema(messageName, system);
        if (schema != null)
        {
          parser.setFeature("http://xml.org/sax/features/namespaces",
              true);
          parser.setFeature("http://xml.org/sax/features/validation",
              true);
          parser.setFeature(
              "http://apache.org/xml/features/validation/schema",
              true);
          parser
              .setProperty(
                  "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
                  new StringBuffer().append(
                      Constants.XBUS_ETC)
                      .append("Schema").append(
                          Constants.FILE_SEPERATOR)
                      .append(schema).toString());
        }
        parser.setErrorHandler(new XParserErrorHandler());

        parser.parse(inputSource);
        retDocument = parser.getDocument();
      }
      catch (Exception e)
      {
        throw new XException(Constants.LOCATION_INTERN,
            Constants.LAYER_COREBASE,
View Full Code Here

  Hashtable auxTable = null;
  String categoryName = null;

try {
  // The parser begins!
  DOMParser parser = new DOMParser();
  confFile = new File (confFile).getAbsolutePath();
  confFile = "file:" + confFile;
  parser.parse(confFile);
  Document doc = parser.getDocument();
 
  // Get the root's childs
  Element root = doc.getDocumentElement();
  String rootTag = root.getTagName();
  NodeList list = doc.getElementsByTagName(rootTag).item(0).getChildNodes();
View Full Code Here

    */
   public Document docRead(String docName)
   {
  Document doc = null;  
try {
  DOMParser parser = new DOMParser();
  docName = this.dataDir + "/news/" + docName;
  docName = new File (docName).getAbsolutePath();
  docName = "file:" + docName;
 
  parser.parse(docName);
  doc = parser.getDocument();
}
catch (Exception e) {
  e.printStackTrace ();
}
  return (doc);
View Full Code Here

       
        private Document dom_from_xml( String xml throws Order_exception
        {
            try
            {
                DOMParser parser = new DOMParser();
                //parser.setIncludeIgnorableWhitespace( false );
                //parser.setErrorHandler();
                parser.parse( new org.xml.sax.InputSource( new StringReader( xml ) ) );
                   
                return parser.getDocument();
            }
            catch( Exception x )
            {
                throw new Order_exception( "Error while reading XML: " + x, x );
            }
View Full Code Here

TOP

Related Classes of org.apache.xerces.parsers.DOMParser

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.