FileDocCategorySizeDatePackage
AttributeFieldParser.javaAPI DocphoneME MR2 API (J2ME)3087Wed May 02 18:00:42 BST 2007gov.nist.javax.sdp.parser

AttributeFieldParser

public class AttributeFieldParser extends SDPParser
Attribute field parser.
version
1.0

Fields Summary
Constructors Summary
public AttributeFieldParser(String attributeField)
Creates new AttributeFieldParser.

param
attributeField string to be parsed

       
        this.lexer = new Lexer("charLexer", attributeField);
    
protected AttributeFieldParser()
Default constructor.


    
Methods Summary
public AttributeFieldattributeField()
Perform the attribute field parsing

return
the parsed attribute field
exception
ParseException if a parsing error occurs

	    AttributeField attributeField = new AttributeField();
			
	    this.lexer.match('a");
          
	    this.lexer.SPorHT();
	    this.lexer.match('=");
          
	    this.lexer.SPorHT();
                
                  
	    NameValue nameValue = new NameValue();

	    int ptr =   this.lexer.markInputPosition();
	    try {
		String name = lexer.getNextToken(':");
		this.lexer.consume(1);
		String value = lexer.getRest();
		nameValue = new NameValue
		    (name.trim(), value.trim());
	    } catch (ParseException ex) {
		this.lexer.rewindInputPosition(ptr);
		String rest = this.lexer.getRest();
		if (rest == null) 
		    throw new ParseException(this.lexer.getBuffer(),
					     this.lexer.getPtr());
		    nameValue = new NameValue(rest.trim(), null);
	    }
	    attributeField.setAttribute(nameValue);
               
	    this.lexer.SPorHT();
               
	    return attributeField;
    
public SDPFieldparse()
Perform the attribute field parsing

return
the parsed attribute field
exception
ParseException if a parsing error occurs

        return this.attributeField();