Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Namespace validation

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • To: Iwan Memruk <iwan.memruk AT gmail.com>
  • Cc: XOM-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Namespace validation
  • Date: Mon, 13 Mar 2006 20:43:43 -0800

On Mar 12, 2006, at 12:21 AM, Iwan Memruk wrote:

Hi,

Is it possible that some day XOM will have an option to allow invalid
(non-URI) namespaces?

It is sometimes necessary to have a possibility to parse XML with
invalid namespace URI's.
For example, some public webservices got such namespaces in their WSDL's.

--
Thanks,
Iwan.


Here's how I solved the problem when I was dealing with some 50000 testcases pulled from various public sources, none of which will change its behaviour just because XOM happens to be a bit more zealous than the XML spec (arguably) and than actual XML parsers (definitely). Modify Verifier.java as follows:

static void checkAbsoluteURIReference(String uri) {
if (!checkURI) return;
...
}

private final static boolean checkURI = getSystemProperty ("nu.xom.Verifier.checkURI", true);

/** little helper for safe reading of boolean system properties */
private static boolean getSystemProperty(String key, boolean defaults) {
try {
return "true".equalsIgnoreCase(
System.getProperty(key,
String.valueOf(defaults)));
} catch (Throwable e) { // better safe than sorry (applets, security managers, etc.) ...
return defaults; // we can live with that
}
}







Archive powered by MHonArc 2.6.24.

Top of Page