Ejemplo n.º 1
0
EXTXMLMETHOD int rtAsn1XmlEncOpenType 
(OSCTXT *pctxt, const OSOCTET* data, OSUINT32 nocts, 
 const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix) 
{
   OSUTF8CHAR* qname = 0;
   int stat;

   if (0 != isBinaryData (data, nocts)) {
      const OSUTF8CHAR *ename = (elemName == 0 || strcmp ("", elemName) == 0 ) ? 
         OSUTF8("binext") : elemName;

      qname = rtXmlNewQName (pctxt, ename, nsPrefix);
      
      if (0 != qname) {
         stat = rtXmlEncStartElement (pctxt, qname, 0, 0, TRUE);
         if (stat != 0) return LOG_RTERR (pctxt, stat);
      }
      else return RTERR_NOMEM;

      if (0 != data && nocts > 0) {
         stat = rtXmlEncHexStrValue (pctxt, nocts, data);
         pctxt->state = OSXMLDATA;

         if (stat != 0) return LOG_RTERR (pctxt, stat);
      }

      if (0 != qname) {
         stat = rtXmlEncEndElement (pctxt, qname, 0);
         if (stat != 0) return LOG_RTERR (pctxt, stat);

         rtxMemFreePtr (pctxt, qname);
      }
   }

   else {
      if (0 != elemName) {
         qname = rtXmlNewQName (pctxt, elemName, nsPrefix);

         if (0 != qname) {
            stat = rtXmlEncStartElement (pctxt, qname, 0, 0, TRUE);
            if (stat != 0) return LOG_RTERR (pctxt, stat);
         }
         else return RTERR_NOMEM;
      }

      if (0 != data && nocts > 0) {
         OSRTSAFEMEMCPY (pctxt, data, nocts);
         pctxt->state = OSXMLDATA;
      }

      if (0 != qname) {
         stat = rtXmlEncEndElement (pctxt, qname, 0);
         if (stat != 0) return LOG_RTERR (pctxt, stat);

         rtxMemFreePtr (pctxt, qname);
      }
   }

   return 0;
}
Ejemplo n.º 2
0
EXTXMLMETHOD int rtXmlEncUnicodeStr 
(OSCTXT* pctxt, const OSUNICHAR* value, OSUINT32 nchars, 
 const OSUTF8CHAR* elemName, OSXMLNamespace* pNS)
{
   int stat;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, pNS, 0, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   /* Encode string contents */

   if (0 != value && nchars > 0) {
      if (pctxt->state != OSXMLATTR)
         pctxt->state = OSXMLDATA;

      stat = rtXmlEncUnicodeData (pctxt, value, nchars);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   if (0 != elemName) {
      stat = rtXmlEncEndElement (pctxt, elemName, pNS);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   return 0;
}
Ejemplo n.º 3
0
int XmlEnc_Fault_PDU (OSCTXT* pctxt, Fault* pvalue)
{
   int stat;
   const OSUTF8CHAR* nsPrefix = 0;

   rtXmlNSSetNamespace (pctxt, OSUTF8("tns"), 
      OSUTF8("http://schemas.xmlsoap.org/soap/envelope/"), FALSE);

   nsPrefix = rtXmlNSGetPrefix (pctxt, 
      OSUTF8("http://schemas.xmlsoap.org/soap/envelope/"));

   stat = rtXmlEncStartDocument (pctxt);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncStartElement (pctxt, OSUTF8("Fault"), nsPrefix, FALSE);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncNSAttrs (pctxt);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncXSIAttrs (pctxt, FALSE);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = XmlEnc_Fault (pctxt, pvalue, 0, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncEndElement (pctxt, OSUTF8("Fault"), nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return stat;
}
Ejemplo n.º 4
0
int XmlEnc_Seisdata_PDU (OSCTXT* pctxt, Seisdata* pvalue)
{
   int stat;
   const OSUTF8CHAR* nsPrefix = 0;

   stat = rtXmlEncStartDocument (pctxt);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncStartElement (pctxt, OSUTF8("seisdata"), nsPrefix, FALSE);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncNSAttrs (pctxt);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncXSIAttrs (pctxt, FALSE);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = XmlEnc_Seisdata (pctxt, pvalue, 0, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncEndElement (pctxt, OSUTF8("seisdata"), nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return stat;
}
Ejemplo n.º 5
0
int XmlEnc_EncodingStyle_1 (OSCTXT* pctxt, EncodingStyle_1* pvalue, 
   const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (elemName != 0) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://schemas.xmlsoap.org/soap/envelope/"));

   { OSRTDListNode* pnode = pvalue->head;
   while (0 != pnode) {
      stat = rtXmlEncUTF8Str (pctxt, ((const OSUTF8CHAR*)pnode->data)
         , OSUTF8(""), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
      OSRTSAFEPUTCHAR (pctxt, ' ');
      pnode = pnode->next;
   }}
   nsPrefix = savedPrefix;
   }

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 6
0
int XmlEnc_Model (OSCTXT* pctxt, Model* pvalue, const OSUTF8CHAR* elemName, 
   const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, FALSE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   /* add attributes */
   { OSRTDListNode* pnode = pvalue->attr.head;
   size_t len;
   while (0 != pnode) {
      len = rtxUTF8LenBytes (pnode->data);

      stat = rtxCheckBuffer (pctxt, len + 1);
      if (stat != 0) return LOG_RTERR (pctxt, stat);

      OSRTPUTCHAR (pctxt, ' ');
      OSRTMEMCPY (pctxt, pnode->data, len);

      pnode = pnode->next;
   }}

   OSRTSAFEPUTCHAR (pctxt, '>');
   pctxt->flags &= ~OSTERMSTART;
   pctxt->state = OSXMLSTART;

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://www.w3.org/2002/xforms"));

   /* encode element14_list */

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://www.w3.org/2002/xforms"));

   { OSRTDListNode* pnode = pvalue->element14_list.head;
   while (0 != pnode) {
      stat = XmlEnc_Odf_Element14 (pctxt, *((Odf_Element14*)pnode->data)
         , 0, nsPrefix);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
      pnode = pnode->next;
   }}
   nsPrefix = savedPrefix;
   }

   nsPrefix = savedPrefix;
   }

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 7
0
int XmlEnc_InvoiceType (OSCTXT* pctxt, InvoiceType* pvalue, 
   const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://www.sun.com/schema/spidermarkexpress/sm-inv"));

   /* encode header */

   stat = XmlEnc_InvoiceHeaderType (pctxt, &pvalue->header
      , OSUTF8("Header"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode lineItem_list */

   if (!(pvalue->lineItem_list.count >= 1U)) {
      rtxErrAddStrParm (pctxt, "InvoiceType.lineItem_list.count");
      rtxErrAddIntParm (pctxt, (int)pvalue->lineItem_list.count);
      return LOG_RTERR (pctxt, RTERR_CONSVIO);
   }

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://www.sun.com/schema/spidermarkexpress/sm-inv"));

   { OSRTDListNode* pnode = pvalue->lineItem_list.head;
   while (0 != pnode) {
      stat = XmlEnc_InvoiceLineItemType (pctxt, 
         ((InvoiceLineItemType*)pnode->data), OSUTF8("LineItem"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
      pnode = pnode->next;
   }}
   nsPrefix = savedPrefix;
   }

   /* encode summary */

   stat = XmlEnc_InvoiceSummaryType (pctxt, &pvalue->summary
      , OSUTF8("Summary"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   nsPrefix = savedPrefix;
   }

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 8
0
EXTXMLMETHOD int rtXmlEncString (OSCTXT* pctxt, 
                    OSXMLSTRING* pxmlstr, 
                    const OSUTF8CHAR* elemName, 
                    OSXMLNamespace* pNS)
{
   int stat = 0;
   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, pNS, 0, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   else if (pctxt->state != OSXMLATTR) {
      stat = rtXmlEncTermStartElement (pctxt);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   /* Encode string content */

   if (0 != pxmlstr) {
      /* Do not change state if encoding attr */
      if (!(pctxt->state == OSXMLATTR && 0 == elemName))
         pctxt->state = OSXMLDATA;
      /* C14N specifies CDATA sections are to be replaced with their
         character content.  Disregard CDATA in C14N mode. */
      if (pxmlstr->cdata && !rtxCtxtTestFlag (pctxt, OSXMLC14N)) {
         /* Encode CDATA section */
         size_t len = rtxUTF8LenBytes (pxmlstr->value);

         /* Verify string will fit in encode buffer */
         stat = rtxCheckBuffer (pctxt, len + 12);
         if (stat != 0) return LOG_RTERR (pctxt, stat);

         /* Copy data to buffer or stream */
         OSRTMEMCPY (pctxt, "<![CDATA[", 9);
         stat = rtXmlEncCDATAStringValue (pctxt, pxmlstr->value, len);
         if (stat != 0) return LOG_RTERR (pctxt, stat);
         OSRTMEMCPY (pctxt, "]]>", 3);
      }
      else {
         stat = rtXmlEncStringValue (pctxt, pxmlstr->value);
         if (stat != 0) return LOG_RTERR (pctxt, stat);
      }
   }

   if (0 != elemName) {
      stat = rtXmlEncEndElement (pctxt, elemName, pNS);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   return 0;
}
Ejemplo n.º 9
0
EXTXMLMETHOD int RTXMLENCINTFUNC 
(OSCTXT* pctxt, OSINTTYPE value, const OSUTF8CHAR* elemName, 
 OSXMLNamespace* pNS)
{
   int stat = rtXmlEncStartElement (pctxt, elemName, pNS, 0, TRUE);

   if (0 == stat)
      stat = RTXMLENCINTVALUEFUNC (pctxt, value);

   if (0 != elemName && 0 == stat) {
      stat = rtXmlEncEndElement (pctxt, elemName, pNS);
   }

   return (stat != 0) ? LOG_RTERR (pctxt, stat) : 0;
}
Ejemplo n.º 10
0
int XmlEnc_Fault (OSCTXT* pctxt, Fault* pvalue, const OSUTF8CHAR* elemName, 
   const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://schemas.xmlsoap.org/soap/envelope/"));

   /* encode faultcode */

   stat = rtXmlEncUTF8Str (pctxt, pvalue->faultcode.
      name, OSUTF8("faultcode"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode faultstring */

   stat = rtXmlEncUTF8Str (pctxt, pvalue->faultstring
      , OSUTF8("faultstring"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode faultactor */

   if (pvalue->m.faultactorPresent) {
      stat = rtXmlEncUTF8Str (pctxt, pvalue->faultactor
         , OSUTF8("faultactor"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode detail */

   if (pvalue->m.detailPresent) {
      stat = XmlEnc_Detail (pctxt, &pvalue->detail, OSUTF8("detail"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   nsPrefix = savedPrefix;
   }

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 11
0
int XmlEnc_Ns1_Min_width (OSCTXT* pctxt, Ns1_Min_width* pvalue, 
   const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"));

   switch (pvalue->t)
   {
      case 1:
         /* encode alt */

         stat = rtXmlEncUTF8Str (pctxt, pvalue->u.alt, 0, 0);
         if (stat != 0) return LOG_RTERR (pctxt, stat);

         break;

      case 2:
         /* encode alt_1 */

         stat = rtXmlEncUTF8Str (pctxt, pvalue->u.alt_1, 0, 0);
         if (stat != 0) return LOG_RTERR (pctxt, stat);

         break;

      default: {
         char buf[40];
         os_snprintf (buf, 40, "%d", pvalue->t);
         return LOG_RTERRNEW1 (pctxt, RTERR_INVOPT, 
            rtxErrAddStrParm (pctxt, buf));
      }
   }
   nsPrefix = savedPrefix;
   }

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 12
0
int XmlEnc_Seisdata (OSCTXT* pctxt, Seisdata* pvalue, 
   const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   /* encode head */

   stat = XmlEnc_Headtype (pctxt, &pvalue->head, OSUTF8("head"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode xcrd */

   stat = XmlEnc_Xcrdtype (pctxt, &pvalue->xcrd, OSUTF8("xcrd"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode ycrd */

   stat = XmlEnc_Xcrdtype (pctxt, &pvalue->ycrd, OSUTF8("ycrd"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode zval */

   stat = XmlEnc_Xcrdtype (pctxt, &pvalue->zval, OSUTF8("zval"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode cdp */

   stat = XmlEnc_Xcrdtype (pctxt, &pvalue->cdp, OSUTF8("cdp"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode data */

   stat = XmlEnc_Xcrdtype (pctxt, &pvalue->data, OSUTF8("data"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 13
0
int XmlEnc_Xcrdtype (OSCTXT* pctxt, Xcrdtype* pvalue, 
   const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (elemName != 0) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   { OSUINT32 xx1;
   for (xx1 = 0; xx1 < pvalue->n; xx1++) {
      stat = rtXmlEncDouble (pctxt, pvalue->elem[xx1], 0, 0, 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
      OSRTSAFEPUTCHAR (pctxt, ' ');
   }}
   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 14
0
int XmlEnc_Invoice_PDU (OSCTXT* pctxt, Invoice* pvalue)
{
   int stat;
   const OSUTF8CHAR* nsPrefix = 0;

   rtXmlNSSetNamespace (pctxt, OSUTF8("cct"), 
      OSUTF8("urn:oasis:names:tc:ubl:CommonLeafTypes:1.0:0.65"), FALSE);

   rtXmlNSSetNamespace (pctxt, OSUTF8("cmn"), 
      OSUTF8("http://www.sun.com/schema/spidermarkexpress/sm-common"), FALSE);

   rtXmlNSSetNamespace (pctxt, OSUTF8("jxb"), 
      OSUTF8("http://java.sun.com/xml/ns/jaxb"), FALSE);

   rtXmlNSSetNamespace (pctxt, 0, 
      OSUTF8("http://www.sun.com/schema/spidermarkexpress/sm-inv"), FALSE);

   nsPrefix = rtXmlNSGetPrefix (pctxt, 
      OSUTF8("http://www.sun.com/schema/spidermarkexpress/sm-inv"));

   stat = rtXmlEncStartDocument (pctxt);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncStartElement (pctxt, OSUTF8("invoice"), nsPrefix, FALSE);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncNSAttrs (pctxt);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncXSIAttrs (pctxt, FALSE);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = XmlEnc_Invoice (pctxt, pvalue, 0, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncEndElement (pctxt, OSUTF8("invoice"), nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return stat;
}
Ejemplo n.º 15
0
int XmlEnc_Headtype (OSCTXT* pctxt, Headtype* pvalue, 
   const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   /* encode name */

   stat = rtXmlEncUTF8Str (pctxt, pvalue->name, OSUTF8("name"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode area */

   stat = rtXmlEncUTF8Str (pctxt, pvalue->area, OSUTF8("area"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode ntrace */

   stat = rtXmlEncInt (pctxt, pvalue->ntrace, OSUTF8("ntrace"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode nsamp */

   stat = rtXmlEncInt (pctxt, pvalue->nsamp, OSUTF8("nsamp"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode precision */

   stat = rtXmlEncInt (pctxt, pvalue->precision, OSUTF8("precision"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode zstart */

   stat = rtXmlEncDouble (pctxt, pvalue->zstart, OSUTF8("zstart"), 0, 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode zinc */

   stat = rtXmlEncDouble (pctxt, pvalue->zinc, OSUTF8("zinc"), 0, 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode num_xyzs_fields */

   stat = rtXmlEncInt (pctxt, pvalue->num_xyzs_fields
      , OSUTF8("num_xyzs_fields"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode xyzs_field_names */

   stat = rtXmlEncUTF8Str (pctxt, pvalue->xyzs_field_names
      , OSUTF8("xyzs_field_names"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode xyzs_field_precisions */

   stat = rtXmlEncUTF8Str (pctxt, pvalue->xyzs_field_precisions
      , OSUTF8("xyzs_field_precisions"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 16
0
int XmlEnc_InvoiceHeaderType (OSCTXT* pctxt, InvoiceHeaderType* pvalue, 
   const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://www.sun.com/schema/spidermarkexpress/sm-inv"));

   /* encode issueDateTime */

   stat = XmlEnc_CCT_DateTimeType (pctxt, &pvalue->issueDateTime
      , OSUTF8("IssueDateTime"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode identifier */

   stat = XmlEnc_CCT_IdentifierType (pctxt, &pvalue->identifier
      , OSUTF8("Identifier"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode pOIdentifier */

   stat = XmlEnc_CCT_IdentifierType (pctxt, &pvalue->pOIdentifier
      , OSUTF8("POIdentifier"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode currencyCode */

   if (pvalue->m.currencyCodePresent) {
      stat = XmlEnc_CCT_CodeType (pctxt, &pvalue->currencyCode
         , OSUTF8("CurrencyCode"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode language */

   if (pvalue->m.languagePresent) {
      stat = XmlEnc_LanguageType (pctxt, &pvalue->language
         , OSUTF8("Language"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode buyerParty */

   stat = XmlEnc_PartyType (pctxt, &pvalue->buyerParty
      , OSUTF8("BuyerParty"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode sellerParty */

   stat = XmlEnc_PartyType (pctxt, &pvalue->sellerParty
      , OSUTF8("SellerParty"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode consigneeParty */

   if (pvalue->m.consigneePartyPresent) {
      stat = XmlEnc_PartyType (pctxt, &pvalue->consigneeParty
         , OSUTF8("ConsigneeParty"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode despatchParty */

   if (pvalue->m.despatchPartyPresent) {
      stat = XmlEnc_PartyType (pctxt, &pvalue->despatchParty
         , OSUTF8("DespatchParty"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode shipment */

   if (pvalue->m.shipmentPresent) {
      stat = XmlEnc_ShipmentType (pctxt, &pvalue->shipment
         , OSUTF8("Shipment"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode paymentMeans */

   stat = XmlEnc_PaymentMeansType (pctxt, &pvalue->paymentMeans
      , OSUTF8("PaymentMeans"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode lineItemCountValue */

   if (pvalue->m.lineItemCountValuePresent) {
      stat = XmlEnc_CCT_NumericType (pctxt, &pvalue->lineItemCountValue
         , OSUTF8("LineItemCountValue"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   nsPrefix = savedPrefix;
   }

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 17
0
int XmlEnc_Detail (OSCTXT* pctxt, Detail* pvalue, const OSUTF8CHAR* elemName, 
   const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, FALSE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   /* add attributes */
   { OSRTDListNode* pnode = pvalue->attr.head;
   size_t len;
   while (0 != pnode) {
      len = rtxUTF8LenBytes (pnode->data);

      stat = rtxCheckBuffer (pctxt, len + 1);
      if (stat != 0) return LOG_RTERR (pctxt, stat);

      OSRTPUTCHAR (pctxt, ' ');
      OSRTMEMCPY (pctxt, pnode->data, len);

      pnode = pnode->next;
   }}

   OSRTSAFEPUTCHAR (pctxt, '>');
   pctxt->flags &= ~OSTERMSTART;
   pctxt->state = OSXMLSTART;

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://schemas.xmlsoap.org/soap/envelope/"));

   /* encode elem_list */

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://schemas.xmlsoap.org/soap/envelope/"));

   { OSRTDListNode* pnode = pvalue->elem_list.head;
   while (0 != pnode) {
      if (((OSXSDAny*)pnode->data)->t == OSXSDAny_xmlText) {
         stat = rtXmlEncAnyStr (pctxt, ((OSXSDAny*)pnode->data)->u.xmlText
            , OSUTF8(""), 0);
         if (stat != 0) return LOG_RTERR (pctxt, stat);
      }
      else {
         char buf[40];
         os_snprintf (buf, 40, "%d", ((OSXSDAny*)pnode->data)->t);
         rtxErrAddStrParm (pctxt, buf);
         return LOG_RTERR (pctxt, RTERR_INVOPT);
      }
      pnode = pnode->next;
   }}
   nsPrefix = savedPrefix;
   }

   nsPrefix = savedPrefix;
   }

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 18
0
int XmlEnc_InvoiceLineItemType (OSCTXT* pctxt, InvoiceLineItemType* pvalue, 
   const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://www.sun.com/schema/spidermarkexpress/sm-inv"));

   /* encode lineID */

   stat = XmlEnc_CCT_IdentifierType (pctxt, &pvalue->lineID
      , OSUTF8("LineID"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode item */

   stat = XmlEnc_ItemType (pctxt, &pvalue->item, OSUTF8("Item"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode orderStatus */

   if (pvalue->m.orderStatusPresent) {
      stat = XmlEnc_CCT_CodeType (pctxt, &pvalue->orderStatus
         , OSUTF8("OrderStatus"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode pricing */

   stat = XmlEnc_PricingType (pctxt, &pvalue->pricing, OSUTF8("Pricing"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode pricingVariation */

   if (pvalue->m.pricingVariationPresent) {
      stat = XmlEnc_PricingVariationType (pctxt, &pvalue->pricingVariation
         , OSUTF8("PricingVariation"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode itemTax */

   if (pvalue->m.itemTaxPresent) {
      stat = XmlEnc_CCT_AmountType (pctxt, &pvalue->itemTax
         , OSUTF8("ItemTax"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode totalAmount */

   stat = XmlEnc_CCT_AmountType (pctxt, &pvalue->totalAmount
      , OSUTF8("TotalAmount"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   nsPrefix = savedPrefix;
   }

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}
Ejemplo n.º 19
0
int XmlEnc_InvoiceSummaryType (OSCTXT* pctxt, InvoiceSummaryType* pvalue, 
   const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
{
   int stat = 0;

   if (0 != elemName) {
      stat = rtXmlEncStartElement (pctxt, elemName, nsPrefix, TRUE);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://www.sun.com/schema/spidermarkexpress/sm-inv"));

   /* encode lineItemCountValue */

   if (pvalue->m.lineItemCountValuePresent) {
      stat = XmlEnc_CCT_NumericType (pctxt, &pvalue->lineItemCountValue
         , OSUTF8("LineItemCountValue"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode subtotalAmount */

   stat = XmlEnc_CCT_AmountType (pctxt, &pvalue->subtotalAmount
      , OSUTF8("SubtotalAmount"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode pricingVariation_list */

   { const OSUTF8CHAR* savedPrefix = nsPrefix;
   nsPrefix = rtXmlNSGetPrefix (pctxt, OSUTF8(
      "http://www.sun.com/schema/spidermarkexpress/sm-inv"));

   { OSRTDListNode* pnode = pvalue->pricingVariation_list.head;
   while (0 != pnode) {
      stat = XmlEnc_PricingVariationType (pctxt, 
         ((PricingVariationType*)pnode->data), OSUTF8("PricingVariation"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
      pnode = pnode->next;
   }}
   nsPrefix = savedPrefix;
   }

   /* encode totalTax */

   if (pvalue->m.totalTaxPresent) {
      stat = XmlEnc_TaxType (pctxt, &pvalue->totalTax, OSUTF8("TotalTax"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode priceAmount */

   stat = XmlEnc_CCT_AmountType (pctxt, &pvalue->priceAmount
      , OSUTF8("PriceAmount"), 0);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* encode packingSlipIdentifier */

   if (pvalue->m.packingSlipIdentifierPresent) {
      stat = XmlEnc_CCT_IdentifierType (pctxt, &pvalue->packingSlipIdentifier
         , OSUTF8("PackingSlipIdentifier"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   /* encode summaryNote */

   if (pvalue->m.summaryNotePresent) {
      stat = XmlEnc_NoteType (pctxt, &pvalue->summaryNote
         , OSUTF8("SummaryNote"), 0);
      if (stat != 0) return LOG_RTERR (pctxt, stat);
   }
   nsPrefix = savedPrefix;
   }

   stat = rtXmlEncEndElement (pctxt, elemName, nsPrefix);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   return (stat);
}