[go: up one dir, main page]

xmlparser 0.4.1

Pull-based, zero-allocation XML parser.
Documentation
{"tests": [

{"description": "CDATA state 1",
"input": "<p><![CDATA[content]]></p>",
"output":[
    { "ElementStart" : "p" },
    { "ElementEnd" : "Open" },
    { "CDATA" : "content" },
    { "ElementEnd" : { "Close" : "p" } }
]},

{"description": "CDATA state 2",
"input": "<p><![CDATA[&amping]]></p>",
"output":[
    { "ElementStart" : "p" },
    { "ElementEnd" : "Open" },
    { "CDATA" : "&amping" },
    { "ElementEnd" : { "Close" : "p" } }
]},

{"description": "CDATA state 3",
"input": "<p><![CDATA[&amping ]]]></p>",
"output":[
    { "ElementStart" : "p" },
    { "ElementEnd" : "Open" },
    { "CDATA" : "&amping ]" },
    { "ElementEnd" : { "Close" : "p" } }
]},

{"description": "CDATA state 4",
"input": "<p><![CDATA[&amping]] ]]></p>",
"output":[
    { "ElementStart" : "p" },
    { "ElementEnd" : "Open" },
    { "CDATA" : "&amping]] " },
    { "ElementEnd" : { "Close" : "p" } }
]},

{"description": "CDATA state 5",
"input": "<p><![CDATA[<message>text</message>]]></p>",
"output":[
    { "ElementStart" : "p" },
    { "ElementEnd" : "Open" },
    { "CDATA" : "<message>text</message>" },
    { "ElementEnd" : { "Close" : "p" } }
]},

{"description": "CDATA state 6",
"input": "<p><![CDATA[</this is malformed!</malformed</malformed & worse>]]></p>",
"output":[
    { "ElementStart" : "p" },
    { "ElementEnd" : "Open" },
    { "CDATA" : "</this is malformed!</malformed</malformed & worse>" },
    { "ElementEnd" : { "Close" : "p" } }
]},

{"description": "Continious CDATA",
"input": "<p><![CDATA[1]]><![CDATA[2]]></p>",
"output":[
    { "ElementStart" : "p" },
    { "ElementEnd" : "Open" },
    { "CDATA" : "1" },
    { "CDATA" : "2" },
    { "ElementEnd" : { "Close" : "p" } }
]},

{"description": "Whitespaced CDATA",
"input": "<p> \n <![CDATA[data]]> \t </p>",
"output":[
    { "ElementStart" : "p" },
    { "ElementEnd" : "Open" },
    { "Whitespaces" : " \n " },
    { "CDATA" : "data" },
    { "Whitespaces" : " \t " },
    { "ElementEnd" : { "Close" : "p" } }
]},

{"description": "CDATA bracket text state",
"input": "<p><![CDATA[bracket ]after]]></p>",
"output":[
    { "ElementStart" : "p" },
    { "ElementEnd" : "Open" },
    { "CDATA" : "bracket ]after" },
    { "ElementEnd" : { "Close" : "p" } }
]}

]}