-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
All,
I'm having an odd problem which I'm not sure I've seen before. I
*think* I'm doing everything correctly, but I'm not getting the
behavior I expect.
I'm trying to parse an XML document using digester 3.2. My code looks
like this:
Digester digester = new Digester();
try {
digester.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
digester.setFeature("http://xml.org/sax/features/external-general-entiti
es",
false);
digester.setFeature("http://xml.org/sax/features/external-parameter-enti
ties",
false);
digester.setFeature("http://apache.org/xml/features/disallow-doctype-dec
l",
true);
} catch (ParserConfigurationException pce) {
throw new SAXException("Cannot enable parser feature", pce);
}
digester.setRuleNamespaceURI("my-namespace-URI");
digester.setNamespaceAware(true);
digester.setValidating(false);
MyTopLevelBean bean = new MyTopLevelBean();
digester.push(bean);
digester.add[Whatever]("path/without/namespace/prefix", ...);
[... other rule additions ...]
digester.parse(xmlInput);
When I run this with an XML document with no namespace prefix but with
a namespace matching the one I have in the code:
<document xmlns="my-namespace-URI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:namespaceLocation="my-namespace-URI http://my/namespace/schema.xsd">
<sample-value>foo</sample-value>
</document>
All works as expected. But if I modify the document to include a
namespace prefix:
<foo:document xmlns:foo="my-namespace-URI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:namespaceLocation="my-namespace-URI http://my/namespace/schema.xsd">
<foo:sample-value>foo</foo:sample-value>
</foo:document>
I don't get any errors, but none of my rules fire and I get no data
coming out of the document. The code is identical.
Am I overlooking something very obvious?
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5G0yUACgkQHPApP6U8
pFirZBAAj4FZ2NLJWczJDCAMTc+usKlUw0ThrxNt45LAO0TU2geMqnXi8EhwLNgS
Bx9wJC4PGlgVhrUOktsIVnHlyCTi7UJcr4flakSWpJQSlpX5psV484f0eUgi7A3D
9IUsmRgfsKCtEZJjIrUiLJqIK9HrsxJx18FYGwpvFiYVtr+O/D4Uhw2aHexpShmG
c9xktRj/xi2ek9GgBbm/jVQIyMSWaVr+gn+XUxlKxhr0CTN58/Lyc2LtdJ/5xWg6
C7Lr2CxA1YuRbUswPIA2/xfcSqB4b0MGvSd9NeWFaMporwM5EXXqSvXUJXUQ9Co0
PKISLyWCr2BaCPXKkmHyL6biBU8TfdCpsWI2tb/fx9IBmkV3+kV9hCdLS8XhS3nZ
SBumzhCXVGMVYE5cAr8EvN4S81GtMertiLMI6oH8X7Zk0HK/ufQhRIXe3UY7kYQ0
2JkasShdBHji29sP6irnAY7C3m+kShFeGcOfQ8WwcIb02SUdk3zb/0JlDQhZBXBs
oTCIFNRHwkETjgcQM5Cq6wjljGvDhA+aL+V7AWLGGqrkwV5Jc2QoarK14GXC9fQt
zn67fTr/4Qk5zFoUJuyPmm/Dyld1xRO+M3nuN9N0s11ncIeTvyDqpwLbaAf9Iyiz
SLe//fGrP1M3w/nH1EBSQHmkU/6vZM5hx03gSsPZgpSEHyOUPhc=
=UaQv
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]