Check Validity of Current Document

www.altova.com Imprimir este apartado Página anterior Subir un nivel Página siguiente

Inicio >  Referencia del programador > ActiveX Integration > ActiveX Integration Examples > HTML > HTML Integration at Application Level >

Check Validity of Current Document

The validity of the current document is checked using the following script:.

 

// check validity of current document.
// if validation fails, show validation result in alert box .
function BtnTest()
{
  // get top-level object of automation interface
  var objApp = objStyleVisionControl.Application;
 
  // get the active document
  var objDocument = objApp.ActiveDocument;
 
  if ( objDocument == null )
     alert( "no active document found" );
  else
  {
    // define as arrays to support their usage as return parameters
    var errorText = new Array(1);
    var errorPos = new Array(1);
    var badData = new Array(1);
 
    var valid = objDocument.IsValid(errorText, errorPos, badData);
 
    if (! valid)
     {
          // compose the error description
          var text = errorText;
 
          // access that XMLData object only if filled in
          if (badData[0] != null)
              text += "(" + badData[0].Name + "/" + badData[0].TextValue + ")";
 
 
           alert("Validation error[" + errorPos + "]: " + text);
     }
    else
        alert("Docuent is valid");
  }
}

 

 


© 2019 Altova GmbH