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

commonMain.nl.adaptivity.xmlutil.xmlserializable.SimpleXmlDeserializable.kt Maven / Gradle / Ivy

There is a newer version: 0.90.3
Show newest version
/*
 * Copyright (c) 2023.
 *
 * This file is part of xmlutil.
 *
 * This file is licenced to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You should have received a copy of the license with the source distribution.
 * Alternatively, 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.
 */
@file:Suppress("DEPRECATION")

package nl.adaptivity.xmlutil.xmlserializable

import nl.adaptivity.xmlutil.XmlException
import nl.adaptivity.xmlutil.XmlReader


/**
 * Despite the name it is reasonably sophisticated, but it structures the parsing of the children and
 * provides them individually. This in contrast to [ExtXmlDeserializable] that provides full access
 * to parse the content whatever way desired.
 * Created by pdvrieze on 04/11/15.
 */
public interface SimpleXmlDeserializable : XmlDeserializable {


    /**
     * Handle the current child element
     * @param reader The reader to read from. It is at the relevant start node.
     *
     * @return `true`, if processed, `false` if not (will trigger an error)
     *
     * @throws XmlException If something else failed.
     */
    public fun deserializeChild(reader: XmlReader): Boolean = false

    /**
     * Handle text content in the node. This may be called multiple times in a single element if there are tags in between
     * or the parser isn't coalescing.
     * @param elementText The read text
     *
     * @return true if handled, false if not (whitespace will be ignored later on though, other text will trigger a failure)
     */
    public fun deserializeChildText(elementText: CharSequence): Boolean = false
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy