示例#1
0
int main(int argc, char * argv[])
{
  genxWriter w = genxNew(NULL, NULL, NULL);
  genxNamespace ns1, ns2;
  
  genxStartDocFile(w, stdout);
  genxStartElementLiteral(w, WIDE("http://example.org/1"), WIDE("greeting"));
  genxAddAttributeLiteral(w, WIDE("http://example.com/zot"), WIDE("type"), WIDE("well-formed"));
  genxAddText(w, WIDE("\nHello world!"));
  genxEndElement(w);
  genxEndDocument(w);
}
示例#2
0
文件: helloMillion.c 项目: d3x0r/SACK
int main(int argc, char * argv[])
{
  genxWriter w = genxNew(NULL, NULL, NULL);
  genxElement dates, date;
  genxAttribute yyyy, mm;
  genxNamespace ns;
  genxStatus status;
  int i;
  char year[100], month[100];

  if (!(ns = genxDeclareNamespace(w, "http://example.org/dd", "dd", &status)))
    oops(w);
  if (!(dates = genxDeclareElement(w, ns, "dates", &status)))
    oops(w);
  if (!(date = genxDeclareElement(w, NULL, "date", &status)))
    oops(w);
  if (!(yyyy = genxDeclareAttribute(w, NULL, "yyyy", &status)))
    oops(w);
  if (!(mm = genxDeclareAttribute(w, NULL, "mm", &status)))
    oops(w);

  if (genxStartDocFile(w, stdout) ||
      genxStartElement(dates) ||
      genxAddText(w, "\n"))
    oops(w);
  for (i = 0; i < 1000000; i++)
  {
    sprintf(year, "%d", 1900 + (random() % 100));
    sprintf(month, "%02d", 1 + (random() % 12));
    if (genxStartElement(date) ||
	genxAddAttribute(yyyy, year) ||
	genxAddAttribute(mm, month) ||
	genxEndElement(w) ||
	genxAddText(w, "\n "))
      oops(w);
  }
  if (genxEndElement(w))
    oops(w);
  if (genxEndDocument(w))
    oops(w);
}
示例#3
0
int main ( void )
{
	genxWriter w;
	genxElement header;
	genxElement body;
   genxElement html;
	genxStatus status;
   int n;
	PVARTEXT pvt = VarTextCreate();


	w = genxNew(NULL,NULL,NULL);

	genxSetUserData( w, (void*)pvt );
	html = genxDeclareElement( w, NULL, (constUtf8)"HTML", &status );
	header = genxDeclareElement( w, NULL, (constUtf8)"header", &status );
   body = genxDeclareElement( w, NULL, (constUtf8)"body", &status );

	genxStartDocSender( w, &senderprocs );
	n = 	genxPI( w, "xml", "version=\"1.0\" encoding=\"UTF-8\"" );

	printf( "result:%d\n", n );
	genxStartElement( html );
	{
		genxStartElement( header );
		genxAddText( w, "Header Here" );
		genxEndElement( w );

		genxStartElement( body );
		genxAddText( w, "body Here" );
		genxEndElement( w );
	}
	genxEndElement( w );

	genxEndDocument( w );

	printf( "Result Document:\n\n" );
   printf( "%s", GetText( VarTextPeek( pvt ) ) );
   return 0;
}
示例#4
0
static void InitGenX( void )
{
	genxStatus status;
	ffl.writer.w = genxNew(NULL,NULL,NULL);
#define DeclElem( name )  	ffl.writer.name = genxDeclareElement( ffl.writer.w, NULL, (constUtf8)#name, &status );
	DeclElem( game );
	DeclElem( prizeGroups );
	DeclElem( prizeGroup );
	DeclElem( prizes );
	DeclElem( prize );
	DeclElem( remaining );
	DeclElem( value );
	DeclElem( desc );
	DeclElem( extraPrizes );
	DeclElem( playerLog );
	DeclElem( player );
	DeclElem( timestamp );
	DeclElem( cardNum );
	DeclElem( playerName );
	DeclElem( prizeNum );
	DeclElem( prizeDesc );
}