示例#1
0
文件: Markup.cpp 项目: kamilWLca/brix
INXString CMarkup::x_GetData( int iPos ) const
{

    // Return a string representing data between start and end tag
    // Return empty string if there are any children elements
    if ( ! m_aPos[iPos].iElemChild && ! m_aPos[iPos].IsEmptyElement() )
    {
        // See if it is a CDATA section
        const char* tempCh = (const char*)m_csDoc;
        char* szDoc = (char*)tempCh;
        int nChar =	m_aPos[iPos].nStartR + 1;
        if ( x_FindAny( szDoc, nChar ) && szDoc[nChar] == '<'
                && nChar + 11 < m_aPos[iPos].nEndL
                && strncmp( &szDoc[nChar], "<![CDATA[",9) == 0)
        {
            nChar += 9;

            int nEndCDATA = m_csDoc.Finds("]]>", nChar);

            if ( nEndCDATA != -1 && nEndCDATA < m_aPos[iPos].nEndL )
            {
                return m_csDoc.Mid( nChar, nEndCDATA - nChar );
            }
        }
        return x_TextFromDoc( m_aPos[iPos].nStartR+1, m_aPos[iPos].nEndL-1 );
    }
    INXString temp("");
    return temp;
}
示例#2
0
文件: Markup.cpp 项目: pdrezet/brix
CString CMarkup::x_GetData( int iPos ) const
{

	// Return a string representing data between start and end tag
	// Return empty string if there are any children elements
	if ( ! m_aPos[iPos].iElemChild && ! m_aPos[iPos].IsEmptyElement() )
	{
		// See if it is a CDATA section
		LPCTSTR szDoc = (LPCTSTR)m_csDoc;
		int nChar = m_aPos[iPos].nStartR + 1;
		if ( x_FindAny( szDoc, nChar ) && szDoc[nChar] == _T('<')
				&& nChar + 11 < m_aPos[iPos].nEndL
				&& _tcsncmp( &szDoc[nChar], _T("<![CDATA["), 9 ) == 0 )
		{
			nChar += 9;
			int nEndCDATA = m_csDoc.Find( _T("]]>"), nChar );
			if ( nEndCDATA != -1 && nEndCDATA < m_aPos[iPos].nEndL )
			{
				return m_csDoc.Mid( nChar, nEndCDATA - nChar );
			}
		}
		return x_TextFromDoc( m_aPos[iPos].nStartR+1, m_aPos[iPos].nEndL-1 );
	}
	return _T("");
}
示例#3
0
CStdString CMarkupSTL::x_GetAttrib( int iPos, const char * szAttrib ) const
{
	// Return the value of the attrib at specified element
	if ( ! iPos || m_nNodeType != MNT_ELEMENT )
		return _T("");

	TokenPos token( m_csDoc );
	token.nNext = m_aPos[iPos].nStartL + 1;
	if ( szAttrib && x_FindAttrib( token, szAttrib ) )
		return x_TextFromDoc( token.nL, token.nR - ((token.nR<m_csDoc.GetLength())?0:1) );
	return _T("");
}
示例#4
0
文件: Markup.cpp 项目: pdrezet/brix
CString CMarkup::x_GetAttrib( int iPos, LPCTSTR szAttrib ) const
{
	// Return the value of the attrib
	TokenPos token( m_csDoc );
	if ( iPos && m_nNodeType == MNT_ELEMENT )
		token.nNext = m_aPos[iPos].nStartL + 1;
	else
		return _T("");

	if ( szAttrib && x_FindAttrib( token, szAttrib ) )
		return x_TextFromDoc( token.nL, token.nR - ((token.nR<m_csDoc.GetLength())?0:1) );
	return _T("");
}
示例#5
0
文件: Markup.cpp 项目: kamilWLca/brix
INXString CMarkup::x_GetAttrib( int iPos, char* szAttrib ) const
{
    // Return the value of the attrib
    char *tempCh = (char*)m_csDoc.c_str();
    TokenPos token(tempCh);
    if ( iPos && m_nNodeType == MNT_ELEMENT )
        token.nNext = m_aPos[iPos].nStartL + 1;
    else {
        INXString temp("");
        return temp;
    }
    if ( szAttrib && x_FindAttrib( token, szAttrib ) )
        return x_TextFromDoc( token.nL, token.nR - ((token.nR<m_csDoc.GetLength())?0:1) );
    INXString temp("");
    return temp;
}
示例#6
0
CStdString CMarkupSTL::x_GetData( int iPos ) const
{
	// Return a string representing data between start and end tag
	// Return empty string if there are any children elements
	if ( ! m_aPos[iPos].iElemChild && ! m_aPos[iPos].IsEmptyElement() )
	{
		// See if it is a CDATA section
		TokenPos token( m_csDoc );
		token.nNext = m_aPos[iPos].nStartR+1;
		if ( x_FindToken( token ) && m_csDoc[token.nL] == _T('<')
				&& token.nL + 11 < m_aPos[iPos].nEndL
				&& _tcsncmp( &token.szDoc[token.nL+1], _T("![CDATA["), 8 ) == 0 )
		{
			int nEndCDATA = m_csDoc.Find( _T("]]>"), token.nNext );
			if ( nEndCDATA != -1 && nEndCDATA < m_aPos[iPos].nEndL )
			{
				return m_csDoc.Mid( token.nL+9, nEndCDATA-token.nL-9 );
			}
		}
		return x_TextFromDoc( m_aPos[iPos].nStartR+1, m_aPos[iPos].nEndL-1 );
	}
	return _T("");
}