<rss version="2.0">
<channel>
<title>News from firstobject.com</title>
<link>http://www.firstobject.com/dn_news.xml</link>
<description>News from firstobject.com updated when articles are posted</description>
<language>en-us</language>
<lastBuildDate>29 Jul 2008 11:40:00 -0500</lastBuildDate>
<ttl>180</ttl>
<image>
<title>News from firstobject.com</title>
<width>142</width>
<height>18</height>
<link>http://www.firstobject.com/</link>
<url>http://www.firstobject.com/firstobjectNews.gif</url>
</image>
<item>
<title>In this case use ASCII ignorecase</title>
<link>http://www.firstobject.com/in-this-case-use-ascii-ignore-case.htm</link>
<guid isPermaLink="false">in-this-case-use-ascii-ignore-case.htm</guid>
<pubDate>29 Jul 2008 11:40:00 -0500</pubDate>
<description><![CDATA[<P>In short, CMarkup will no longer be using <code>strnicmp</code>. Instead I wrote the C++ function shown below. Now for the long version of this story:</P>
<P>CMarkup uses an ignorecase string comparison function for two purposes. The first one is to match the encoding name in the XML declaration:</P>
<PRE lang=xml><FONT color=#0000ff>&lt;?</FONT><FONT color=#004080>xml version</FONT><FONT color=#0000ff>="</FONT><FONT style='color:black;font-weight:bold;'>1.0</FONT><FONT color=#0000ff>"</FONT><FONT color=#004080> encoding</FONT><FONT color=#0000ff>="</FONT><FONT style='color:black;font-weight:bold;'>UTF-8</FONT><FONT color=#0000ff>"?&gt;</FONT></PRE>
<P>CMarkup matches "utf-8" and "UTF-8" with an ignorecase string comparison. The other purpose CMarkup has for this function is to support HTML:</P>
<PRE>CMarkup html
html.SetDocFlags( CMarkup::MDF_IGNORECASE );
html.Load( "test.htm" );
<FONT color=blue>while</FONT> ( html.FindElem("//a") )
  ...</PRE>
<P>This will find all of the hyperlink tags whether the HTML file uses upper or lower case "A" tags or a mixture of cases.</P>
<P>Unfortunately the ignorecase string comparison function is not standardized across platforms. Different C++ compilers have different function names such as <code>strncasecmp</code> <code>_strnicmp</code> <code>strnicmp</code> and <code>strncmpi</code>. In wide char builds too you have these variations: <code>wcsncasecmp</code> <code>_wcsnicmp</code> <code>wcsnicmp</code> and <code>wcsncmpi</code> (and the same issue occurs with the <code>stricmp</code> variant without the "n" in it, but CMarkup never used it).</P>
<P>
<TABLE class=commenttable><TR><TH class=commenttitle><IMG border=0 src="http://www.firstobject.com/letter.gif">
strncasecmp for CMarkup on OSX/Xcode</TH><TH class=commentsig>Geoff 22-Jul-2008</TH></TR><TR><TD colspan=2>
<P>Hi, I am evaluating CMarkup on OSX/Xcode. I have had to change the <code>strnicmp</code> to <code>strncasecmp</code>. Will this work?  So far it has compiled after this change.</P>
</TD></TR></TABLE></P>
<P>Yes it will work. But ideally you shouldn't be bothered with making this modification.</P>
<P>I spent a long time researching how I could safely determine which function name to use based on compiler defines so for example I could say:</P>
<PRE><FONT color=blue>#if</FONT> <FONT color=blue>defined</FONT>(LINUX)
<FONT color=blue>#define</FONT> MCD_PSZNICMP strncasecmp
<FONT color=blue>#elif</FONT> <FONT color=blue>defined</FONT>(_MSC_VER)
<FONT color=blue>#define</FONT> MCD_PSZNICMP _strnicmp
<FONT color=blue>#elif</FONT>...</PRE>
<P>The good news is that it appears all of the variations take the same arguments and work the same way. But the bad news is that I cannot hope to reliably figure out all of the compilers and versions of compilers. UNIX, LINUX and OS X compilers among others tend to use <code>strncasecmp</code>, while Visual C++ uses <code>_strnicmp</code> (or <code>strnicmp</code> if you link oldnames.lib), and others use <code>strnicmp</code> and <code>strncmpi</code>.</P>
<P>What does CMarkup actually need out of this function anyway? Sometimes you need to match and sort strings outside of the ASCII range containing characters like &#xc9; and &#xe9;. CMarkup doesn't need this. In unicode, the case mappings can differ slightly based on the case table version in your operating system (Michael Kaplan has an eye opening post <A href="http://blogs.msdn.com/michkap/archive/2007/08/21/4489089.aspx">illustrating the complexities of Unicode casing</A>). But CMarkup only needs to <B>ignore ASCII case</B>.</P>
<P>So instead of traveling any further down the road of trying to use an existing function supplied by the compiler or operating system platform, I simply wrote a small efficient function to do a string compare ignoring ASCII case. In other words, if a non-ASCII character is encountered, then the strings must be identical (do not ignore case).</P>
<PRE>static int x_StrNIACMP( MCD_PCSZ p1, MCD_PCSZ p2, int n )
{
  <FONT color=blue>bool</FONT> bNonAsciiFound = <FONT color=blue>false</FONT>;
  MCD_CHAR c1, c2;
  <FONT color=blue>while</FONT> ( n-- )
  {
    c1 = *p1++;
    c2 = *p2++;
    <FONT color=blue>if</FONT> ( c1 != c2 )
    {
      <FONT color=blue>if</FONT> ( bNonAsciiFound ||
          ! ( (c1 &gt;= 'a' && c1 &lt;= 'z' && c1 == c2 + ('a'-'A'))
            || (c2 &gt;= 'a' && c2 &lt;= 'z' && c2 == c1 + ('a'-'A')) ) )
        <FONT color=blue>return</FONT> c1 - c2;
    }
    <FONT color=blue>else</FONT> <FONT color=blue>if</FONT> ( (<FONT color=blue>unsigned</FONT> <FONT color=blue>int</FONT>)c1 &gt; 127 )
      bNonAsciiFound = <FONT color=blue>true</FONT>;
  }
  <FONT color=blue>return</FONT> 0;
}</PRE>
<P>This works for <code>char</code> and wide char <code>wchar_t</code> strings (<code>MCD_PCSZ</code> and <code>MCD_CHAR</code> are defined accordingly). In far eastern double byte a lead byte is non-ASCII, so it will work too. Feel free to use it if you need a string compare ignore ASCII case function in C/C++. This will be in the next release of CMarkup after release 9.0.</P>
]]></description>
</item>
<item>
<title>Visual C++ 6.0 XML demo adds CMarkup parser in 1 min</title>
<link>http://www.firstobject.com/visual-cpp-6-xml-demo-adds-cmarkup.htm</link>
<guid isPermaLink="false">visual-cpp-6-xml-demo-adds-cmarkup.htm</guid>
<pubDate>22 Jul 2008 13:00:00 -0500</pubDate>
<description><![CDATA[<P><A href="http://www.techsmith.com/camtasia.asp">Camtasia Studio</A> really makes putting together something like this super easy. I installed the free month trial and wanted to create something. It is really simple. I had a cheap computer microphone hanging around that I had not used for 10 years but it worked fine. Camtasia displays your voice volume so there's no guessing whether your voice is getting recorded.</P>
<P>I created a demo screencast about the <a href="http://www.firstobject.com/dn_markup.htm">C++ XML parser CMarkup</a>. This is a C++ class I wrote in 1999. Since then I put a lot of energy into making it better and have been selling the developer version here since 2001. It makes XML simple for a lot of people. But it doesn't do everything. Try out the evaluation version I demonstrated in this video and see if you get the results thousands of others have. And check out the articles and free C++ XML resources on this site.</P>
<P>And the video shows my high performance <a href="http://www.firstobject.com/dn_editor.htm">free firstobject XML Editor</a> which is especially useful with big UTF-8 files.</P>
<P><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/ENtdSut1ZhU&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/ENtdSut1ZhU&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></P>
<P>You can see it took a minute to download CMarkup, add it to the project, and configure it. Then it took about a minute and a half to add simple code to extract data out of the XML file.</P>
<P><a href="http://www.firstobject.com/dn_markup.htm">Give CMarkup a try</a> and let me know how it goes.</P>
]]></description>
</item>
<item>
<title>7.0-9.0 Issue: Memory checkers report uninitialized variable</title>
<link>http://www.firstobject.com/dn_markknown.htm#uninitbits</link>
<guid isPermaLink="false">dn_markknown.htm#uninitbits</guid>
<pubDate>18 Apr 2008 08:00:00 -0500</pubDate>
<description>IBM Rational Purify and Boundschecker may complain that nTagLengths is not initialized before it is used in void SetStartTagLen( int n ) { nTagLengths = (nTagLengths &amp; ~EP_STMASK) + n; };. This is caused by the way tag lengths were implemented in the struct ElemPos nTagLengths member since Release 7.0. It is not actually utilizing uninitialized bits, but the memory checkers might not know that....</description>
</item>
<item>
<title>firstobject Access Language</title>
<link>http://www.firstobject.com/dn_foal.htm</link>
<guid isPermaLink="false">dn_foal.htm</guid>
<pubDate>26 Jul 2007 10:01:00 -0500</pubDate>
<description>The firstobject access language "FOAL" based on C++ syntax is specialized for retrieving and reporting information in markup text documents. It also introduces an efficient and versatile way of doing lists and structures using markup. Built around the CMarkup API, it opens up new potential for rapid development of high performance processing and transformation of XML and other markup documents. ...</description>
</item>
<item>
<title>firstobject XML Editor Release 2.2</title>
<link>http://www.firstobject.com/dn_editrel.htm#rel22</link>
<guid isPermaLink="false">dn_editrel.htm#rel22</guid>
<pubDate>26 Jul 2007 10:00:00 -0500</pubDate>
<description>Release 2.2 introduces programming with FOAL and numerous fixes and enhancements. The following list indicates changes from release 2.1, many of which have also been mentioned and further explained for the interim Beta releases in the firstobject XML Editor Comments.</description>
</item>
<item>
<title>CMarkup Methods</title>
<link>http://www.firstobject.com/dn_markupmethods.htm</link>
<guid isPermaLink="false">dn_markupmethods.htm</guid>
<pubDate>14 May 2007 12:00:00 -0500</pubDate>
<description>These are the methods of the CMarkup class, based on the original EDOM design. This is the master list of CMarkup methods. The shaded methods are only available in the Developer Version of CMarkup.  Initialization   Load Populates the CMarkup object from a file and parses it SetDoc Populates the CMarkup object from a string and parses it   Output   Save Writes the document to file GetDoc Returns...</description>
</item>
<item>
<title>Documentation re-write!</title>
<link>http://www.firstobject.com/announcements.htm#sitereorg07spr</link>
<guid isPermaLink="false">announcements.htm#sitereorg07spr</guid>
<pubDate>14 May 2007 12:00:00 -0500</pubDate>
<description>This is a massive overhaul of the documentation, reorganized around the CMarkup Methods with lots of new example code.</description>
</item>
<item>
<title>What are MCD_STR and MCD_CSTR?</title>
<link>http://www.firstobject.com/dn_markmcdstr.htm</link>
<guid isPermaLink="false">dn_markmcdstr.htm</guid>
<pubDate>14 May 2007 11:00:00 -0500</pubDate>
<description>You will see MCD_ identifiers for strings and constant strings in the CMarkup method declarations.  MCD_STR is defined in Markup.h as a string class which, depending on your project, can be one of the following:  std::string (STL) std::wstring (STL/UNICODE) CString (MFC)  These string classes have built in efficiencies for passing by value, so they can be returned from functions without incurring...</description>
</item>
<item>
<title>XML Versioning</title>
<link>http://www.firstobject.com/dn_xmlversioning.htm</link>
<guid isPermaLink="false">dn_xmlversioning.htm</guid>
<pubDate>08 Apr 2007 12:00:00 -0500</pubDate>
<description>XML formats, languages, and vocabularies tend to evolve. Versioning is an extremely important consideration in the design of an XML format.  The very first version of an XML format invariably fails to foresee even the complete immediate uses of it! But it doesn't matter because during initial development none of the products using that XML are released yet and you can keep revising it until you...</description>
</item>
<item>
<title>Unified CMarkup for STL and MFC</title>
<link>http://www.firstobject.com/dn_markunifiedstlmfc.htm</link>
<guid isPermaLink="false">dn_markunifiedstlmfc.htm</guid>
<pubDate>01 Apr 2007 23:02:00 -0500</pubDate>
<description>As of CMarkup release 9.0, CMarkup can be compiled for either MFC or STL strings. Prior to this release, the CMarkupSTL class was separate from CMarkup.  STL goes prime time!  The primary result of merging these classes has been a lot more functionality for the STL version including UNICODE support and text encoding conversion functions.  CMarkupSTL customers who are upgrading to 9.0 should do the...</description>
</item>
<item>
<title>Dynamic Structure Documents</title>
<link>http://www.firstobject.com/dn_markstruct.htm</link>
<guid isPermaLink="false">dn_markstruct.htm</guid>
<pubDate>01 Apr 2007 23:01:00 -0500</pubDate>
<description>A CMarkup object can be used as a "dynamic structure document" to mimic the functionality of a simple C/C++ struct, but without compile-time rigidity. Compile-time checking of struct member names and types is often helpful, but it requires you to declare all of the members you might need even if you are unlikely to need them, and usually modifies a header file which affects other modules. For...</description>
</item>
<item>
<title>CMarkup Release 9.0</title>
<link>http://www.firstobject.com/dn_markrel.htm#rel90</link>
<guid isPermaLink="false">dn_markrel.htm#rel90</guid>
<pubDate>01 Apr 2007 23:00:00 -0500</pubDate>
<description>Now with STL/UNICODE out of the box, this release does away with the separated CMarkupSTL class in favor of compiling CMarkup for either STL string or MFC CString. See Unified CMarkup for STL and MFC.</description>
</item>
<item>
<title>GotoParentElemIndex Method</title>
<link>http://www.firstobject.com/dn_markGotoParentElemIndex.htm</link>
<guid isPermaLink="false">dn_markGotoParentElemIndex.htm</guid>
<pubDate>01 Apr 2007 09:00:00 -0500</pubDate>
<description>GotoParentElemIndex sets the current parent position to the element at the specified index. It clears the main and child positions. See ElemIndex Navigation for the full story on all the ElemIndex methods.  Element indexes can be retrieved with GetElemIndex, GetChildElemIndex and GetParentElemIndex. In addition to GotoParentElemIndex, there are GotoElemIndex and GotoChildElemIndex methods.  The...</description>
</item>
<item>
<title>GetDocElemCount Method</title>
<link>http://www.firstobject.com/dn_markGetDocElemCount.htm</link>
<guid isPermaLink="false">dn_markGetDocElemCount.htm</guid>
<pubDate>01 Apr 2007 09:00:00 -0500</pubDate>
<description>GetDocElemCount returns the number of elements in the document. This might be useful to gain a sense of the complexity of the document, statistically. It is also a way of estimating CMarkup's memory consumption since CMarkup maintains one structure of 8 integers per element, though there will usually be additional unused structures allocated. See CMarkup Indexing Explained.</description>
</item>
<item>
<title>GetParentElemIndex Method</title>
<link>http://www.firstobject.com/dn_markGetParentElemIndex.htm</link>
<guid isPermaLink="false">dn_markGetParentElemIndex.htm</guid>
<pubDate>01 Apr 2007 09:00:00 -0500</pubDate>
<description>GetParentElemIndex returns the current parent position element's internal index. See ElemIndex Navigation for the full story on all the ElemIndex methods.  This index can be specified in the GotoElemIndex, GotoChildElemIndex and GotoParentElemIndex methods. In addition to GetParentElemIndex, there are GetElemIndex and GetChildElemIndex methods.  When there is no current main position, such as...</description>
</item>
<item>
<title>Advanced CMarkup Developer</title>
<link>http://www.firstobject.com/dn_markadvanced.htm</link>
<guid isPermaLink="false">dn_markadvanced.htm</guid>
<pubDate>02 Nov 2006 23:00:00 -0500</pubDate>
<description>This is not a typical component package because it is the entire source code for these freeware programs. All of these features are demonstrated in action, allowing you to learn by example which is perhaps the deepest, most reliable kind of documentation. A few of the classes are lightly documented (follow the links below), but may change slightly from release to release within reason.  The...</description>
</item>
</channel>
</rss>
