XML tag from LDM filer. More...
#include <LDM/xml/SbXmlTag.h>
Public Member Functions | |
bool | exist () |
const char * | getName () |
const char * | getText () |
SbXmlTag | getFirstChildTag () |
SbXmlTag | getNextSiblingTag () |
This class allows the application to read back a custom XML section that was inserted in a LDM file header using the method SoLDMConverter::setXmlCallback().
Let's suppose the following XML text appears in the LDM file header:
... <MY_CUSTOM_TAG_SECTION> text <CUSTOM_TAG1>value1</CUSTOM_TAG1> <CUSTOM_TAG2>value2</CUSTOM_TAG2> </MY_CUSTOM_TAG_SECTION> ...
The following code will produce the output below:
SoVolumeData* volData = new SoVolumeData(); // Volume from LDM file . . . SoVRLdmFileReader* reader = (SoVRLdmFileReader*)(volData->getReader()); SbXmlTag myTagSection = reader->getXmlTag( "MY_CUSTOM_TAG_SECTION" ); if (myTagSection.exist()) { const char* sectionName = myTagSection.getName(); const char* sectionText = myTagSection.getText(); for (SbXmlTag t = myTagSection.getFirstChildTag(); t.exist(); t = t.getNextSiblingTag()) { const char* tagName = t.getName(); const char* tagText = t.getText(); } }
Output:
MY_CUSTOM_TAG_SECTION:text CUSTOM_TAG1:value1 CUSTOM_TAG2:value2
bool SbXmlTag::exist | ( | ) |
Indicates if this XML tag is valid.
SbXmlTag SbXmlTag::getFirstChildTag | ( | ) |
Returns the first XML child tag.
const char* SbXmlTag::getName | ( | ) |
Returns the name of the XML tag.
SbXmlTag SbXmlTag::getNextSiblingTag | ( | ) |
Returns the next sibling XML child.
const char* SbXmlTag::getText | ( | ) |
Returns the text associated with the XML tag.