Collapse the table of content
Expand the table of content



Provides data for XAML parser error events.

ParserErrorEventArgs is obtained as input for your own event handlers.

Parser errors are the result of initial XAML source parsing. Parser errors might result from cases in which the XAML is not well-formed XML, or for specific Silverlight object-model violations. For example, you would get a parser error if you attempted to specify a child element for an element that did not support a child collection.

The XmlAttribute and XmlElement properties are not implemented in Silverlight.

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

// errorArgs is an instance of ParserErrorEventArgs.
    if(errorArgs.ErrorType == "ParserError")
      var parserErrorMsg = "Silverlight Parser Error  \n\n";
      // Provide basic error event information.
      parserErrorMsg += "Error Type:    " + errorArgs.errorType     + "\n";
      parserErrorMsg += "Error Message: " + errorArgs.errorMessage  + "\n";
      parserErrorMsg += "Error Code:    " + errorArgs.errorCode  + "\n";
      //Provide 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.

Community Additions

© 2015 Microsoft