[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    Re: possible bug in XmlObject.parse()
From:       David Jencks <david () coredevelopers ! net>
Date:       2004-10-28 16:18:31
Message-ID: 023C06E5-28FD-11D9-A78B-000D93361CAA () coredevelopers ! net
[Download RAW message or body]

Why not use the validate method, present and working in v1?  You can  
get it to give you a nice explicit list of validation problems.

The nice thing about not validating during parse is that then you can  
go through using xmlcursors and fix up the xml before you try to  
validate.  Kind of odd to do, but you can do things like putting  
various elements in different namespaces.  This can make life simpler  
for both the guy who has to write the xml and the one writing the code  
using xmlbeans.

david jencks

On Oct 28, 2004, at 7:55 AM, Springer, Ian P. wrote:

> This is an issue for us because if the contents of the XML being  
> parsed do not match the schema, the subelement names in the XmlObject  
> returned by parse() match the schema and not the XML that was passed  
> in. Are there any plans for v2 to add an option to parse() that  
> enables validation?
>
> Thanks,
> Ian
>
> ________________________________
>
> From: Kevin Krouse [mailto:kkrouse@bea.com]
> Sent: Wed 10/27/2004 11:13 PM
> To: dev@xmlbeans.apache.org
> Subject: RE: possible bug in XmlObject.parse()
>
>
>
> When parsing a *Document type, only the root element's QName matters.
> If the QName of the root element is correct, a new instance of
> FooDocument (or whatever) will be created.  XmlBeans lazily creates
> XmlObjects when they are requested, so no type information is known
> about the subelement until you ask for it.  It isn't required that an
> instance of some generated type to be valid for you to use it.  In  
> fact,
> no validation is done during parsing at all.
>
> I hope my explanation makes sense...
>
> --k
>
> -----Original Message-----
> From: Springer, Ian P. [mailto:ian.springer@hp.com]
> Sent: Tuesday, October 26, 2004 1:18 PM
> To: xmlbeans-dev@xml.apache.org
> Subject: possible bug in XmlObject.parse()
>
> When I call parse() on an XML document Foo.xml whose root element
> matches a loaded schema Foo.xsd's root element, but with a subelement
> that has a different namespace than the subelement defined in the
> schema, I'd expect parse() to return an XmlAnyType, but instead it
> returns the generated type for Foo.xsd. See the attached test case that
> demonstrates this behavior. Please let me know if this is indeed a bug,
> and if so, if there is any workaround. If you concur that it's a bug,
> I'll file a Jira issue.
>
> Thanks!
> Ian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: dev-help@xmlbeans.apache.org
>
>
>
> <winmail.dat>---------------------------------------------------------- 
> -----------
> To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: dev-help@xmlbeans.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic