The lines numbers you provide don't match up with anything useful in the latest 
XmlSchema release (2.0.3).   All I can suggest at this point is to upgrade to 
the latest release and retry.

Alternatively, feed the schema into some other schema processor  (like XJC that 
comes with the JDK) and see if it spits out a similar error with more 
information.


Dan



On Jul 17, 2013, at 12:53 PM, Rachna Jotwani <[email protected]> wrote:

> Hi
>  
> I am using the Apache XMLSchema apis to read XSDs. Using the below code.
> I have over 100 xsds.
>  
> I get the following error, but it doesn’t tell me which file has the invalid 
> character.
>  
> schemaCol.read method reads all dependent xsds as well, so it is difficult to 
> guess which xsd it could be.
>  
> Can someone give me some ideas to debug this?
>  
> Thanks
> Rachna
>  
>  
>  
> java.lang.RuntimeException: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: 
> An invalid or illegal XML character is specified.
>        at 
> org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1898)
>        at 
> org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1644)
>        at 
> org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:219)
>        at 
> org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:121)
>        at 
> org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:512)
>        at 
> org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:496)
>  
>              
>  
>               File file = new File(fileName);
>         DocumentBuilderFactory documentBuilderFactory = 
> DocumentBuilderFactory.newInstance();
>         documentBuilderFactory.setNamespaceAware(true);
>         Document doc = documentBuilderFactory.newDocumentBuilder().
>                 parse(fileName);
>         XmlSchemaCollection schemaCol = new XmlSchemaCollection();
>         schemaCol.setBaseUri(doc.getBaseURI());
>        
>  XmlSchema schema = schemaCol.read(doc, fileName, null);

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to