If an XML element has no encoding and no text just create an empty ASN.1 element.

git-svn-id: http://yate.null.ro/svn/yate/trunk@4764 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2011-12-15 12:52:01 +00:00
parent 71f8fee403
commit 1bcdd9fabe
1 changed files with 11 additions and 5 deletions

View File

@ -534,7 +534,7 @@ static bool encodeRaw(const Parameter* param, DataBlock& payload, XmlElement* el
break; break;
} }
AsnTag tag; AsnTag tag;
String* clas = elem->getAttribute(s_typeStr); const String* clas = elem->getAttribute(s_typeStr);
if (TelEngine::null(clas)) { if (TelEngine::null(clas)) {
if (param) if (param)
tag.classType(param->tag.classType()); tag.classType(param->tag.classType());
@ -561,10 +561,16 @@ static bool encodeRaw(const Parameter* param, DataBlock& payload, XmlElement* el
if (!hasChildren) { if (!hasChildren) {
clas = elem->getAttribute(s_encAttr); clas = elem->getAttribute(s_encAttr);
if (TelEngine::null(clas)) { if (TelEngine::null(clas)) {
Debug(DebugMild,"In <%s> missing %s=\"...\" attribute!",elem->getTag().c_str(),s_encAttr.c_str()); if (text) {
return false; Debug(DebugMild,"In <%s> missing %s=\"...\" attribute!",elem->getTag().c_str(),s_encAttr.c_str());
return false;
}
payload.clear();
tag.type(param ? param->tag.type() : AsnTag::Primitive);
clas = &String::empty();
} }
tag.type(AsnTag::Primitive); else
tag.type(AsnTag::Primitive);
if (*clas == "hex") if (*clas == "hex")
payload.unHexify(text.c_str(),text.length(),' '); payload.unHexify(text.c_str(),text.length(),' ');
else if (*clas == "int") else if (*clas == "int")
@ -5994,7 +6000,7 @@ void XmlToTcap::encodeOperation(Operation* op, XmlElement* elem, DataBlock& payl
bool XmlToTcap::encodeComponent(DataBlock& payload, XmlElement* elem, bool searchArgs, int& err, Operation* op) bool XmlToTcap::encodeComponent(DataBlock& payload, XmlElement* elem, bool searchArgs, int& err, Operation* op)
{ {
DDebug(&__plugin,DebugAll,"XmlToTcap::encodeComponent(elem=%p) [%p]",elem,this); DDebug(&__plugin,DebugAll,"XmlToTcap::encodeComponent(elem=%p op=%p) [%p]",elem,op,this);
if (!elem) if (!elem)
return false; return false;