commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dion Gillard <dion.gill...@gmail.com>
Subject Re: [Jelly] Problems with XML schema using Jelly and Avalon
Date Sat, 24 Jul 2004 07:06:44 GMT
Sounds like a dom4j bug we're exposing.

On Fri, 23 Jul 2004 15:05:00 -0500, Jon Brisbin
<jon.brisbin@npcinternational.com> wrote:
> I can't find anything in the archives about this, even though I'm sure
> something like this is in there.  Call me stupid...
> 
> Anyway, I have this XML configuration file that I'm loading with Jelly.  I
> have a special class that loads the XML file through Jelly, then builds an
> Avalon Configuration with it.  The problem comes when I'm trying to do XML
> Schema validation with the XML file.
> 
> In XML Spy, everything works great, but when I tried to load the XML file
> through the Jelly XMLParser with validation turned on, it consistently
> fails.  If anyone can shed light on why, I'd appreciate it...
> 
> Avalon Framework: 4.2.0
> Jelly: 1.0-beta3
> Xerces: 2.6.2
> 
> Code:
> 
>                         StringWriter sw = new StringWriter();
> 
>                         XMLSerializer ser = new XMLSerializer(sw, (new OutputFormat()));
> 
>                         XMLParser jellyParser = new XMLParser();
> 
>                         jellyParser.getXMLReader().setFeature(
>                                         "http://apache.org/xml/features/validation/schema",
true);
>                         jellyParser.getXMLReader().setFeature(
>                                         "http://xml.org/sax/features/validation", true);
>                         jellyParser.getXMLReader().setFeature(
>                                         "http://xml.org/sax/features/namespaces", true);
>                         jellyParser.getXMLReader().setFeature(
>                                         "http://xml.org/sax/features/namespace-prefixes",
false);
>                         jellyParser.setValidating(true);
> 
>                         XMLOutput jellyOutput = new XMLOutput(ser.asContentHandler());
> 
>                         Script jellyScript = jellyParser
> 
> ..parse("d:/projects/xportal-definitions/actions/sql/payroll/get_check_hdr.xm
> l");
>                         jellyScript.compile();
>                         jellyScript.run((new JellyContext()), jellyOutput);
> 
>                         System.out.println("[After]: " + sw.toString());
> 
>                         ByteArrayInputStream bais = new ByteArrayInputStream(sw.toString()
>                                         .getBytes());
> 
>                         DefaultConfigurationBuilder configBuilder = new
> DefaultConfigurationBuilder();
> 
>                         Configuration config = configBuilder.build(bais);
> 
>                         System.out.println("[Config]: "
>                                         + ConfigurationUtil.toString(config));
> 
> Root XML element (validates fine in XMLSpy):
> 
> <x:action
>         xmlns="http://npci.com/xportal/1.0"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns:x="http://npci.com/xportal/1.0"
>         xsi:schemaLocation="-//http://npci.com/xportal/1.0//-
> D:\projects\xportal-definitions\xsd\jdbc-handler.xsd">
> 
> Root XML element (after parsing in Jelly):
> [After]: <?xml version="1.0" encoding="UTF-8"?>
> <x:action
>         schemaLocation="-//http://npci.com/xportal/1.0//-
> D:\projects\xportal-definitions\xsd\jdbc-handler.xsd"
>         xmlns="http://npci.com/xportal/1.0"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 
> BTW- Why are these two elements different?  Shouldn't the namespace info
> come across just as it went in?
> 
> Thanks!
> 
> Jon Brisbin
> =======================================
> Development Programmer
> NPC International
> (620) 235-7726
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


-- 
http://www.multitask.com.au/people/dion/

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message