Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
SXmlWriter Class Reference

Class to write xml files Sample on how you can write an xml file. More...

#include <SXmlWriter.h>

Inheritance diagram for SXmlWriter:
SObject

Public Slots

static SXmlWriter New ()
 Default constructor to instantiate a XmlWriter. More...
 
 SetFile (SFile File)
 Sets the current file to device. Setting the device resets reader. More...
 
String toString ()
 Get the type of the variable. More...
 
static String toString ()
 Get the type of the variable. More...
 
 WriteAttribute (String qualifiedName, String value)
 Writes an attribute with qualifiedName and value. This function can only be called after writeStartElement() before any content is written. More...
 
 WriteEndDocument ()
 Closes all remaining open start elements and writes a newline. More...
 
 WriteEndElement ()
 Closes the previous start element. More...
 
 WriteStartDocument ()
 Writes a document start with XML version number "1.0". This also writes the encoding information. More...
 
 WriteStartElement (String qualifiedName)
 Writes a start element with qualifiedName. Subsequent calls to WriteAttribute() will add attributes to this element. More...
 
- Public Slots inherited from SObject
 Clear ()
 To deallocate memory of the object. More...
 
String toString ()
 Get the type of the variable. More...
 

Detailed Description

Class to write xml files Sample on how you can write an xml file.

var xmlWriter = SXmlWriter.New();
var file = SFile.New("c:/myfile.xml");
// Open XML file to read
if ( !file.Open(SFile.WriteOnly) )
throw new Error( 'Failed to read file.' );
xmlWriter.SetFile(file);
// Writes a document start with the XML version number version.
xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement("Image");
xmlWriter.WriteAttribute("width", 1024);
xmlWriter.WriteAttribute("height", 1024);
xmlWriter.WriteEndElement();
// end document
xmlWriter.WriteEndDocument();
file.Close();
The Sfile class provides an interface for reading from and writing to files.
Definition: SFile.h:20
@ WriteOnly
Definition: SFile.h:32
static SFile New(String name)
Constructs a new file object to represent the file with the given name.
Class to write xml files Sample on how you can write an xml file.
Definition: SXmlWriter.h:42
static SXmlWriter New()
Default constructor to instantiate a XmlWriter.

Member Function Documentation

◆ New

static SXmlWriter SXmlWriter::New ( )
staticslot

Default constructor to instantiate a XmlWriter.

◆ SetFile

SXmlWriter::SetFile ( SFile  File)
slot

Sets the current file to device. Setting the device resets reader.

◆ toString [1/2]

String SXmlWriter::toString ( )
slot

Get the type of the variable.

◆ toString [2/2]

static String SXmlWriter::toString ( )
staticslot

Get the type of the variable.

◆ WriteAttribute

SXmlWriter::WriteAttribute ( String  qualifiedName,
String  value 
)
slot

Writes an attribute with qualifiedName and value. This function can only be called after writeStartElement() before any content is written.

◆ WriteEndDocument

SXmlWriter::WriteEndDocument ( )
slot

Closes all remaining open start elements and writes a newline.

◆ WriteEndElement

SXmlWriter::WriteEndElement ( )
slot

Closes the previous start element.

◆ WriteStartDocument

SXmlWriter::WriteStartDocument ( )
slot

Writes a document start with XML version number "1.0". This also writes the encoding information.

◆ WriteStartElement

SXmlWriter::WriteStartElement ( String  qualifiedName)
slot

Writes a start element with qualifiedName. Subsequent calls to WriteAttribute() will add attributes to this element.