MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / processXML

Function processXML

common/src/util/__tests__/saxy.test.ts:7–23  ·  view source on GitHub ↗
(
    xml: string,
    schema?: Record<string, string[]>,
    shouldParseEntities = true,
  )

Source from the content-addressed store, hash-verified

5describe('Saxy XML Parser', () => {
6 // Helper function to process XML and get events
7 const processXML = (
8 xml: string,
9 schema?: Record<string, string[]>,
10 shouldParseEntities = true,
11 ) => {
12 const events: Array<{ type: string; data: any }> = []
13 const parser = new Saxy(schema, shouldParseEntities)
14
15 parser.on('text', (data) => events.push({ type: 'text', data }))
16 parser.on('tagopen', (data) => events.push({ type: 'tagopen', data }))
17 parser.on('tagclose', (data) => events.push({ type: 'tagclose', data }))
18
19 parser.write(xml)
20 parser.end()
21
22 return events
23 }
24
25 describe('Schema Validation with Text Conversion', () => {
26 it('should convert invalid top-level tags to text nodes', () => {

Callers 1

saxy.test.tsFile · 0.85

Calls 1

onMethod · 0.95

Tested by

no test coverage detected