![]() This is a function from the firstobject XML Editor which uses the Offset functions and a navigation algorithm to find the element at the given offset. The example code above uses a function called FindOffset provided below. M_edit.SetSel( nStart, nStart + nLength ) M_edit.GetSel( nStart, nEndChar ) // get cursor offset in edit controlįindOffset( xml, nStart ) // locate corresponding position in xml The following example extends the edit selection to the bounds of the current element by first locating the element position using the cursor offset in the document. In these cases, the current element is determined from the cursor location in the edit control. } Determine element and attribute at cursorĪ more useful example application might provide the user with a function to extend the edit selection to the bounds of the current element or to toggle the selection between the start and end tags of the current element, or even to provide context sensitive help. M_edit.SetSel( nInStart, nInStart + nInLength ) If ( xml.GetAttribOffsets("code",&nStart,&nLength,&nInStart,&nInLength) ) If ( xml.SetDoc() & xml.FindChildElem() & xml.IntoElem() ) int nStart, nLength, nInStart, nInLength The following code sets the m_edit control edit selection to the code attribute value i.e. Say you have a CEdit control containing the XML document text of the above example. now nStart is 16, nLength is 10, nInStart is 22, nInLength is 3 Set selection in an edit control The following example gets the starting offset and length of the code attribute and the starting offset and length of the value 560. The last two arguments are optional they are for obtaining the location of the value inside the quotes. ![]() The following XML document has an attribute in the NAME element. GetAttribOffsets allows you to obtain the offsets into the document text for the specified attribute. See the GetOffsets method for details of how document offsets work. GetAttribOffsets is only in CMarkup Developer and the free XML editor FOAL C++ scripting. CMarkup GetAttribOffsets Method bool CMarkup::GetAttribOffsets(
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |