1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

XFA - Add a parser for XFA files

- the parser is base on a class extending XMLParserBase
 - it handle xml namespaces:
   * each namespace is assocated with a builder
   * builder builds nodes belonging to the namespace
   * when a node is inserted in the parent namespace compatibility is checked (if required)
 - to avoid name collision between xml names and object properties, use Symbol.
This commit is contained in:
Calixte Denizet 2021-02-01 13:44:03 +01:00
parent c92011e093
commit 0ff5cd7eb5
14 changed files with 1049 additions and 10 deletions

View file

@ -63,6 +63,8 @@ class XMLParserBase {
return "&";
case "quot":
return '"';
case "apos":
return "'";
}
return this.onResolveEntity(entity);
});
@ -455,14 +457,6 @@ class SimpleXMLParser extends XMLParserBase {
return { documentElement };
}
onResolveEntity(name) {
switch (name) {
case "apos":
return "'";
}
return super.onResolveEntity(name);
}
onText(text) {
if (isWhitespaceString(text)) {
return;
@ -509,4 +503,4 @@ class SimpleXMLParser extends XMLParserBase {
}
}
export { SimpleDOMNode, SimpleXMLParser };
export { SimpleDOMNode, SimpleXMLParser, XMLParserBase, XMLParserErrorCode };