map and BYTE[]

From: Vince (vsix_at_caramail.com)
Date: 01/17/05


Date: Mon, 17 Jan 2005 23:37:58 +0100

Hi,

I am starting to play with with C++ and I have some questions.
I need to parse a XML file that describes a smart card file structure
and to initialize my data structure.
First I chose this structure :

A CCardObject has files (index by SFID) and each file has
records(indexed by RecNo) and each record can be splitted into
data(index by string).

class CDataIndex
{
public :
        int m_nSFID; // FileID
        int m_nRecNo; // RecNo
        int m_nOffset; // Offset
        int m_nSize; // DataLen

   CDataIndex() { }
   CDataIndex(int nSFID, int nRecNo, int nOffset, int size) {
          m_nSFID = nSFID;
          m_nRecNo = nRecNo;
          m_nOffset = nOffset;
          m_nSize = size;
   }

   CDataIndex(const CDataIndex& ob)
   {
          m_nSFID = ob.m_nSFID;
          m_nRecNo = ob.m_nRecNo;
          m_nOffset = ob.m_nOffset;
          m_nSize = ob.m_nSize;
   }

   void operator = (const CDataIndex& ob)
     {
                m_nSFID = ob.m_nSFID;
                m_nRecNo = ob.m_nRecNo;
                m_nOffset = ob.m_nOffset;
                m_nSize = ob.m_nSize;
        }
};
class CCardRecord
{
public :
        int m_nRecNo;
        int m_nRecSize;
        map<int, BYTE[29]> m_RecData;

        CCardRecord() {}
        CCardRecord( int nRecNo ) { m_nRecNo = nRecNo;}

        int GetRecNo() { return m_nRecNo; }
        int GetRecSize() { return m_nRecSize; }
        int GetData(int nOffset, int nSize);
};

class CCardFile
{
public :
        int m_nSFID;
        map<int, CCardRecord> m_records;

        CCardFile() {}
        CCardFile( int nSFID ) { m_nSFID = nSFID;}

};

class CCardObj
{
public:
        CCardObj();
        virtual ~CCardObj();
        BOOL LoadCardMapping();
        BOOL ReadMappingFile(CXMLReader &xml);
        void XMLCardFile(CXMLReader &xml);
        void XMLCardRecord( CXMLReader &xml );
        void XMLCardData( CXMLReader &xml );

        CString m_csTag;
        int m_nSFID;
        int m_nRecNo;
        int m_nRecSize;
        int m_nDataOffset;
        int m_nDataType;
        int m_nDataSize;
        CString m_csName;
        BYTE m_Data[29];

                // CardReader Object - LOW LEVEL API
        CCardReader* m_pCardReader;
        
        // Associate stringwith SFID, RecNo, Offset and Size
        map<CString, CDataIndex> m_dataIndex;

        // File collection index by Short File Id (SFID)
        map<int, CCardFile> m_FileIndex;
};

When I parse the XML file and I find the <CardRecord> tag I get its
attributes and I would like to add a new array of byte.
How can I do that ?

void CCardObj::XMLCardRecord( CXMLReader &xml )
{
        xml.getAttribute( "index", m_nRecNo ); // Get record No
        xml.getAttribute( "size", m_nRecSize );// Get record size
        
        m_FileIndex[ m_nSFID ].m_records[ m_nRecNo ] = ????

        xml.intoTag();
        while ( xml.nextTag( m_csTag ) ){
                if (m_csTag == "CardData"){
                        XMLCardData( xml );
                }
        }
        xml.outofTag();
}



Relevant Pages

  • Re: can this be done
    ... But when you have a known table and column structure (or rather, ... such as using a 'raw' XML file that I define? ... StateRuleID (int) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Strange performance behavior of IXMLDOMNode>>text in DPRO 5.1.4
    ... I have come a quite a way in building my own framework to parse a particular XML file (that contains information about audio tracks). ... After some more experimentation I also found that the bigger the XML file was, the longer each method execution took, even if it was for the same node at the same position. ...
    (comp.lang.smalltalk.dolphin)
  • RE: Bug in MSXML / XML Parser .Net
    ... > I have a problem parsing XML file using XSLT stylesheet by using: ... > System.Xml.XPath.MethodOperand.SetXsltContext(XsltContext context) ... > When I use XMLSpy to parse the XML using MSXML 4 processor it works perfect. ...
    (microsoft.public.dotnet.xml)
  • Re: How to get data from txt file into table of word template thro
    ... XLST file to transform the XML file into the output you need? ... I have a word document which has a lot of tables ... There's no way to answer the question about whether VBA is the best ... For the XML data source file, you said Word can parse it by itself. ...
    (microsoft.public.word.vba.general)
  • Re: TemplateField Buttons Ignoring OnClick Event
    ... The buttons get their settings from an XML file attached to an ... the RowCommand event of the GridView. ... protected void Page_Load(object sender, EventArgs e) ... int d = int.Parse); ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)