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

org.digidoc4j.ddoc.c14n.TinyXMLParser_Fragment Maven / Gradle / Ivy

Go to download

DDoc4J is Java Library for validating DDOC documents. It's not recommended to use it directly but rather through DigiDoc4J's API.

The newest version!
package org.digidoc4j.ddoc.c14n;

public final class TinyXMLParser_Fragment extends FragmentBase {

    public TinyXMLParser_Document OwnerDocument;
    private TinyXMLParser_Fragment _next;

    public TinyXMLParser_Fragment()
    {
        super();
    }


    private boolean GetMarkupChar(int o)
    {
        return ("".indexOf(this.GetChar(o)) > -1);
    }

    private boolean GetSpaceChar(int o)
    {
        return ("\t\n\r ".indexOf(this.GetChar(o)) > -1);
    }

    private boolean GetQuoteChar(int o)
    {
        return ("\"\'".indexOf(this.GetChar(o)) > -1);
    }

    private boolean GetLiteralChar(int o)
    {

        if (this.GetMarkupChar(o))
        {
            return false;
        }


        if (this.GetSpaceChar(o))
        {
            return false;
        }


        if (this.GetQuoteChar(o))
        {
            return false;
        }

        return true;
    }

    public boolean get_IsMarkup()
    {
        return this.GetMarkupChar(0);
    }

    public boolean get_IsSpace()
    {
        return this.GetSpaceChar(0);
    }

    public boolean get_IsQuote()
    {
        return this.GetQuoteChar(0);
    }

    public boolean get_IsLiteral()
    {
        return this.GetLiteralChar(0);
    }

    private void SpawnAtOffset(int p)
    {
        this.Offset = p;
        this.Length = -1;

        if (this.GetMarkupChar(0))
        {

            for (this.Length = 0; (this.InBounds(this.get_LastOffset()) && this.GetMarkupChar(this.Length)); this.Length = (this.Length + 1))
            {
            }

            return;
        }


        if (this.GetSpaceChar(0))
        {

            for (this.Length = 0; (this.InBounds(this.get_LastOffset()) && this.GetSpaceChar(this.Length)); this.Length = (this.Length + 1))
            {
            }

            return;
        }


        if (this.GetQuoteChar(0))
        {

            for (this.Length = 0; (this.InBounds(this.get_LastOffset()) && this.GetQuoteChar(this.Length)); this.Length = (this.Length + 1))
            {
            }

            return;
        }


        if (this.GetLiteralChar(0))
        {

            for (this.Length = 0; (this.InBounds(this.get_LastOffset()) && this.GetLiteralChar(this.Length)); this.Length = (this.Length + 1))
            {
            }

        }

    }

    public TinyXMLParser_Fragment Clone()
    {
        return TinyXMLParser_Fragment.Of(this.Data, this.Offset);
    }

    private TinyXMLParser_Fragment get_InternalNext()
    {

        if ((this._next == null))
        {
            this._next = TinyXMLParser_Fragment.Of(this.Data, this.get_LastOffset());

            if (!(this._next == null))
            {
                this._next.OwnerDocument = this.OwnerDocument;
            }

        }

        return this._next;
    }

    public TinyXMLParser_Fragment get_Next()
    {

        if (!(this.get_InternalNext() == null))
        {
            this.get_InternalNext().SplitMarkup();
        }

        return this.get_InternalNext();
    }

    public TinyXMLParser_Fragment get_NextNonSpace()
    {
        TinyXMLParser_Fragment f;
        boolean seek;

        f = this.get_Next();
        seek = true;
        while (seek)
        {

            if ((f == null))
            {
                seek = false;
            }
            else
            {

                if (!f.get_IsSpace())
                {
                    seek = false;
                }

            }


            if (seek)
            {
                f = f.get_Next();
            }

        }
        return f;
    }

    public void SplitMarkup()
    {
        String[] stringArray1;


        if (this.get_IsMarkup())
        {
            stringArray1 = new String[]
                    {
                            "",
                            "",
                            "",
                            "[",
                            "]",
                            "",
                            "",
                            "<",
                            "="
                    };

            if (!this.SplitBy(stringArray1))
            {
                this.SplitBy(1);
            }

            return;
        }


        if (this.get_IsQuote())
        {
            stringArray1 = new String[]
                    {
                            "\'",
                            "\""
                    };
            this.SplitBy(stringArray1);
        }

    }

    public void JoinNonMarkup()
    {
        boolean seek;
        String[] stringArray2;

        seek = true;
        while (seek)
        {

            if ((this.get_InternalNext() == null))
            {
                seek = false;
            }
            else
            {

                if (this.get_InternalNext().get_IsMarkup())
                {
                    stringArray2 = new String[]
                            {
                                    "




© 2015 - 2024 Weber Informatics LLC | Privacy Policy