From: James S. <Jam...@ar...> - 2010-03-19 05:29:38
|
Greetings, Chances are I am missing something critical here, but here goes anyway. I am trying to validate some xml as follows: InputSource is = new InputSource(new StringReader(response)); Validator v; try { v = new org.custommonkey.xmlunit.Validator(is); v.useXMLSchema(true); if (!v.isValid()) { throw new ValidationError(v.toString()); } An example of a test XML doc (let's say this is from www.test.org/sample.xml) I have been using is as follows: <person xmlns="http://www.cafeconleche.org/namespaces/person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.test.org/namespaces/person person.xsd"><http://www.elharo.com/person.xs%22%3e> <name> <first_name>Alan</first_name> <last_name>Turing</last_name> </name> <profession>computer scientist</profession> <profession>mathematician</profession> <profession>cryptographer</profession> </person> In this example xmlunit will try to grab person.xsd from my local machine's working directory. I want it to grab it from www.test.org/person.xsd<http://www.test.org/person.xsd> (I would like to avoid putting an absolute path in though). I realize that because I am using an InputSource I have lost any location information from my XML, so I have tried using is.setSystemId(http://www.test.org); to set the relative path. This doesn't seem to have worked. I am guessing I am misunderstanding something here, any ideas? Cheers, James Sewell ________________________________ The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence. |