From Vectorworks Developer
Jump to: navigation, search

.SDK|SDK ..SDK:Types|SDK Types ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference


namespace VectorWorks::Filing

This interface validates a XML file against XML Schema.


// ----------------------------------------------------------------------------------------------------
// {384AE042-47F6-44a4-9980-622320B292F5}
static const VWIID IID_XMLFileValidator = { 0x384ae042, 0x47f6, 0x44a4, { 0x99, 0x80, 0x62, 0x23, 0x20, 0xb2, 0x92, 0xf5 } };

class IXMLFileValidator : public IVWUnknown
  virtual VCOMError VCOM_CALLTYPE SetXML(IFileIdentifier* pXMLFileID) = 0;
  virtual VCOMError VCOM_CALLTYPE SetXML(IXMLFileIOBuffer* pInputBuffer, EXMLEncoding encoding) = 0;

  virtual VCOMError VCOM_CALLTYPE SetSchema(IFileIdentifier* pSchemaFileID) = 0;
  virtual VCOMError VCOM_CALLTYPE SetSchema(IXMLFileIOBuffer* pSchemaBuffer, EXMLEncoding encoding) = 0;

  virtual VCOMError VCOM_CALLTYPE SetErrorListener(IXMLFileValidatorErrorListener* pListener) = 0;

  virtual VCOMError VCOM_CALLTYPE Validate() = 0;

  virtual VCOMError VCOM_CALLTYPE ValidateXMLName(const TXString& name) = 0;
  virtual VCOMError VCOM_CALLTYPE CreateXMLName(const TXString& name, TXString& outXMLName, IXMLFileValidatorNameErrorsListener* pErrListener = NULL) = 0;


SetXML Set XML for validation in this instance.
SetSchema Set XML Schema that will be used for validation.
SetErrorListener Set error listener instance that will receive error messages.
Validate Execute validation on the XML file using the XML Schema specified in this class.
ValidateXMLName Determines if the specified name is a valid XML name.
CreateXMLName Creates a valid XML name for the specified one. If the specified is valid then it is returned.


Also every validation routine returns error codes from namespace VCOM:VectorWorks:Filing:XMLErrors.

There is predefined type for smart VCOM pointer VCOMPtr to IXMLFileValidator interface:

typedef VCOMPtr<IXMLFileValidator>  IXMLFileValidatorPtr;

If you use IXMLFileValidatorErrorListener::Validate without specifying schema, validation will use the schema that is provided by the XML file itself. If it doesn't provide schema, the file will not be validated.

If you provide schema in IXMLFileValidatorErrorListener::Validate call, this schema will be used regardless if the XML provides schema or not.

Example of XML providing shcema:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Root   xmlns:xsi=''
  <inner>inner value</inner>
  <sub1>sub value</sub1>


See VCOM:Working with XML Files#Validating


Available from: VectorWorks 12

See Also

VCOM:VCOMPtr | VCOM:VectorWorks:Filing:IFolderIdentifier | VCOM:VectorWorks:Filing:IFileIdentifier | VCOM:VectorWorks:Filing:IXMLFile
[[VCOM:VCOMPtr]] | [[VCOM:VectorWorks:Filing:IFolderIdentifier]] | [[VCOM:VectorWorks:Filing:IFileIdentifier]] | [[VCOM:VectorWorks:Filing:IXMLFile]]
Personal tools

Advanced Search
See Also