[xml] character entity replacements



I have a very unique request and was wondering how I can accomplish this
with libxml2 (2.4.16) (if at all).

I create XML with some external script from a databases export and am
currently using

xmllint --valid --noent --format

to validate, format and replace character entities (it's very fast). The
database export contains entities already (some of which are defined in
external *.ent files). Is there a way to intercept the handling of entities
not declared (unresolved entities) and replace them with
[entityName] -please don't ask why -o)?

This would save me from collecting all those reported by xmllint and
declaring them as
<!ENTITY ent "&lsqb;ent&rsqb;">. This wouldn't be a problem but I'm talking
about (possibly) hundreds spread across millions of records.

Any help/advice would be appreciated,

David




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]