I have a small program that reads an XML and writes it. There are some entities in the xml attributes, which I don't want to be resolved, but justto be written back as they appear in the source file. I'm using the DocumentBuilderFactory class and it's method setExpandEntityReferences(false) to avoid the expansions of the entities, but it still resolves the entities within the attributes. Why? What's wrong? I'm working xerces.jar (2.7.1), xalan.jar(2.7.0) and xml-apis(2.7.1) and jdk 1.3.1.
// By default JAXP does not include entity reference nodes // in the tree. You have to explicitly request them by // telling DocumentBuilderFactory not to expand entity // references. factory.setExpandEntityReferences(false);