4D v16.3

DOM EXPORT TO FILE

Home

 
4D v16.3
DOM EXPORT TO FILE

DOM EXPORT TO FILE 


 

DOM EXPORT TO FILE ( elementRef ; filePath ) 
Parameter Type   Description
elementRef  String in Root XML element reference
filePath  Text in Full access path of the file

The DOM EXPORT TO FILE command stores an XML tree in a file on disk.

Pass the root element reference to export in the elementRef parameter.

Pass the full access path to use or create of the export file in filePath. If the file does not already exist, it is created.

If you only pass a file name (without an access path), a search for the file will take place or it will be created next to the structure file.

If you pass an empty string (""), a standard open file and new file dialog box appears.

In XML, line breaks are not significant regardless of whether they are within or between XML elements. Internally, XML uses standard LF characters as line separators.

During import and export operations, line break characters can be converted. During an import, the XML parser replaces CRLF characters (standard line breaks under Windows) with LF characters. During export, LF characters are replaced by CR characters on macOS and CRLF characters on Windows.

If you want to keep carriage returns, you must include them in an XML CDATA element so that they will not be processed by the XML parser. Instead of CRLF characters, you can also use "<br/>" characters, which are explicit carriage returns that will not be processed by the parser.

Example  

This example stores the tree vElemRef in the file MyDoc.xml:

 DOM EXPORT TO FILE(vElemRef;"C:\\folder\MyDoc.xml")

If the command has been executed correctly, the system variable OK is set to 1. Otherwise, it is set to 0 and an error is generated.

An error is generated when:

  • The element reference is invalid,
  • The specified access path is invalid,
  • The storage volume returns an error (insufficient disk space, etc.).



See also 

DOM EXPORT TO VAR
SVG EXPORT TO PICTURE

 
PROPERTIES 

Product: 4D
Theme: XML DOM
Number: 862

The OK variable is changed by the commandThis command modifies the Error system variableThis command can be run in preemptive processes

 
HISTORY 

Created: 4D 2004

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)