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

net.sf.saxon.evpull.StartElementEvent Maven / Gradle / Ivy

There is a newer version: 10.5
Show newest version
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2013 Saxonica Limited.
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

package net.sf.saxon.evpull;

import net.sf.saxon.Configuration;
import net.sf.saxon.event.PipelineConfiguration;
import net.sf.saxon.expr.parser.ExpressionLocation;
import net.sf.saxon.om.*;
import net.sf.saxon.trans.Err;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.tree.util.Orphan;
import net.sf.saxon.type.BuiltInAtomicType;
import net.sf.saxon.type.SchemaType;
import net.sf.saxon.type.Type;
import net.sf.saxon.type.Untyped;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
 * This is a PullEvent representing the start of an element node. It contains (or potentially contains) all the
 * namespace declarations and attributes associated with the element.
 */
public class StartElementEvent implements PullEvent {

    PipelineConfiguration pipe;
    private NodeName elementName;
    private SchemaType typeCode;
    /*@Nullable*/ private NamespaceBinding[] localNamespaces;
    private List attributes;
    private int locationId = -1;

    /**
     * Create a Start Element Event
     * @param pipe the pipeline configuration
     */

    public StartElementEvent(PipelineConfiguration pipe) {
        this.pipe = pipe;
    }

    /**
     * Set the nameCode of this element
     * @param elementName the namecode of the element (its name as identified in the NamePool)
     */

    public void setElementName(NodeName elementName) {
        this.elementName = elementName;
    }

    /**
     * Get the nameCode of this element
     * @return the nameCode representing the element's name
     */

    public NodeName getElementName() {
        return elementName;
    }

    /**
     * Set the typeCode of this element
     * @param typeCode the element's type annotation
     */

    public void setTypeCode(SchemaType typeCode) {
        this.typeCode = typeCode;
    }

    /**
     * Get the typeCode of this element
     * @return the element's type annotation
     */

    public SchemaType getTypeCode() {
        return typeCode;
    }

    /**
     * Set the namespaces that are locally declared (or undeclared) on this element
     * @param nscodes integer array of namespace codes
     */

    public void setLocalNamespaces(NamespaceBinding[] nscodes) {
        localNamespaces = nscodes;
    }

    /**
     * Add a namespace code representing a locally declared namespace
     * @param nscode a namespace code
     * @throws XPathException
     */

    public void addNamespace(NamespaceBinding nscode) throws XPathException {
        if (localNamespaces == null) {
            localNamespaces = new NamespaceBinding[]{nscode, null, null, null};
        }
        for (int n=0; n(4);
        }
        int fp = att.getFingerprint();
        for (int a=0; a




© 2015 - 2024 Weber Informatics LLC | Privacy Policy