Forum Discussion
StephenC
14 years agoOccasional Contributor
Is this script correct
I got "Premature end o file" error
import com.eviware.soapui.support.XmlHolder
import javax.xml.XMLConstants
import javax.xml.transform.stream.StreamSource
import javax.xml.validation.SchemaFactory
def holder = new XmlHolder( messageExchange.responseContentAsXml )
holder.namespaces["q1"] = '...'
holder.namespaces["ns1"]= '...'
def node = holder["...xpath..."]
def factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI)
def schema = factory.newSchema(new StreamSource(new FileReader("c:/Temp/test.xsd")))
def validator = schema.newValidator()
validator.validate(new StreamSource(new StringReader(node))
I got "Premature end o file" error