bool qm::AutoPilotContentHandler::startElement(const WCHAR* pwszNamespaceURI, const WCHAR* pwszLocalName, const WCHAR* pwszQName, const Attributes& attributes) { if (wcscmp(pwszLocalName, L"entry") == 0) { if (state_ != STATE_AUTOPILOT) return false; bEnabled_ = true; for (int n = 0; n < attributes.getLength(); ++n) { const WCHAR* pwszAttrName = attributes.getLocalName(n); if (wcscmp(pwszAttrName, L"enabled") == 0) bEnabled_ = wcscmp(attributes.getValue(n), L"false") != 0; else return false; } state_ = STATE_ENTRY; } else { struct { const WCHAR* pwszName_; State stateBefore_; State stateAfter_; } states[] = { { L"autoPilot", STATE_ROOT, STATE_AUTOPILOT }, { L"course", STATE_ENTRY, STATE_COURSE }, { L"interval", STATE_ENTRY, STATE_INTERVAL } }; int n = 0; for (n = 0; n < countof(states); ++n) { if (wcscmp(pwszLocalName, states[n].pwszName_) == 0) { if (state_ != states[n].stateBefore_) return false; if (attributes.getLength() != 0) return false; state_ = states[n].stateAfter_; break; } } if (n == countof(states)) return false; } return true; }
void startElement(const XMLCh* const uri,const XMLCh* const localname, const XMLCh* const qname, const Attributes& attributes) { //cout << "TestHandler::startElement: " << StrX(qname) << endl; char* buf = XMLString::transcode(qname); string sbuf(buf); if ( sbuf == tag ) { read = true; } XMLString::release(&buf); if ( read ) { // copy start element tag with attributes cout << "<" << StrX(qname).localForm(); unsigned int len = attributes.getLength(); for (unsigned int index = 0; index < len; index++) { cout << " " << attributes.getQName(index) << "=\"" << attributes.getValue(index) << "\""; } cout << ">"; } };
void ILI2Handler::startElement( CPL_UNUSED const XMLCh* const uri, CPL_UNUSED const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs ) { // start to add the layers, features with the DATASECTION char *tmpC = NULL; m_nEntityCounter = 0; if ((level >= 0) || (cmpStr(ILI2_DATASECTION, tmpC = XMLString::transcode(qname)) == 0)) { level++; if (level >= 2) { // create the dom tree DOMElement *elem = (DOMElement*)dom_doc->createElement(qname); // add all attributes unsigned int len = attrs.getLength(); for (unsigned int index = 0; index < len; index++) elem->setAttribute(attrs.getQName(index), attrs.getValue(index)); dom_elem->appendChild(elem); dom_elem = elem; } } XMLString::release(&tmpC); }
void XMLWriter::declareAttributeNamespaces(const Attributes& attributes) { for (int i = 0; i < attributes.getLength(); i++) { XMLString namespaceURI = attributes.getURI(i); XMLString localName = attributes.getLocalName(i); XMLString qname = attributes.getQName(i); if (!localName.empty()) { XMLString prefix; XMLString splitLocalName; Name::split(qname, prefix, splitLocalName); if (prefix.empty()) prefix = _namespaces.getPrefix(namespaceURI); if (prefix.empty() && !namespaceURI.empty() && !_namespaces.isMapped(namespaceURI)) { prefix = newPrefix(); _namespaces.declarePrefix(prefix, namespaceURI); } const XMLString& uri = _namespaces.getURI(prefix); if ((uri.empty() || uri != namespaceURI) && !namespaceURI.empty()) { _namespaces.declarePrefix(prefix, namespaceURI); } } } }
void XMLTreeGenerator::startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs) { string name = XMLUtil::trim(XMLUtil::WideCharToString(localname )); if (name.empty() ) return; XMLTree* pTree = NULL; if (m_pBuffer == NULL ) { m_pRoot->SetName(name); pTree = m_pRoot; } else { pTree = m_pBuffer->AddChild(name); } for (unsigned int i = 0; i < attrs.getLength(); i++ ) { pTree->AddAttribute( XMLUtil::trim(XMLUtil::WideCharToString(attrs.getLocalName(i ) ) ), XMLUtil::trim(XMLUtil::WideCharToString(attrs.getValue(i ) ) )); } m_pBuffer = pTree; }
void MySAX2Handler::startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs) { char* message = XMLString::transcode(localname); if (strcmp(message, "TIME_SLOT") == 0) { string label; int value; for (int i=0; i<attrs.getLength(); i++) { char *localname = XMLString::transcode(attrs.getLocalName(i)); char *atvalue = XMLString::transcode(attrs.getValue(i)); if (strcmp(localname, "TIME_SLOT_ID") == 0) { label = atvalue; } else if (strcmp(localname, "TIME_VALUE") == 0) { value = atoi(atvalue); } //cout << localname << " " << value << endl; time_slots[label] = value; XMLString::release(&localname); XMLString::release(&atvalue); } cout << label << " " << value << endl; } else { cout << "I saw element: "<< message << endl; } XMLString::release(&message); }
void startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs ) { theOStream << "<" << qname; for ( unsigned int i = 0; i < attrs.getLength(); i++ ) { theOStream << " " << attrs.getQName( i ) << "=\"" << attrs.getValue( i ) << "\""; } theOStream << ">"; }
// --------------------------------------------------------------------------- // XSerializerHandlers: Implementation of the SAX DocumentHandler interface // --------------------------------------------------------------------------- void XSerializerHandlers::startElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname , const Attributes& attrs) { fElementCount++; fAttrCount += attrs.getLength(); }
// --------------------------------------------------------------------------- // SAX2CountHandlers: Implementation of the SAX DocumentHandler interface // --------------------------------------------------------------------------- void SAX2CountHandlers::startElement(const XMLCh* const /* uri */ , const XMLCh* const /* localname */ , const XMLCh* const /* qname */ , const Attributes& attrs) { fElementCount++; fAttrCount += attrs.getLength(); }
void GpXmlStateMachine::SetAttributes(GpType* target, const Attributes& attrs) { XMLSize_t numAtts = attrs.getLength(); string retValue; map<string, string> attributes; DEBOUT("GpXmlStateMachine::SetAttributes - Type"); if (numAtts > 0) { for (XMLSize_t i = 0; i < numAtts; i++) { string local(XMLString::transcode(attrs.getLocalName(i) ) ); string value(XMLString::transcode(attrs.getValue(i) ) ); attributes[local] = value; DEBOUT(i); DEBOUT(local); DEBOUT(value); } // Checking the member for constness if (FindAttribute(attributes, ConstStr, retValue) ) { if (retValue.compare(TrueStr) == 0) { target->Const(true); } } // Checking the member for staticness if (FindAttribute(attributes, StaticStr, retValue) ) { if (retValue.compare(TrueStr) == 0) { target->Static(true); } } // Checking if the member is a pointer or reference if (FindAttribute(attributes, DirecStr, retValue) ) { if (retValue.compare(PtrStr) == 0) { target->Direc(POINTER); DEBOUT("Pointer"); } else { if (retValue.compare(RefStr) == 0) { target->Direc(REFERENCE); DEBOUT("Reference"); } } } } }
void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes) { where("startElement"); std::cout << "uri: " << uri << std::endl << "localName: " << localName << std::endl << "qname: " << qname << std::endl; std::cout << "Attributes: " << std::endl; for (int i = 0; i < attributes.getLength(); ++i) { std::cout << attributes.getLocalName(i) << "=" << attributes.getValue(i) << std::endl; } }
void AttributesImpl::setAttributes(const Attributes& attributes) { if (&attributes != this) { int count = attributes.getLength(); _attributes.clear(); _attributes.reserve(count); for (int i = 0; i < count; i++) { addAttribute(attributes.getURI(i), attributes.getLocalName(i), attributes.getQName(i), attributes.getType(i), attributes.getValue(i)); } } }
// --------------------------------------------------------------------------- // SAX2SortAttributesFilter: Overrides of the SAX2XMLFilter interface // --------------------------------------------------------------------------- void SAX2SortAttributesFilter::startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attributes) { AttrList sortedList(attributes.getLength()); for(unsigned int i=0;i<attributes.getLength();i++) { unsigned int j; for(j=0;j<sortedList.getLength();j++) { if(XMLString::compareString(sortedList.elementAt(j)->qName,attributes.getQName(i))>=0) break; } Attr* pClone=new Attr; pClone->qName = attributes.getQName(i); pClone->uri = attributes.getURI(i); pClone->localPart = attributes.getLocalName(i); pClone->value = attributes.getValue(i); pClone->attrType = attributes.getType(i); sortedList.insertElementAt(pClone, j); } SAX2XMLFilterImpl::startElement(uri, localname, qname, sortedList); }
void currencyHandler::startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes) { // where("startElement"); std::cout << "start element uri: " << uri << std::endl << "localName: " << localName << std::endl << "qname: " << qname << std::endl; if (localName.compare("resource") == 0) { std::cout << " Quote starting here.." << std::endl; inQuote = true; } else if (localName.compare("field") == 0) { std::cout << " field starting here.." << std::endl; // std::cout<<" field value is "<<attributes.getValue(i)<<std::endl; } std::cout << "Attributes: " << std::endl; for (int i = 0; i < attributes.getLength(); ++i) { std::cout << " attributes.getValue(i) : " << attributes.getValue(i) << std::endl; if (attributes.getValue(i).compare("symbol") == 0) { currentFieldReading = symbolType; } else if (attributes.getValue(i).compare("ts") == 0) { currentFieldReading = tsType; } else if (attributes.getValue(i).compare("utctime") == 0) { currentFieldReading = utctimelType; } else if (attributes.getValue(i).compare("volume") == 0) { currentFieldReading = volumeType; } else if (attributes.getValue(i).compare("price") == 0) { currentFieldReading = priceType; } else if (attributes.getValue(i).compare("name") == 0) { currentFieldReading = nameType; } else if (attributes.getValue(i).compare("type") == 0) { currentFieldReading = typeType; } } }
void ThreadParser::SAX2Handler::startElement(const XMLCh *const /*uri*/, const XMLCh *const localname, const XMLCh *const /*qname*/, const Attributes& attributes) { SAX2Instance->addToCheckSum(localname); XMLSize_t n = attributes.getLength(); XMLSize_t i; for (i=0; i<n; i++) { const XMLCh *attNam = attributes.getQName(i); SAX2Instance->addToCheckSum(attNam); const XMLCh *attVal = attributes.getValue(i); SAX2Instance->addToCheckSum(attVal); } }
// Read tag with name *theTag and return its value as a double // If not found, return the supplied default value // Main use is for command with a single numeric tag double CommonReadHandler::ReadNumericAttribute(const char *theTag,const Attributes& attrs,double defaultValue) { int i,numAttr=(int)attrs.getLength(); char *aName,*value; double attrValue=defaultValue; for(i=0; i<numAttr; i++) { aName=XMLString::transcode(attrs.getLocalName(i)); if(strcmp(aName,theTag)==0) { value=XMLString::transcode(attrs.getValue(i)); sscanf(value,"%lf",&attrValue); delete [] aName; delete [] value; break; } delete [] aName; } return attrValue; }
void CVxmlSAXHandler::startElement( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs ){ TTagAttributes iAttributes char* pTagName; TTagAttribute iAttr; //get Tag's name and Attributes pTagName = XMLString::transcode(localname); // cout<<"attrs:"<<endl; for(int i=0;i<attrs.getLength();i++) { //get the Attribute's infomation iAttr.pName = XMLString::transcode(attrs.getLocalName(i)); iAttr.pType = XMLString::transcode(attrs.getType(i)); iAttr.pValue = XMLString::transcode(attrs.getValue(i)); // add to attributes's vector in order to send to Vxml Builder iAttributes.push_back(iAttr); // cout<<"\tLocalName="<<XMLString::transcode(attrs.getLocalName(i)); // cout<<"\tType="<<XMLString::transcode(attrs.getType(i)); // cout<<"\tVaule="<<XMLString::transcode(attrs.getValue(i))<<endl; } // build the Module by pass the infomation to Vxml Builder m_iBuilder->StartModule(pTagName,iAttributes); // release the resource XMLString::release(&pTagName); for(int i=0;i<iAttributes.size();i++) { iAttr = iAttributes.at(i); XMLString::release(&iAttr.pName); XMLString::release(&iAttr.pAttrType); XMLString::release(&iAttr.pAttrValue); } return; }
// Read first 'units' attribute and return a scaling factor an input quantity // to convert to standard analysis units // The options are for time, length, and velocity units // If no 'units' found or invalid one found, return 1. double CommonReadHandler::ReadUnits(const Attributes& attrs,int type) { int i,numAttr=(int)attrs.getLength(); char *aName,*value; double attrScale=1.; for(i=0; i<numAttr; i++) { aName=XMLString::transcode(attrs.getLocalName(i)); if(strcmp(aName,"units")==0) { value=XMLString::transcode(attrs.getValue(i)); attrScale = UnitsController::UnitsAttribute(value,type); delete [] aName; delete [] value; break; } delete [] aName; } return attrScale; }
virtual void startElement(const String& ns, const String& local, const String& qname, const Attributes& atts) { try { if(ns == QC_T("http://www.google.com/ns")) {testPassed(QC_T("check ns uri"));} else {testFailed(QC_T("check ns uri"));} } catch(Exception& e) { uncaughtException(e.toString(), QC_T("check ns uri")); } try { if(local == QC_T("test")) {testPassed(QC_T("check local"));} else {testFailed(QC_T("check local"));} } catch(Exception& e) { uncaughtException(e.toString(), QC_T("check local")); } try { if(qname == QC_T("qc:test")) {testPassed(QC_T("check qname"));} else {testFailed(QC_T("check qname"));} } catch(Exception& e) { uncaughtException(e.toString(), QC_T("check qname")); } try { if(atts.getLength() == (1 + NamespaceAttributes)) {testPassed(QC_T("check atts"));} else {testFailed(QC_T("check atts"));} } catch(Exception& e) { uncaughtException(e.toString(), QC_T("check atts")); } try { if(atts.getType(0) == QC_T("CDATA")) {testPassed(QC_T("check att type"));} else {testFailed(QC_T("check att type"));} } catch(Exception& e) { uncaughtException(e.toString(), QC_T("check att type")); } }
void SAX2PrintHandlers::startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attributes) { // The name has to be representable without any escapes fFormatter << XMLFormatter::NoEscapes << chOpenAngle ; if ( fExpandNS ) { if (XMLString::compareIString(uri,XMLUni::fgZeroLenString) != 0) fFormatter << uri << chColon; fFormatter << localname ; } else fFormatter << qname ; unsigned int len = attributes.getLength(); for (unsigned int index = 0; index < len; index++) { // // Again the name has to be completely representable. But the // attribute can have refs and requires the attribute style // escaping. // fFormatter << XMLFormatter::NoEscapes << chSpace ; if ( fExpandNS ) { if (XMLString::compareIString(attributes.getURI(index),XMLUni::fgZeroLenString) != 0) fFormatter << attributes.getURI(index) << chColon; fFormatter << attributes.getLocalName(index) ; } else fFormatter << attributes.getQName(index) ; fFormatter << chEqual << chDoubleQuote << XMLFormatter::AttrEscapes << attributes.getValue(index) << XMLFormatter::NoEscapes << chDoubleQuote; } fFormatter << chCloseAngle; }
// read the 'number' attribute in current tag, ignore other attributes void CommonReadHandler::ReadTagNumber(int *myval,const Attributes& attrs) { int i,aval; char *aName,*value; int numAttr=(int)attrs.getLength(); *myval=0; for(i=0; i<numAttr; i++) { aName=XMLString::transcode(attrs.getLocalName(i)); if(strcmp(aName,"number")==0) { value=XMLString::transcode(attrs.getValue(i)); sscanf(value,"%i",&aval); *myval=aval; delete [] value; delete [] aName; break; } delete [] aName; } }
void SAX2Handler::startElement(const XMLCh* const , const XMLCh* const localname, const XMLCh* const , const Attributes& attributes) { if(!XMLString::compareString(localname,s_transUnitXMLCh)) { unsigned int len = attributes.getLength(); ++m_numberOfRecords; for (unsigned int index = 0; index < len; index++) { const XMLCh* name = attributes.getQName(index) ; if (name != NULL && !XMLString::compareString(name,s_idXMLCh) ) { const XMLCh* val = attributes.getValue(index); if ( val != NULL ) { if ( m_numberOfRecords != 1) printBeginOfIndexLine(); m_fIndexOutputStream.writeAsASCII(val,XMLString::stringLen(val)); char buff[100]; sprintf( buff, " = %d \n",(m_numberOfRecords - 1)); m_fIndexOutputStream.writeAsASCII(buff,XMLString::stringLen(buff)); printEndOfIndexLine (); } } } } }
//============================================================================== void AttributesImpl::setAttributes(const Attributes& atts) { // // First, remove all entries from this collection // clear(); // // Then iterate through the passed Attributes collection, creating // a new Attribute for each one and adding it to our collection // for(size_t i = 0; i < atts.getLength(); ++i) { AutoPtr<Attribute> rpAttr = new Attribute(atts.getQName(i), atts.getValue(i), atts.getType(i)); if(!m_attributes.addAttribute(rpAttr.get())) { throw IllegalArgumentException(QC_T("attribute already exists")); } } }
void XMLWriter::addAttributes(AttributeMap& attributeMap, const Attributes& attributes, const XMLString& elementNamespaceURI) { for (int i = 0; i < attributes.getLength(); i++) { XMLString namespaceURI = attributes.getURI(i); XMLString localName = attributes.getLocalName(i); XMLString qname = attributes.getQName(i); if (!localName.empty()) { XMLString prefix; if (namespaceURI != elementNamespaceURI) prefix = _namespaces.getPrefix(namespaceURI); if (!prefix.empty()) { qname = prefix; qname.append(toXMLString(MARKUP_COLON)); } else qname.clear(); qname.append(localName); } attributeMap[qname] = attributes.getValue(i); } }
vector<string> DAGXMLParser::attributesToStrings(const int nattr, const char* attrNames[], const Attributes& attrs) { vector<string> ret(nattr); XMLSize_t i; int j; for(i=0;i<attrs.getLength();i++) { char* lname = XMLString::transcode(attrs.getLocalName(i)); char* val = XMLString::transcode(attrs.getValue(i)); for(j=0;j<nattr;j++) { if(strcmp(lname,attrNames[j])==0) { ret[j] = val; break; } } if(j==nattr) { stringstream errMsg("DAGXMLParser::attributesToStrings(): Attribute not recognised: "); errMsg << lname; error(errMsg.str().c_str()); } XMLString::release(&lname); XMLString::release(&val); } return ret; }
void GpXmlStateMachine::SetAttributes(GpMember* target, const Attributes& attrs) { XMLSize_t numAtts = attrs.getLength(); string retValue; map<string, string> attributes; DEBOUT("GpXmlStateMachine::SetAttributes - Member"); if (numAtts > 0) { for (XMLSize_t i = 0; i < numAtts; i++) { string local(XMLString::transcode(attrs.getLocalName(i) ) ); string value(XMLString::transcode(attrs.getValue(i) ) ); attributes[local] = value; DEBOUT(i); DEBOUT(local); DEBOUT(value); } // Checking the member for access if (FindAttribute(attributes, AccessStr, retValue) ) { if (retValue.compare(PublicStr) == 0) { target->Access(PUBLIC); } if (retValue.compare(PrivateStr) == 0) { target->Access(PRIVATE); } if (retValue.compare(ProtectedStr) == 0) { target->Access(PROTECTED); } } } }
// error denoted by negative return code int ex_expr::formatARow2(const char** srcFldsPtr, const int* srcFldsLength, const int * srcFieldsConvIndex, char* formattedRow, int& formattedRowLength, int numAttrs, AttributesPtr * attrs, ExpTupleDesc *tupleDesc, UInt16 firstFixedOffset, UInt16 bitmapEntryOffset, UInt16 bitmapOffset, NABoolean sysKeyTable, CollHeap *heap, ComDiagsArea **diags) { formattedRowLength = tupleDesc->tupleDataLength(); //need to fix this later for other types //char *sourceData = (char*)asciiRow; //char *sourceDataEnd =(char*)asciiRow + rowLength; //assert (sourceDataEnd); //set the headers in tuple. ExpTupleDesc::setFirstFixedOffset(formattedRow, firstFixedOffset, tupleDesc->getTupleDataFormat()); //Bitmap offset value is zero if bitmap is not preset. But bitmap offset //still exists. ExpAlignedFormat::setBitmapOffset(formattedRow + bitmapEntryOffset, - bitmapOffset); char *targetData = NULL; //for varchars UInt32 vcActualLen = 0; UInt32 voaOffset = 0; UInt32 vOffset = 0; Int32 vcLenIndOffset = 0; bool firstvc = true; char paddedTimestampVal[27] = "2000-01-01 00:00:00.000000" ; int startCol = 0; if (sysKeyTable) { startCol =1; } for(int index= startCol; index < numAttrs ; index++) { //Attributes * attr = myTdb().getOutputAttr(index); Attributes * attr = attrs[index]; //loop thru all the columns in the row. For each column, //find its corresponding offset in ascii row. Corresponding //offset is identified and converted. char * srcColData = (char*)srcFldsPtr[index - startCol]; int srcColLen = srcFldsLength[index - startCol]; //set null bit map if column is nullable. //if ( attr->getDefaultClass() == Attributes::DEFAULT_NULL ) // ExpAlignedFormat::setNullValue( formattedRow, attr->getNullBitIndex() ); if (! srcColLen ) { ExpAlignedFormat::setNullValue( formattedRow, attr->getNullBitIndex() ); continue; } if((!firstvc) && attr->getVCIndicatorLength() > 0) targetData = (char*) formattedRow + vOffset; else targetData = (char*) formattedRow + attr->getOffset(); if (attr->getDatatype() == REC_DATETIME && srcColLen == 10) { srcColData = &(paddedTimestampVal[0]); srcColLen = 26; } ex_expr::exp_return_type err = convDoIt(srcColData, srcColLen, REC_BYTE_F_ASCII, 0,0, targetData, attr->getLength(), attr->getDatatype(), attr->getPrecision(), attr->getScale(), (char*)&vcActualLen, sizeof(vcActualLen), heap, diags, (conv_case_index)srcFieldsConvIndex[index] ); if(err == ex_expr::EXPR_ERROR) return -1; //update var fields parameters and adjust for subsequent var columns. if(attr->getVCIndicatorLength() > 0) { if(firstvc) { voaOffset = attr->getVoaOffset(); vOffset = attr->getOffset(); vcLenIndOffset = attr->getVCLenIndOffset(); } //obtain actual len of varchar field and update VCIndicatorLength setVCLength(formattedRow + vcLenIndOffset, attr->getVCIndicatorLength(), vcActualLen); //update voa offset location with value of offset ExpTupleDesc::setVoaValue(formattedRow, voaOffset, vcLenIndOffset, tupleDesc->getTupleDataFormat()); //update all offset vars for next varchar column ExpAlignedFormat::incrVoaOffset(voaOffset); vcLenIndOffset += (vcActualLen + attr->getVCIndicatorLength()); vOffset = vcLenIndOffset + attr->getVCIndicatorLength(); //vcIndLen remains same. firstvc = false; //update formatted row length to reflect actual len formattedRowLength = vcLenIndOffset; } } //finally adjust the data length to alignment size. See header file for more info. formattedRowLength = ExpAlignedFormat::adjustDataLength(formattedRow, formattedRowLength, ExpAlignedFormat::ALIGNMENT, TRUE); return 0; };
void ManifestXML_Handler::startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs) { char* element = XMLString::transcode(qname); CString elementString = element; XMLString::release(&element); /* variables used to extact attibute strings */ unsigned int len = attrs.getLength(); char* QName; char* Value; Debug(elementString); switch (ManifestXML_State) { case FINDING_FILE : if (elementString.Compare("file") == 0) { ManifestXML_State = FOUND_FILE; Debug("FOUND file"); for (unsigned int attrCount = 0; attrCount < len; attrCount++) { QName = XMLString::transcode(attrs.getQName((short) attrCount)); CString QNameString = QName; XMLString::release(&QName); Value = XMLString::transcode(attrs.getValue((short) attrCount)); if (QNameString.Compare("method") == 0) { currentManifest.manifMethod = Value; gotFileMethod = true; } if (QNameString.Compare("date_required") == 0) { currentManifest.manifDateRequired = Value; gotDateRequired = true; } QNameString.Empty(); } } break; case FOUND_FILE : if (elementString.Compare("image_file") == 0) { Debug("FOUND image_file"); XML_CharState = MANIFEST_IMAGE; gotImageFile = true; for (unsigned int attrCount = 0; attrCount < len; attrCount++) { QName = XMLString::transcode(attrs.getQName((short) attrCount)); CString QNameString = QName; XMLString::release(&QName); Value = XMLString::transcode(attrs.getValue((short) attrCount)); if (QNameString.Compare("type") == 0) { currentManifest.manifImageFileType = Value; gotImageFileType = true; } QNameString.Empty(); } } if (elementString.Compare("multimedia_file") == 0) { Debug("FOUND multimedia_file"); XML_CharState = MANIFEST_MULTIMEDIA; gotMultimediaFile = true; for (unsigned int attrCount = 0; attrCount < len; attrCount++) { QName = XMLString::transcode(attrs.getQName((short) attrCount)); CString QNameString = QName; XMLString::release(&QName); Value = XMLString::transcode(attrs.getValue((short) attrCount)); if (QNameString.Compare("type") == 0) { currentManifest.manifMultimediaFileType = Value; gotMultimediaFileType = true; } QNameString.Empty(); } } if (elementString.Compare("print_file") == 0) { Debug("FOUND print_file"); XML_CharState = MANIFEST_PRINT; gotPrintFile = true; for (unsigned int attrCount = 0; attrCount < len; attrCount++) { QName = XMLString::transcode(attrs.getQName((short) attrCount)); CString QNameString = QName; XMLString::release(&QName); Value = XMLString::transcode(attrs.getValue((short) attrCount)); if (QNameString.Compare("type") == 0) { currentManifest.manifPrintFileType = Value; gotPrintFileType = true; } QNameString.Empty(); } } break; } elementString.Empty(); }
void QgarAppDescr::startParam(const Attributes& atts) { // Set flag indicating that we're parsing a parameter now _parseData->state = PARAM; // Reset current parameter delete _parseData->currentParam; _parseData->currentParam = new QgarAppParamDescr(); //-- Read Parameter Attributes for (int i = 0; i < atts.getLength(); ++i) { string name = atts.getLocalName(i); string value = atts.getValue(i); if (name == "name") { (_parseData->currentParam)->setName(value); } else if (name == "flag") { (_parseData->currentParam)->setFlag(value); } else if (name == "required") { if (value == "false") { (_parseData->currentParam)->setRequired(false); } else { (_parseData->currentParam)->setRequired(true); } } else if (name == "passing-mode") { QgarAppParamDescr::ParamPassing mode; if (value == "in") { mode = QgarAppParamDescr::QGE_IN; } else if (value == "out") { mode = QgarAppParamDescr::QGE_OUT; } else if (value == "inout") { mode = QgarAppParamDescr::QGE_INOUT; } else { mode = QgarAppParamDescr::QGE_NONE; ostringstream os; os << "Unknown mode: " << value; throw QgarErrorDeveloper(__FILE__, __LINE__, "void QgarAppDescr::startParam(const Attributes&)", os.str()); } (_parseData->currentParam)->setPassingMode(mode); } else if (name == "type") { if ( (value == "grayscale") || (value == "binary") || (value == "vectorial") ) { (_parseData->currentParam)->setType(QgarAppParamDescr::QGE_IMAGE); } else { (_parseData->currentParam)->setType(QgarAppParamDescr::QGE_NUM); } } else if (name == "format") { QgarAppParamDescr::ParamFormat format; if (value == "PBM") { format = QgarAppParamDescr::QGE_PBM; } else if (value == "PPM") { format = QgarAppParamDescr::QGE_PPM; } else if (value == "PGM") { format = QgarAppParamDescr::QGE_PGM; } else if (value == "DXF") { format = QgarAppParamDescr::QGE_DXF; } else if (value == "SVG") { format = QgarAppParamDescr::QGE_SVG; } else if (value == "int") { format = QgarAppParamDescr::QGE_INT; } else if (value == "real") { format = QgarAppParamDescr::QGE_REAL; } else { format = QgarAppParamDescr::QGE_UNKNOWN_FORMAT; } (_parseData->currentParam)->setFormat(format); } else if (name == "default") { (_parseData->currentParam)->setDefaultValue(value); } else if (name == "min") { (_parseData->currentParam)->setMinValue(value); } else if (name == "max") { (_parseData->currentParam)->setMaxValue(value); } } }
//Detailed error support for clause expression evaluation. ComDiagsArea *ExRaiseDetailSqlError(CollHeap* heap, ComDiagsArea** diagsArea, ExeErrorCode err, ex_clause *clause, char *op_data[]) { if (diagsArea == NULL) return NULL; if (*diagsArea == NULL){ if (heap == NULL) return NULL; *diagsArea = ComDiagsArea::allocate(heap); } Int16 numOperands = clause->getNumOperands(); Attributes *op; Int16 i; // Single allocation of buf is split up to be used for opstrings, // formatting. See defines at beginning of this header file // for details. char *buf = new (heap) char[(numOperands * (VALUE_TYPE_LEN + OPVALUE_LEN)) + INSTR_LEN + FORMATTING]; if( !buf ){ ExRaiseSqlError(heap, diagsArea, err); return *diagsArea; } char *opStrings = &buf[(numOperands * VALUE_TYPE_LEN) + INSTR_LEN ]; // assign FORMATTING part of address. char *buf1 = &buf[(numOperands * (VALUE_TYPE_LEN + OPVALUE_LEN)) + INSTR_LEN]; for (i = 1; i < numOperands; i++){ op = clause->getOperand(i); ExConvertErrorToString(heap, diagsArea, (char*)op_data[i], op->getLength(), op->getDatatype(), op->getScale(), (char*)&opStrings[(i-1)*OPVALUE_LEN], OPVALUE_LEN); } //initialize buf before entering the loop. buf[0] = '\0'; for(i = 1; i< numOperands; i++){ op = clause->getOperand(i); str_sprintf(buf1, " Operand%d Type:%s(%s) Operand%d Value:%s",i, getDatatypeAsString(op->getDatatype(), true), getDatatypeAsString(op->getDatatype(), false), i, &opStrings[(i-1)*OPVALUE_LEN]); str_cat(buf, buf1, buf); } if(numOperands) { str_sprintf(buf1,"."); str_cat(buf, buf1, buf); } str_sprintf(buf1, " Clause Type:%d Clause number:%d Operation:%s.", clause->getType(), clause->clauseNum(), exClauseGetText(clause->getOperType())); str_cat(buf, buf1, buf); **diagsArea << DgSqlCode(-err); **diagsArea<<DgString0(buf); NADELETEBASICARRAY(buf, (heap)); return *diagsArea; }