В Ax2.5 парсинг HTML основан на классе TextBuffer. По нему есть кое-какая справка, поскольку это класс ядра Axapta.
X++:
TextBuffer textBuffer = new TextBuffer();
;
textBuffer.appendText("<html><body>");
textBuffer.appendText("<h3>The HTML Viewer/Editor</h3>");
textBuffer.appendText("<p>The HTML Control can Show and Edit HTML text.</p>");
textBuffer.appendText("<p>It supports images and <a href=next>hyperlinks</a></p>");
textBuffer.appendText("</body></html>");
// Все фрагменты текста ограниченные угловыми скобками
while (textBuffer.nextToken(0,"<>"))
{
print textBuffer.token();
}
pause;
X++:
TextBuffer textBuffer = new TextBuffer();
int posFrom,
posTo,
posNext;
;
textBuffer.appendText("<html><body>");
textBuffer.appendText("<h3>The HTML Viewer/Editor</h3>");
textBuffer.appendText("<p>The HTML Control can Show and Edit HTML text.</p>");
textBuffer.appendText("<p>It supports images and <a href=next>hyperlinks</a></p>");
textBuffer.appendText("</body></html>");
// Нужно отключить использование регулярных выражений,
// поскольку угловые скобки - это спец.символы регулярных выражений
textBuffer.regularExpressions(false);
// Игнорировать регистр искомых символов
textBuffer.ignoreCase(true);
// Поиск абзацев. Т.е. фрагментов между <p> и </p>
posNext = 0;
while (textBuffer.find("<p>",posNext))
{
posNext = textBuffer.matchPos() + textBuffer.matchLen();
if (textBuffer.find("</p>",posNext))
{
posFrom = posNext;
posTo = textBuffer.matchPos();
posNext = textBuffer.matchPos() + textBuffer.matchLen();
print textBuffer.subStr(posFrom, posTo - posFrom);
}
}
pause;
Примеры использования относятся к классам и формам создания/редактирования справки в Axapta. Т.е. это формы вроде SysInetHTMLEditor