MCPcopy Create free account
hub / github.com/ByConity/ByConity / processElementAndSkipContent

Function processElementAndSkipContent

src/Functions/extractTextFromHTML.cpp:141–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141bool processElementAndSkipContent(const char * __restrict & src, const char * end, const char * tag_name)
142{
143 const auto * old_src = src;
144
145 if (!(src < end && *src == '<'))
146 return false;
147 ++src;
148
149 if (!checkAndSkip(src, end, tag_name))
150 {
151 src = old_src;
152 return false;
153 }
154
155 if (src >= end)
156 return false;
157
158 if (!(isWhitespaceASCII(*src) || *src == '>'))
159 {
160 src = old_src;
161 return false;
162 }
163
164 const char * gt = find_first_symbols<'>'>(src, end);
165 if (gt >= end)
166 return false;
167
168 src = gt + 1;
169
170 while (true)
171 {
172 const char * lt = find_first_symbols<'<'>(src, end);
173 src = lt;
174 if (src + 1 >= end)
175 break;
176
177 ++src;
178
179 /// Skip CDATA
180 if (*src == '!')
181 {
182 --src;
183 char * dst = nullptr;
184 if (processCDATA(src, end, dst))
185 continue;
186 ++src;
187 }
188
189 if (*src != '/')
190 continue;
191 ++src;
192
193 if (checkAndSkip(src, end, tag_name))
194 {
195 while (src < end && isWhitespaceASCII(*src))
196 ++src;
197
198 if (src >= end)

Callers 1

extractFunction · 0.85

Calls 3

checkAndSkipFunction · 0.85
isWhitespaceASCIIFunction · 0.85
processCDATAFunction · 0.85

Tested by

no test coverage detected