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

Allow to write xml files. More...

Public Member Functions

 SetFile (SFile file)
 Set the current file to device. Setting the device resets reader. More...
 
 SXmlWriter ()
 Default constructor to instantiate a XmlWriter. More...
 
string toString ()
 Get the type of the variable. More...
 
 WriteAttribute (string qualifiedName, any value)
 Write an attribute with qualifiedName and value. This function can only be called after SXmlWriter.writeStartElement() before any content is written. More...
 
 WriteEndDocument ()
 Close all remaining open start elements and write a newline. More...
 
 WriteEndElement ()
 Close the previous start element. More...
 
 WriteStartDocument ()
 Write a document start with XML version number "1.0". This also writes the encoding information. More...
 
 WriteStartElement (string qualifiedName)
 Write a start element with qualifiedName. Subsequent calls to WriteAttribute() will add attributes to this element. More...
 

Static Public Member Functions

static SXmlWriter New ()
 Default constructor to instantiate a XmlWriter. More...
 

Detailed Description

Allow 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();
Provide an interface for reading from and writing to files on disk.
Definition: Reshaper.h:1416
@ WriteOnly
The file is opened for writing. Note that this mode implies Truncate.
Definition: Reshaper.h:1425
static SFile New(string name)
Construct a new file object to represent the file with the given name.
Allow to write xml files.
Definition: Reshaper.h:2434
static SXmlWriter New()
Default constructor to instantiate a XmlWriter.

Constructor & Destructor Documentation

◆ SXmlWriter()

SXmlWriter::SXmlWriter ( )

Default constructor to instantiate a XmlWriter.

Member Function Documentation

◆ New()

static SXmlWriter SXmlWriter::New ( )
static

Default constructor to instantiate a XmlWriter.

Returns
(SXmlWriter) The new SXmlWriter.

◆ SetFile()

SXmlWriter::SetFile ( SFile  file)

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

Parameters
file(SFile) The SFile to set.

◆ toString()

string SXmlWriter::toString ( )

Get the type of the variable.

Returns
(string) The type name

◆ WriteAttribute()

SXmlWriter::WriteAttribute ( string  qualifiedName,
any  value 
)

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

Parameters
qualifiedName(string) The name of the attribute to write
value(any) The value of the attribute to write

◆ WriteEndDocument()

SXmlWriter::WriteEndDocument ( )

Close all remaining open start elements and write a newline.

◆ WriteEndElement()

SXmlWriter::WriteEndElement ( )

Close the previous start element.

◆ WriteStartDocument()

SXmlWriter::WriteStartDocument ( )

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

◆ WriteStartElement()

SXmlWriter::WriteStartElement ( string  qualifiedName)

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

Parameters
qualifiedName(string) The name of the element