CharPosition Property (ParserErrorEventArgs)

The character position within the line that the parser error occurred on.

XAML
Cannot be used in XAML.
Scripting
value = eventargs.CharPosition

Property Value

integer

The character position the parser error occurred on.

This property is read/write, but should be considered read-only because there is no reason to change the reported information. There is no default.

Remarks

Because you cannot raise your own errors in the Silverlight 1.0 eventing model, the settable aspect of this property does not have a practical usage. Usually, you will only use this property to get its value.

Examples

The following JavaScript example shows the portion of an event handler that displays error information specific to parser errors.

JavaScript
    // errorArgs is an instance of ParserErrorEventArgs
    if(errorArgs.ErrorType == "ParserError")
    {
      var parserErrorMsg = "Silverlight Parser Error  \n\n";
               
      // Basic error event informaiton.
      parserErrorMsg += "Error Type:    " + errorArgs.errorType     + "\n";
      parserErrorMsg += "Error Message: " + errorArgs.errorMessage  + "\n";
      parserErrorMsg += "Error Code:    " + errorArgs.errorCode  + "\n";
            
      //Parser specific error event information.
      parserErrorMsg += "XamlFile:      " + errorArgs.xamlFile      + "\n";
      parserErrorMsg += "XmlElement:    " + errorArgs.xmlElement    + "\n";
      parserErrorMsg += "XmlAttribute:  " + errorArgs.xmlAttribute  + "\n";
      parserErrorMsg += "Line:          " + errorArgs.lineNumber    + "\n";
      parserErrorMsg += "Position:      " + errorArgs.charPosition  + "\n";
            
      // Display the error message.
      alert(parserErrorMsg);
    } 

Applies To

ParserErrorEventArgs

See Also

Silverlight Application Scripting Error Handling
Using the CreateFromXaml Method
XAML Syntax Overview
ErrorEventArgs
RuntimeErrorEventArgs