src/PredFinder/elf/ElfString.cpp
/**
 * Converts this string to an XML element (as determined by _type)
 * using the Xerces-C++ library.
 *
 * XMLPlatformUtils::Initialize() must be called before this method.
 *
 * @param doc An already-instantiated Xerces DOMDocument that
 * provides namespace context for the created element (since
 * Xerces doesn't support easy anonymous element import).
 * @return The constructed DOMElement
 *
 * @author nward@bbn.com
 * @date 2010.06.02
 **/
Converts this string to an XML element (as determined by _type)
using the Xerces-C++ library.

:Initialize() must be called before this method.

@param doc An already-instantiated Xerces DOMDocument that
provides namespace context for the created element (since
Xerces doesn't support easy anonymous element import).
@return The constructed DOMElement


Converts this string to an XML element ( as determined by _type ) using the Xerces - C ++ library . : Initialize () must be called before this method . @param doc An already - instantiated Xerces DOMDocument that provides namespace context for the created element ( since Xerces doesn ' t support easy anonymous element import ) . @return The constructed DOMElement
DOMElement* ElfString::to_xml(DOMDocument* doc) const {
	DOMElement* string;
	switch (_type) {
	case TYPE:
		string = SXMLUtil::createElement(doc, "type");
		SXMLUtil::setAttributeFromStdWString(string, "type", _value);
		break;
	case NAME:
		string = SXMLUtil::createElement(doc, "name");
		SXMLUtil::setAttributeFromStdWString(string, "name", _value);
		break;
	case DESC:
		string = SXMLUtil::createElement(doc, "desc");
		SXMLUtil::setAttributeFromStdWString(string, "desc", _value);
		break;
	}
	if (_start.is_defined() && _end.is_defined()) {
		SXMLUtil::setAttributeFromEDTOffset(string, "start", _start);
		SXMLUtil::setAttributeFromEDTOffset(string, "end", _end);
	}
	if (ParamReader::isParamTrue("elf_include_text_excerpts")) {
        SerifXML::xstring x_str = SerifXML::transcodeToXString(_string.c_str());
		DOMText* string_cdata = doc->createTextNode(x_str.c_str());
		string->appendChild(string_cdata);
	}
	return string;
}
DOMElement * ElfString :: to_xml ( DOMDocument * doc ) const { DOMElement * string ; switch ( _type ) { case TYPE : string = SXMLUtil :: createElement ( doc , " " ) ; SXMLUtil :: setAttributeFromStdWString ( string , " " , _value ) ; break ; case NAME : string = SXMLUtil :: createElement ( doc , " " ) ; SXMLUtil :: setAttributeFromStdWString ( string , " " , _value ) ; break ; case DESC : string = SXMLUtil :: createElement ( doc , " " ) ; SXMLUtil :: setAttributeFromStdWString ( string , " " , _value ) ; break ; } if ( _start . is_defined ( ) && _end . is_defined ( ) ) { SXMLUtil :: setAttributeFromEDTOffset ( string , " " , _start ) ; SXMLUtil :: setAttributeFromEDTOffset ( string , " " , _end ) ; } if ( ParamReader :: isParamTrue ( " " ) ) { SerifXML :: xstring x_str = SerifXML :: transcodeToXString ( _string . c_str ( ) ) ; DOMText * string_cdata = doc -> createTextNode ( x_str . c_str ( ) ) ; string -> appendChild ( string_cdata ) ; } return string ; }
Converts this string to an XML element (as determined by _type)
 using the Xerces-C++ library.
Converts this string to an XML element ( as determined by _type ) using the Xerces - C ++ library .
// Create a new element based on the type and store this string's value
 // as an attribute of the same name
 // If present, insert the offsets as attributes of the element
 // Optionally print the text evidence for this string
 // Done
