All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.htmlunit.xerces.parsers.XMLParser Maven / Gradle / Ivy

Go to download

HtmlUnit adaptation of NekoHtml. It has the same functionality but exposing HTMLElements to be overridden.

The newest version!
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.sourceforge.htmlunit.xerces.parsers;

import java.io.IOException;

import net.sourceforge.htmlunit.xerces.impl.Constants;
import net.sourceforge.htmlunit.xerces.xni.XNIException;
import net.sourceforge.htmlunit.xerces.xni.parser.XMLInputSource;
import net.sourceforge.htmlunit.xerces.xni.parser.XMLParserConfiguration;

/**
 * Base class of all XML-related parsers.
 * 

* In addition to the features and properties recognized by the parser * configuration, this parser recognizes these additional features and * properties: *

    *
  • Properties *
      *
    • http://apache.org/xml/properties/internal/error-handler
    • *
    • http://apache.org/xml/properties/internal/entity-resolver
    • *
    *
* * @author Arnaud Le Hors, IBM * @author Andy Clark, IBM */ public abstract class XMLParser { /** Property identifier: error handler. */ protected static final String ERROR_HANDLER = Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY; /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { ERROR_HANDLER, }; /** The parser configuration. */ protected final XMLParserConfiguration fConfiguration; // Default Constructor. protected XMLParser(XMLParserConfiguration config) { // save configuration fConfiguration = config; // add default recognized properties fConfiguration.addRecognizedProperties(RECOGNIZED_PROPERTIES); } /** * Parse. * * @param inputSource the input source * * @exception XNIException on error * @exception java.io.IOException on error */ public void parse(XMLInputSource inputSource) throws XNIException, IOException { reset(); fConfiguration.parse(inputSource); } /** * reset all components before parsing */ protected void reset() throws XNIException { } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy