schemavalidatertest.java

来自「精通Jboss——Ejb和Web Services开发精解的随书源代码」· Java 代码 · 共 49 行

JAVA
49
字号
/**
 *
 * SchemaValidaterTest.java
 * 
 * Created on 2003-5-18 11:42:23
 * 
 */
package com.liuyang.ejb.xml.validation.test;

import com.liuyang.ejb.xml.validation.Validator;

import junit.framework.Assert;
import junit.framework.TestCase;
/**
 * @author
 * <a href="mailto:jdcyang@yahoo.com.cn">刘洋</a>
 */
public class SchemaValidaterTest extends TestCase {

	private Validator sv;
	/**
	 * Constructor for SchemaValidaterTest.
	 * @param arg0
	 */
	public SchemaValidaterTest(String arg0) {
		super(arg0);
	}
	/* (non-Javadoc)
	 * @see junit.framework.TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		// TODO Auto-generated method stub
		super.setUp();
		sv = Validator.newInstance("./node.xsd");
	}
	/*
	 * Test for void SchemaValidater(String)
	 */
	public void testSchemaValidaterString() {
		Assert.assertTrue(sv.validate("./node.xml"));
		//Assert.assertTrue(sv.validate("./data/xformsexample.xml"));
	}
	public static void main(String[] args){
		Validator sv = Validator.newInstance("./node.xsd");
		sv.validate("./node.xml");
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?