Close

Relief for ODA Team in Ukraine

Learn more
ODA PRC SDK
Sample Console Application That Illustrates the Export a .prc file to XML Format

Summary

ODA Product: ODA PRC SDK
Sample Name: OdPrcToXml
Categories: C++ / Advanced / Working with .prc files / Android, iOS, macOS, Linux, Windows
Source Code Location: Prc/Examples/OdPrcToXml

Description

A console sample application that reads a .prc file and dumps its content to an .xml file.

Run Sample Application

To run the OdPrcToXml sample application, please do the following:

  1. Open the terminal window and go to the directory where the sample binary file is allocated:
    • For Windows® platforms: <PRC_DIR>\exe\<version>
    • For Non-Windows platforms: <PRC_DIR>/bin/<version>

    <PRC_DIR> is a directory where you unpacked the PRC SDK archive.

    To determine your <version> parameter, please see the appropriate section in the Download ODA PRC SDK topic.

  2. Run the sample with appropriate arguments:
    
                OdPrcToXml <filename> <xml filename> [AUDIT]
              
    filename Full path to the input .prc file.
    xml filename Full path to the output .xml file. It will contain all dumped content from the input .prc file.
    AUDIT Optional parameter. If specified, enables audit functionality for the dumped input .prc file.

If the application executed properly, you will see the following console window:

If an error occurs during the application execution, you will see an appropriate error message in the console window. For example, the following picture illustrates the program output in the case when it was called with wrong arguments:

The content of the specified .prc file is exported into an xml file determined with the xml filename parameter:

Sample Application Structure

Sample application source code is located in the OdPrcToXml.cpp file. This file contains the application entry point (main() function). The main() function also contains common sections before and after the source code section that illustrate how to dump a .prc file into an .xml file.

The following steps represent the dumping routine implemented in the sample application:

  1. Create an instance of OdPrcToXmlModule; this module implements functionality for dumping .prc contents to an .xml file.
  2. Create a stream buffer for writing contents to an .xml file.
  3. Create a stream buffer for reading contents from a .prc file.
  4. Run the dumping process and check the result (OdResult enumerator value).

Note that the prcToXml() method of the OdPrcToXmlModule module accepts a set of parameters that are represented with bit flags (ControlFlags class).

See Also:

Export a .prc File to an .xml File
ODA PRC SDK Sample Applications
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.