Esempio n. 1
0
        /** Writes this attribute to an output stream */
        public void Write(StreamWriter writer)
        {
            writer.Write(Name + " ");
            if (Type is string)
            {
                writer.Write(Type);
            }
            else if (Type is DTDEnumeration)
            {
                DTDEnumeration dtdEnum = (DTDEnumeration)Type;
                dtdEnum.Write(writer);
            }
            else if (Type is DTDNotationList)
            {
                DTDNotationList dtdnl = (DTDNotationList)Type;
                dtdnl.Write(writer);
            }

            if (Decl != null)
            {
                Decl.Write(writer);
            }

            if (DefaultValue != null)
            {
                writer.Write(" \"");
                writer.Write(DefaultValue);
                writer.Write("\"");
            }
            //writer.WriteLine(">");                           original java comment: "Bug!"
        }
Esempio n. 2
0
        public override bool Equals(object ob)
        {
            if (ob == this)
            {
                return(true);
            }
            if (!(ob is DTDNotationList))
            {
                return(false);
            }

            DTDNotationList other = (DTDNotationList)ob;

            return(Items.Equals(other.Items));
        }
Esempio n. 3
0
        protected DTDNotationList ParseNotationList()
        {
            DTDNotationList notation = new DTDNotationList();

            Token token = Scanner.Get();

            if (token.Type != Scanner.LPAREN)
            {
                throw new DTDParseException(Scanner.GetUriId(),
                                            "Invalid token in notation: " +
                                            token.Type.Name, Scanner.GetLineNumber(),
                                            Scanner.GetColumn());
            }

            for (;;)
            {
                token = Scanner.Get();

                if (token.Type != Scanner.IDENTIFIER)
                {
                    throw new DTDParseException(Scanner.GetUriId(),
                                                "Invalid token in notation: " +
                                                token.Type.Name, Scanner.GetLineNumber(),
                                                Scanner.GetColumn());
                }

                notation.Items.Add(token.Value);

                token = Scanner.Peek();

                if (token.Type == Scanner.RPAREN)
                {
                    Scanner.Get();
                    return(notation);
                }
                if (token.Type != Scanner.PIPE)
                {
                    throw new DTDParseException(Scanner.GetUriId(),
                                                "Invalid token in notation: " +
                                                token.Type.Name, Scanner.GetLineNumber(),
                                                Scanner.GetColumn());
                }
                Scanner.Get(); // eat the pipe
            }
        }