NO FRAMES

Class IloXmlReader

Definition file: ilconcert/iloreader.h

You can use an instance of IloXmlReader to read an IloModel or a IloSolution in XML format.

Constructor Summary
public IloXmlReader(IloEnv env, const char * fileName=0)
public IloXmlReader(IloXmlReaderI * impl)
Method Summary
public IloBoolcheckRttiOfObjectById(IloTypeIndex RTTI, IloRtti * exprI)
public IloBoolcheckRttiOfObjectById(IloTypeIndex RTTI, IloInt Xml_Id)
public IloBoolcheckTypeOfObjectById(IloTypeInfo type, IloInt Xml_Id)
public IloBoolcheckTypeOfObjectById(IloTypeInfo type, IloRtti * exprI)
public voiddeleteAllocatedMemory(const char * pointer)
public voiddeleteAllocatedMemory(char * pointer)
public IloXmlElement *findElement(IloXmlElement * root, const char * tag, const char * attribute, const char * value)
public IloXmlElement *findElementByTag(IloXmlElement * element, const char * tag)
public IloIntgetChildrenCardinal(IloXmlElement * element)
public IloEnvgetEnv()
public IloEnvI *getEnvImpl()
public IloXmlElement *getFirstSubElement(IloXmlElement * element)
public IloBoolgetIntAttribute(IloXmlElement * element, const char * attribute, IloInt & value)
public IloBoolgetNumAttribute(IloXmlElement * element, const char * attribute, IloNum & value)
public IloAnygetObjectById(IloInt id)
public IloXmlElement *getRoot()
public IloIntArray *getSerialized()
public IloIntArray *getSolutionSerialized()
public IloBoolisSerialized(IloInt id)
public IloBoolopenDocument()
public const char *readAttribute(IloXmlElement * element, const char * attribute)
public const char *readCData(IloXmlElement * element)
public const char *readComment(IloXmlElement * element)
public const char *readData(IloXmlElement * element)
public const char *readText(IloXmlElement * element)
public voidsetfileName(const char * fileName)
public IloIntstring2Int(const char * str)
public IloIntArraystring2IntArray(const char * str)
public IloIntRangestring2IntRange(IloXmlElement * element)
public IloIntSetstring2IntSet(const char * str)
public IloNumstring2Num(const char * str)
public IloNumArraystring2NumArray(const char * str)
Constructor Detail

IloXmlReader

public IloXmlReader(IloEnv env, const char * fileName=0)

This constructor creates an IloXmlReader object and makes it part of the environment env.

The fileName is set to 0 by default.


IloXmlReader

public IloXmlReader(IloXmlReaderI * impl)

This constructor creates an XML reader from its implementation object.


Method Detail

checkRttiOfObjectById

public IloBool checkRttiOfObjectById(IloTypeIndex RTTI, IloRtti * exprI)

This method checks the RTTI of the given object.


checkRttiOfObjectById

public IloBool checkRttiOfObjectById(IloTypeIndex RTTI, IloInt Xml_Id)

This method checks the RTTI of the object referenced by the identifier Xml_Id in the XML. This object must already be serialized.


checkTypeOfObjectById

public IloBool checkTypeOfObjectById(IloTypeInfo type, IloInt Xml_Id)

This method checks the TypeInfo of the object referenced by the id in the XML. This object must have been already serialized.


checkTypeOfObjectById

public IloBool checkTypeOfObjectById(IloTypeInfo type, IloRtti * exprI)

This method checks the TypeInfo of the given object


deleteAllocatedMemory

public void deleteAllocatedMemory(const char * pointer)

This member function frees the memory that has been allocated by the XML reader using, for example, the IloXmlWriter::Int2String member function.


deleteAllocatedMemory

public void deleteAllocatedMemory(char * pointer)

This member function frees the memory that has been allocated by the XML reader using, for example, the IloXmlWriter::Int2String member function.


findElement

public IloXmlElement * findElement(IloXmlElement * root, const char * tag, const char * attribute, const char * value)

This member function examines the XML element root to identify the XML child element denoted by tag, attribute, and value.


findElementByTag

public IloXmlElement * findElementByTag(IloXmlElement * element, const char * tag)

This member function examines the XML element element to identify the XML child element denoted by tag.


getChildrenCardinal

public IloInt getChildrenCardinal(IloXmlElement * element)

This member function counts the number of child elements of the XML element element.


getEnv

public IloEnv getEnv()

This member function gets the IloEnv of the object.


getEnvImpl

public IloEnvI * getEnvImpl()

This member function gets the implementation of the IloEnv of the object.


getFirstSubElement

public IloXmlElement * getFirstSubElement(IloXmlElement * element)

This member function gets the first child in the XML element element.


getIntAttribute

public IloBool getIntAttribute(IloXmlElement * element, const char * attribute, IloInt & value)

This member function checks the existence of attribute in the XML element element and converts it to an IloInt.


getNumAttribute

public IloBool getNumAttribute(IloXmlElement * element, const char * attribute, IloNum & value)

This member function checks the existence of attribute in the XML element element and converts it to an IloNum.


getObjectById

public IloAny getObjectById(IloInt id)

This member function gets the already serialized object of the given identifier id.

     IloDiff Diff(reader.getEnv(),
                      IloExpr((IloNumExprI*)reader.getObjectById(IdExpr1)),
                      IloExpr((IloNumExprI*)reader.getObjectById(IdExpr2)),
                      reader.readAttribute(element, IloXmlAttributeDef::Name));
 

The sample code creates a IloDiff from a XML element referencing its two expressions with the attributes IdRef1 and IdRef2.


getRoot

public IloXmlElement * getRoot()

This member function gets the XML root, that is, the XML document without the header.


getSerialized

public IloIntArray * getSerialized()

This member function gets the IDs of the serialized extractables and the unique IDs of the array of extractables that were serialized from the model.


getSolutionSerialized

public IloIntArray * getSolutionSerialized()

This member function gets the IDs of the serialized extractables and the unique IDs of the array of extractables that were serialized from the solution.


isSerialized

public IloBool isSerialized(IloInt id)

This member function checks whether the extractable with the ID id in the model has already been serialized.


openDocument

public IloBool openDocument()

This member function opens the XML document specified in the constructor or with the setFileName method.


readAttribute

public const char * readAttribute(IloXmlElement * element, const char * attribute)

This member function returns the value of the attribute in the XML element element.


readCData

public const char * readCData(IloXmlElement * element)

This member function reads the CDATA of the XML element element.


readComment

public const char * readComment(IloXmlElement * element)

This member function returns the value of the comment in the XML element element.


readData

public const char * readData(IloXmlElement * element)

This member function reads the data of the XML element element.


readText

public const char * readText(IloXmlElement * element)

This member function returns the value of the text contained in the XML element element, independently of its origin (data or CDATA).


setfileName

public void setfileName(const char * fileName)

This member function sets fileName as the file from which to read the XML.


string2Int

public IloInt string2Int(const char * str)

This member function converts str into an IloInt.


string2IntArray

public IloIntArray string2IntArray(const char * str)

This member function converts str into an IloIntArray.


string2IntRange

public IloIntRange string2IntRange(IloXmlElement * element)

This member function converts str into an IloIntRange.


string2IntSet

public IloIntSet string2IntSet(const char * str)

This member function converts str into an IloIntSet.


string2Num

public IloNum string2Num(const char * str)

This member function converts str into an IloNum.


string2NumArray

public IloNumArray string2NumArray(const char * str)

This member function converts str into an IloNumArray.