imgtools/imgcheck/inc/xmlwriter.h
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * XmlWriter class implementation.
       
    16 * @internalComponent
       
    17 * @released
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #ifndef XMLWRITER_H
       
    24 #define XMLWRITER_H
       
    25 
       
    26 #include "reportwriter.h"
       
    27 #include "libxml/xmlwriter.h"
       
    28 #include "common.h"
       
    29 
       
    30 /**
       
    31 Constants for XML report generation.
       
    32 xml tags (headers,elements and attribute names).
       
    33 */
       
    34 const String KXmlEncoding("ISO-8859-1");
       
    35 const String KXslFileName("imgcheck.xsl");
       
    36 const String KXmlVersion("1.0");
       
    37 const String KDtdXslInfo("<!DOCTYPE imgcheck_report [ \
       
    38 							<!ELEMENT comment (imgcheck_report+) > \
       
    39 							<!ELEMENT imgcheck_report (Image*)> \
       
    40 							<!ELEMENT Image (Exe_Name*)> \
       
    41 							<!ELEMENT Executable (Dependency*,SID*,VID*,DBG*)> \
       
    42 							<!ELEMENT Dependency ANY> \
       
    43 							<!ATTLIST comment comment CDATA #REQUIRED>\
       
    44 							<!ATTLIST Image name CDATA #REQUIRED> \
       
    45 							<!ATTLIST Executable \
       
    46 							SNo CDATA #REQUIRED  \
       
    47 							name CDATA #REQUIRED> \
       
    48 							<!ATTLIST Dependency \
       
    49 							name CDATA #REQUIRED \
       
    50 							status (Nill | Hidden | Available | Missing) \"Nill\"> \
       
    51 							<!ATTLIST SID \
       
    52 							val CDATA #IMPLIED \
       
    53 							status CDATA #IMPLIED> \
       
    54 							<!ATTLIST VID \
       
    55 							val CDATA #IMPLIED \
       
    56 							status CDATA #IMPLIED> \
       
    57 							<!ATTLIST DBG \
       
    58 							val CDATA #IMPLIED \
       
    59 							status CDATA #IMPLIED> \
       
    60 							]> \
       
    61 							<?xml-stylesheet type=\"text/xsl\" href=\"imgcheck.xsl\"?>");
       
    62 
       
    63 const String KXmlRootElement("imgcheck_report");
       
    64 const String KXmlcomment("comment");
       
    65 const String KXmlinputcmd("Inputcmd");
       
    66 
       
    67 const String KXmlImageName("Image");
       
    68 const String KXmlImageAtt1("name");
       
    69 
       
    70 const String KXmlExeName("Executable");
       
    71 const String KXmlExeAtt1("SNo");
       
    72 const String KXmlExeAtt2("name");
       
    73 
       
    74 const String KDepName("Dependency");
       
    75 const String KDepAtt1("name");
       
    76 const String KAtt1("status");
       
    77 const String KAtt2("val");
       
    78 const String KDepAvaStatus("Available");
       
    79 const String KXml("XML");
       
    80 const String KXMLDbgFlag("DBG");
       
    81 const unsigned int KXmlGenBuffer=1024;
       
    82 
       
    83 /** 
       
    84 Xml writer derived class.
       
    85 
       
    86 @internalComponent
       
    87 @released
       
    88 */
       
    89 class XmlWriter: public ReportWriter
       
    90 {
       
    91 public:
       
    92 
       
    93 	XmlWriter(const String& aXmlFileName, const String& aInputCommand);
       
    94 	~XmlWriter(void);
       
    95 
       
    96 	int CreateXslFile(void);
       
    97 	bool GetXslSourcePath(String& aExePath);
       
    98 	void StartReport(void);
       
    99 	void EndReport(void);
       
   100 	void StartImage(const String& aImageName);
       
   101     void EndImage(void);
       
   102 	void WriteExeAttribute(ExeAttribute& aOneSetExeAtt);
       
   103 	void StartExecutable(const unsigned int aSerNo, const String& aExeName);
       
   104 	void EndExecutable(void);
       
   105 	void WriteNote(void);
       
   106 	const String& ReportType(void);
       
   107 
       
   108 private:
       
   109 	// File stream for xml output.
       
   110 	ofstream iXmlFile;
       
   111 	// Xml file name for output.
       
   112 	const String iXmlFileName;
       
   113 	// Xml Buffer pointer.
       
   114 	xmlBufferPtr iXmlBufPtr;
       
   115 	// Xml write pointer to buffer.
       
   116 	xmlTextWriterPtr iXmlTextWriter;
       
   117 	//Hold the input command string
       
   118 	String iInputCommnd;
       
   119 	//Hold the report type
       
   120 	String iRptType;
       
   121 };
       
   122 
       
   123 #endif // XMLWRITER_H