/** * Creates a new configuration. * * <p>Any dependent schemas should be added in subclass constructor. The xml schema dependency * does not have to be added. */ public Configuration(XSD xsd) { this.xsd = xsd; dependencies = Collections.synchronizedList(new ArrayList()); // bootstrap check if (!(this instanceof XSConfiguration)) { dependencies.add(new XSConfiguration()); } properties = Collections.synchronizedSet(new HashSet()); context = new DefaultPicoContainer(); }
@Override protected void setUp() throws Exception { XSConfiguration xs = new XSConfiguration(); p = new Parser(xs); }
public void testWhitespace() throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(getClass().getResourceAsStream("whitespace.xml")); String schemaLocation = "http://geotools.org/test " + getClass().getResource("facets.xsd").getFile(); doc.getDocumentElement() .setAttributeNS( "http://www.w3.org/2001/XMLSchema-instance", "schemaLocation", schemaLocation); DOMParser parser = new DOMParser(new XSConfiguration(), doc); String s = (String) parser.parse(); assertEquals("this is a normal string with some whitespace and some new lines", s); }
public ApplicationSchemaConfiguration(String namespace, String schemaLocation) { super(new ApplicationSchemaXSD(namespace, schemaLocation)); addDependency(new XSConfiguration()); addDependency(new GMLConfiguration()); }
public void testCDATAWhitespace() throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(getClass().getResourceAsStream("whitespace-cdata.xml")); String schemaLocation = "http://geotools.org/test " + getClass().getResource("facets.xsd").getFile(); doc.getDocumentElement() .setAttributeNS( "http://www.w3.org/2001/XMLSchema-instance", "schemaLocation", schemaLocation); DOMParser parser = new DOMParser(new XSConfiguration(), doc); String s = (String) parser.parse(); assertEquals( " this is a \n" + " normal string \n" + " with some whitespace and \n" + " some new lines", s); } }
public void testList() throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(getClass().getResourceAsStream("list.xml")); String schemaLocation = "http://geotools.org/test " + getClass().getResource("facets.xsd").getFile(); doc.getDocumentElement() .setAttributeNS( "http://www.w3.org/2001/XMLSchema-instance", "schemaLocation", schemaLocation); DOMParser parser = new DOMParser(new XSConfiguration(), doc); Object o = parser.parse(); assertTrue(o instanceof List); List list = (List) o; assertEquals(3, list.size()); assertEquals(Integer.valueOf(1), list.get(0)); assertEquals(Integer.valueOf(2), list.get(1)); assertEquals(Integer.valueOf(3), list.get(2)); }
public TestConfiguration() { super(new TEST()); addDependency(new XSConfiguration()); } }
new Configuration(xsd) { addDependency(new XSConfiguration());
/** * Creates a new configuration. * <p> * Any dependent schemas should be added in sublcass constructor. The xml schema * dependency does not have to be added. * </p> * */ public Configuration() { dependencies = new ArrayList(); //bootstrap check if ( !( this instanceof XSConfiguration ) ) { dependencies.add( new XSConfiguration() ); } properties = Collections.synchronizedList(new ArrayList()); }
/** * Creates a new configuration. * <p> * Any dependent schemas should be added in sublcass constructor. The xml schema * dependency does not have to be added. * </p> * */ public Configuration(XSD xsd) { this.xsd = xsd; dependencies = new ArrayList(); //bootstrap check if (!(this instanceof XSConfiguration)) { dependencies.add(new XSConfiguration()); } properties = new ArrayList(); }
/** * Creates a new configuration. * <p> * Any dependent schemas should be added in sublcass constructor. The xml schema * dependency does not have to be added. * </p> * */ public Configuration(XSD xsd) { this.xsd = xsd; dependencies = new ArrayList(); //bootstrap check if (!(this instanceof XSConfiguration)) { dependencies.add(new XSConfiguration()); } properties = Collections.synchronizedList(new ArrayList()); context = new DefaultPicoContainer(); }
public ApplicationSchemaConfiguration(String namespace, String schemaLocation) { assert namespace != null; assert schemaLocation != null; this.namespace = namespace; this.schemaLocation = schemaLocation; addDependency(new XSConfiguration()); addDependency(new GMLConfiguration()); }
public ApplicationSchemaConfiguration(String namespace, String schemaLocation) { super(new ApplicationSchemaXSD(namespace, schemaLocation)); addDependency(new XSConfiguration()); addDependency(new GMLConfiguration()); }
public ApplicationSchemaConfiguration(String namespace, String schemaLocation) { super(new ApplicationSchemaXSD(namespace, schemaLocation)); addDependency(new XSConfiguration()); addDependency(new GMLConfiguration()); }