From Vectorworks Developer
Jump to navigation Jump to 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 class allows reading and writing XML files. The XML file is represented by three hierarchy instances of VectorWorks::Filing::IXMLFileNode interface.

Note XML Files have only one root node.


// ----------------------------------------------------------------------------------------------------
// {7274D087-3799-11DB-9C35-00508D5E9851}
static const VWIID IID_XMLFile = { 0x7274D087, 0x3799, 0x11DB, { 0x9C, 0x35, 0x00, 0x50, 0x8D, 0x5E, 0x98, 0x51 } };

class IXMLFile : public IVWUnknown
  virtual VCOMError VCOM_CALLTYPE CreateNew(const TXString& rootName) = 0;
  virtual VCOMError VCOM_CALLTYPE ReadFile(IFileIdentifier* pFileID) = 0;
  virtual VCOMError VCOM_CALLTYPE ReadBuffer(IXMLFileIOBuffer* pInputBuffer, EXMLEncoding encoding) = 0;
  virtual VCOMError VCOM_CALLTYPE WriteFile(IFileIdentifier* pFileID, EXMLEncoding encoding) = 0;
  virtual VCOMError VCOM_CALLTYPE WriteBuffer(IXMLFileIOBuffer* pOutputBuffer, EXMLEncoding encoding) = 0;
  virtual VCOMError VCOM_CALLTYPE GetRootNode(IXMLFileNode** ppOutNode) = 0;
  virtual VCOMError VCOM_CALLTYPE GetLastError(EXMLFileError& outError) = 0;
  virtual VCOMError VCOM_CALLTYPE SetFeature(EXMLFileFeature feature, bool bValue) = 0;


CreateNew Creates a new XML file structure.
ReadFile Reads an XML file from IFileIdentifier.
ReadBuffer Reads an XML file from memory buffer.
WriteFile Writes an XML file structure into IFileIdentifier file.
WriteBuffer Writes an XML file structure into memory buffer.
GetRootNode Returns VectorWorks::Filing::IXMLFileNode instance of the root node of the XML file.
GetLastError Obtain the last error that happened during XML processing.
SetFeature Set feature of the XML processing instance.


Note XML Files have only one root node.

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

typedef VCOMPtr<IXmlFile>  IXmlFilePtr;

XML routines can return one of the following eror codes:

const VCOMError	kVCOMError_XMLFile_UnknownError     = 100;
const VCOMError	kVCOMError_XMLFile_MemoryError      = 101;
const VCOMError	kVCOMError_XMLFile_Parser           = 102;
const VCOMError	kVCOMError_XMLFile_NoAttribute      = 103;
const VCOMError	kVCOMError_XMLFile_CannotCreateNode = 104;
const VCOMError	kVCOMError_XMLFile_ElementNotFound  = 105;
const VCOMError	kVCOMError_XMLFile_BadArrayIndex    = 106;
const VCOMError	kVCOMError_XMLFile_BadName          = 107;
const VCOMError	kVCOMError_XMLFile_DOMError         = 108;
const VCOMError	kVCOMError_XMLFile_XercesException  = 109;


See VCOM:Working with XML Files


Available from: VectorWorks 12

See Also

VCOM:VCOMPtr | VCOM:VectorWorks:Filing:IFolderIdentifier | VCOM:VectorWorks:Filing:IFileIdentifier | VCOM:VectorWorks:Filing:IXMLFileNode

[[VCOM:VCOMPtr]] | [[VCOM:VectorWorks:Filing:IFolderIdentifier]] | [[VCOM:VectorWorks:Filing:IFileIdentifier]] | [[VCOM:VectorWorks:Filing:IXMLFileNode]]