Mixe for Privacy and Anonymity in the Internet
CAAbstractXMLEncodable.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2000, The JAP-Team
3 All rights reserved.
4 Redistribution and use in source and binary forms, with or without modification,
5 are permitted provided that the following conditions are met:
6 
7  - Redistributions of source code must retain the above copyright notice,
8  this list of conditions and the following disclaimer.
9 
10  - Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation and/or
12  other materials provided with the distribution.
13 
14  - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors
15  may be used to endorse or promote products derived from this software without specific
16  prior written permission.
17 
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
20 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
22 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
27 */
28 #include "StdAfx.h"
29 #ifndef ONLY_LOCAL_PROXY
31 #include "xml/DOM_Output.hpp"
32 
33 SINT32 CAAbstractXMLEncodable::toXmlDocument(XERCES_CPP_NAMESPACE::DOMDocument* & pDoc)
34  {
35  DOMElement* pElemRoot=NULL;
36  pDoc = createDOMDocument();
37  toXmlElement(pDoc, pElemRoot);
38  pDoc->appendChild(pElemRoot);
39  return E_SUCCESS;
40  }
41 
43  {
44  XERCES_CPP_NAMESPACE::DOMDocument* pDoc=NULL;
45  toXmlDocument(pDoc);
46  UINT8* tmp = DOM_Output::dumpToMem(pDoc, pSize);
47  // put null at the end...
48  UINT8* tmp2 = new UINT8[*pSize+1];
49  memcpy(tmp2, tmp, *pSize);
50  tmp2[*pSize]=0;
51  delete[] tmp;
52  tmp = NULL;
53  if (pDoc != NULL)
54  {
55  pDoc->release();
56  pDoc = NULL;
57  }
58  //delete pDoc;
59  return tmp2;
60  }
61 #endif //ONLY_LOCAL_PROXY
XERCES_CPP_NAMESPACE::DOMDocument * createDOMDocument()
Parses a timestamp in JDBC timestamp escape format (as it comes from the BI) and outputs the value in...
Definition: CAUtil.cpp:1568
signed int SINT32
Definition: basetypedefs.h:132
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
UINT8 * toXmlString(UINT32 *pSize)
Converts the XML structure to a null-terminated C-String representation.
SINT32 toXmlDocument(XERCES_CPP_NAMESPACE::DOMDocument *&pDoc)
returns a pointer to the tagname of this XML structure's top level element.
virtual SINT32 toXmlElement(XERCES_CPP_NAMESPACE::DOMDocument *a_pDoc, DOMElement *&pElemRoot)=0
Creates the XML structure inside an existing DOM_Document, but does not append it to any node.
static SINT32 dumpToMem(const DOMNode *node, UINT8 *buff, UINT32 *size)
Dumps the node and all childs into buff.
Definition: DOM_Output.hpp:161
const SINT32 E_SUCCESS
Definition: errorcodes.hpp:2