Example #1
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;
}
Example #2
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;
}
Example #3
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;
}
Example #4
0
EXTXMLMETHOD int SAX2XMLStreamStartElement
(void *userData, const OSUTF8CHAR* localname, 
 const OSUTF8CHAR* qname, const OSUTF8CHAR* const* attrs)
{
   OSCTXT* pctxt = (OSCTXT*) userData;

   if (pctxt->state == OSXMLINIT) {
      rtXmlEncStartDocument (pctxt);
   }
   else if (pctxt->state == OSXMLSTART) {
      OSRTSAFEPUTCHAR (pctxt, '>');
   }
   if (pctxt->state != OSXMLDATA) {
      rtXmlEncIndent (pctxt);
   }
   pctxt->level++;
   pctxt->state = OSXMLSTART;

   /* Verify element will fit in encode buffer */

   if (0 == rtxCheckBuffer (pctxt, OSUTF8LEN(qname) + 1)) {
      /* Copy element QName to buffer */
      OSRTPUTCHAR (pctxt, '<');
      OSRTMEMCPY (pctxt, qname, OSUTF8LEN(qname));

      if (0 != attrs && 0 != attrs[0]) {
         OSUINT32 i = 0;
         while (0 != attrs[i]) {
            rtXmlEncUTF8Attr (pctxt, attrs[i], attrs[i+1]);
            i += 2;
         }
      }
   }
   if (0 != localname) {} /* to suppress level 4 warning */

   return 0;
}