Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1314 - in development/main: metro metro/composition/impl/src/main/net/dpml/composition/util metro/composition/test/src/test/net/dpml/composition/util planet/facilities/http

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: pneubauer AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1314 - in development/main: metro metro/composition/impl/src/main/net/dpml/composition/util metro/composition/test/src/test/net/dpml/composition/util planet/facilities/http
  • Date: Mon, 27 Dec 2004 23:09:15 +0100

Author: pneubauer
Date: Mon Dec 27 23:09:15 2004
New Revision: 1314

Modified:

development/main/metro/composition/impl/src/main/net/dpml/composition/util/XercesSchemaValidator.java

development/main/metro/composition/test/src/test/net/dpml/composition/util/SchemaValidationTestCase.java
development/main/metro/index.xml
development/main/planet/facilities/http/index.xml
Log:
Trying to set the XercesImpl that is used for Configuration and Composition
XML parsers.
Activated the XMl validation again in SchemaValidationTestCase, since
Xerces-specific Parser setup has been factored out (cheers David, hopefully)
-This line, and those below, will be ignored--

M main/planet/facilities/http/index.xml
M
main/metro/composition/test/src/test/net/dpml/composition/util/SchemaValidationTestCase.java
M
main/metro/composition/impl/src/main/net/dpml/composition/util/XercesSchemaValidator.java
M main/metro/index.xml


Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/util/XercesSchemaValidator.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/util/XercesSchemaValidator.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/util/XercesSchemaValidator.java
Mon Dec 27 23:09:15 2004
@@ -109,14 +109,18 @@
factory.setValidating( true );
factory.setNamespaceAware( true );
SAXParser saxParser = factory.newSAXParser();
- try
+ //special Xerces setup
+ if (saxParser instanceof org.apache.xerces.jaxp.SAXParserImpl)
{
- saxParser.setProperty( JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA );
- }
- catch ( SAXNotRecognizedException x )
- {
- throw new ParserConfigurationException(
- "the parser "+ saxParser + " does not support JAXP1.2" +
x );
+ try
+ {
+ saxParser.setProperty( JAXP_SCHEMA_LANGUAGE,
W3C_XML_SCHEMA );
+ }
+ catch ( SAXNotRecognizedException x )
+ {
+ throw new ParserConfigurationException(
+ "the parser "+ saxParser + " does not support the
property " + JAXP_SCHEMA_LANGUAGE + ": " + x );
+ }
}
return saxParser;
}

Modified:
development/main/metro/composition/test/src/test/net/dpml/composition/util/SchemaValidationTestCase.java
==============================================================================
---
development/main/metro/composition/test/src/test/net/dpml/composition/util/SchemaValidationTestCase.java
(original)
+++
development/main/metro/composition/test/src/test/net/dpml/composition/util/SchemaValidationTestCase.java
Mon Dec 27 23:09:15 2004
@@ -1,5 +1,6 @@
package net.dpml.composition.util;

+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -66,14 +67,20 @@

private XercesSchemaValidator m_validator;

- protected void _setUp() throws Exception
+ private static final String XML_CONFIGURATION = "<?xml
version=\"1.0\"?>" +
+ "<configuration
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+
"xsi:noNamespaceSchemaLocation=\"ConfigurableB.xschema\" attr1=\"foo\">" +
+ "<child1/>" +
+ "</configuration>";
+
+ protected void setUp() throws Exception
{

m_validator = new XercesSchemaValidator();

}

- public void _testSimpleParseWithOkConfigXML() throws Exception
+ public void testSimpleParseWithOkConfigXML() throws Exception
{
String xmlDocumentUrl = System.getProperty( "basedir" )
+ "/target/test/ConfigurableB.xml";
@@ -84,9 +91,10 @@

}

- public void _testSimpleParseWithNonExistentSchemaUrl() throws Exception
+ public void testSimpleParseWithNonExistentSchemaUrl() throws Exception
{
- String xmlDocumentUrl = "config1.xml";
+ String xmlDocumentUrl = System.getProperty( "basedir" )
+ + "/target/test/ConfigurableB.xml";
TypeBuilder builder = new TypeBuilder();
Type type = builder.buildType( ConfigurableA.class );
Configuration config = ConfigurationBuilder.build( xmlDocumentUrl );
@@ -101,19 +109,23 @@
}
}

- public void _testParsingOfValidatingXMLNotOKWhenUsingStream() throws
Exception
+ public void testParsingOfValidatingXMLNotOKWhenUsingStream() throws
Exception
{
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating( true );
factory.setNamespaceAware( true );
SAXParser saxParser = factory.newSAXParser();
- try
+ System.out.println("XML parser: " + saxParser);
+ if (saxParser instanceof org.apache.xerces.jaxp.SAXParserImpl)
{
- saxParser.setProperty( JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA );
- }
- catch ( SAXNotRecognizedException x )
- {
- fail( "parser does not support JAXP1.2" );
+ try
+ {
+ saxParser.setProperty( JAXP_SCHEMA_LANGUAGE,
W3C_XML_SCHEMA );
+ }
+ catch ( SAXNotRecognizedException x )
+ {
+ fail( "parser does not support JAXP1.2" );
+ }
}
String basedir = System.getProperty( "basedir" );
//System.out.println( basedir );
@@ -124,7 +136,9 @@
assertEquals( 0, testHandler.getErrors().size() );
InputStream is = new FileInputStream( xmlFile );
saxParser.parse( new InputSource( is ), testHandler );
- assertEquals( 1, testHandler.getErrors().size() );
+ assertEquals( 0, testHandler.getErrors().size() );
+
+

}


Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Mon Dec 27 23:09:15 2004
@@ -61,6 +61,7 @@
</info>
<dependencies>
<include key="dpml-configuration-api"/>
+ <include key="xercesImpl" runtime="true" build="true" />
</dependencies>
</project>

@@ -926,6 +927,15 @@
<version>1.1.1</version>
</info>
</resource>
+
+
+ <resource>
+ <info>
+ <name>xercesImpl</name>
+ <version>2.6.2</version>
+ <group>xerces</group>
+ </info>
+ </resource>


</index>

Modified: development/main/planet/facilities/http/index.xml
==============================================================================
--- development/main/planet/facilities/http/index.xml (original)
+++ development/main/planet/facilities/http/index.xml Mon Dec 27 23:09:15
2004
@@ -237,12 +237,5 @@
</info>
</resource>

- <resource>
- <info>
- <name>xercesImpl</name>
- <version>2.6.2</version>
- <group>xerces</group>
- </info>
- </resource>

</index>



  • svn commit: r1314 - in development/main: metro metro/composition/impl/src/main/net/dpml/composition/util metro/composition/test/src/test/net/dpml/composition/util planet/facilities/http, pneubauer, 12/27/2004

Archive powered by MHonArc 2.6.24.

Top of Page