예제 #1
0
 public void End()
 {
     strBuf = null;
     longStrBuf = null;
     doctypeName = null;
     systemIdentifier = null;
     publicIdentifier = null;
     tagName = null;
     attributeName = null;
     TokenHandler.EndTokenization();
     if (attributes != null)
     {
         attributes.Clear(mappingLangToXmlLang);
         attributes = null;
     }
 }
예제 #2
0
        public void LoadState(Tokenizer other)
        {
            strBufLen = other.strBufLen;
            if (strBufLen > strBuf.Length)
            {
                strBuf = new char[strBufLen];
            }
            Array.Copy(other.strBuf, strBuf, strBufLen);

            longStrBufLen = other.longStrBufLen;
            if (longStrBufLen > longStrBuf.Length)
            {
                longStrBuf = new char[longStrBufLen];
            }
            Array.Copy(other.longStrBuf, longStrBuf, longStrBufLen);

            stateSave = other.stateSave;
            returnStateSave = other.returnStateSave;
            endTagExpectation = other.endTagExpectation;
            endTagExpectationAsArray = other.endTagExpectationAsArray;
            // line = 1; XXX line numbers
            lastCR = other.lastCR;
            index = other.index;
            forceQuirks = other.forceQuirks;
            additional = other.additional;
            entCol = other.entCol;
            firstCharKey = other.firstCharKey;
            lo = other.lo;
            hi = other.hi;
            candidate = other.candidate;
            strBufMark = other.strBufMark;
            prevValue = other.prevValue;
            value = other.value;
            seenDigits = other.seenDigits;
            endTag = other.endTag;
            shouldSuspend = false;

            if (other.doctypeName == null)
            {
                doctypeName = null;
            }
            else
            {
                doctypeName = other.doctypeName;
            }

            if (other.systemIdentifier == null)
            {
                systemIdentifier = null;
            }
            else
            {
                systemIdentifier = other.systemIdentifier;
            }

            if (other.publicIdentifier == null)
            {
                publicIdentifier = null;
            }
            else
            {
                publicIdentifier = other.publicIdentifier;
            }

            if (other.tagName == null)
            {
                tagName = null;
            }
            else
            {
                tagName = other.tagName.CloneElementName();
            }

            if (other.attributeName == null)
            {
                attributeName = null;
            }
            else
            {
                attributeName = other.attributeName.CloneAttributeName();
            }

            if (other.attributes == null)
            {
                attributes = null;
            }
            else
            {
                attributes = other.attributes.CloneAttributes();
            }
        }
예제 #3
0
        /**
         * The constructor.
         *
         * @param tokenHandler
         *            the handler for receiving tokens
         */
        public Tokenizer(ITreeBuilder tokenHandler)
        {
            this.TokenHandler = tokenHandler;

            this.bmpChar = new char[1];
            this.astralChar = new char[2];
            this.tagName = null;
            this.attributeName = null;
            this.doctypeName = null;
            this.publicIdentifier = null;
            this.systemIdentifier = null;
            this.attributes = null;
        }
예제 #4
0
        private void AttributeNameComplete()
        {
            attributeName = AttributeName.NameByBuffer(strBuf, 0, strBufLen);

            if (attributes == null)
            {
                attributes = new HtmlAttributes(mappingLangToXmlLang);
            }

            /*
             * When the user agent leaves the attribute name state (and before
             * emitting the tag token, if appropriate), the complete attribute's
             * name must be compared to the other attributes on the same token; if
             * there is already an attribute on the token with the exact same name,
             * then this is a parse error and the new attribute must be dropped,
             * along with the value that gets associated with it (if any).
             */
            if (attributes.Contains(attributeName))
            {
                ErrDuplicateAttribute();
                attributeName = null;
            }
        }
예제 #5
0
        private void AddAttributeWithValue()
        {
            if (attributeName != null)
            {
                String val = LongStrBufToString(); // Ownership transferred to
                // HtmlAttributes

                attributes.AddAttribute(attributeName, val);
                attributeName = null; // attributeName has been adopted by the
                // |attributes| object
            }
        }
예제 #6
0
        private void AddAttributeWithoutValue()
        {
            NoteAttributeWithoutValue();

            if (attributeName != null)
            {

                attributes.AddAttribute(attributeName,
                        String.Empty

                );

                attributeName = null; // attributeName has been adopted by the
                // |attributes| object
            }
        }
예제 #7
0
        public void ResetToDataState()
        {
            strBufLen = 0;
            longStrBufLen = 0;
            stateSave = Tokenizer.DATA;
            // line = 1; XXX line numbers
            lastCR = false;
            index = 0;
            forceQuirks = false;
            additional = '\u0000';
            entCol = -1;
            firstCharKey = -1;
            lo = 0;
            hi = 0; // will always be overwritten before use anyway
            candidate = -1;
            strBufMark = 0;
            prevValue = -1;
            value = 0;
            seenDigits = false;
            endTag = false;
            shouldSuspend = false;
            InitDoctypeFields();
            if (tagName != null)
            {
                tagName = null;
            }
            if (attributeName != null)
            {
                attributeName = null;
            }

            if (attributes != null)
            {
                attributes = null;
            }
        }