This is quite a mess. I'm assuming you have to accept the input as is.

Basically you've got 4 different XML vocabularies active in each xml
instance doc:
      * The 1st one, which isn't in any namespace at all, containing
        only the {iq} element as well as ALL the attributes in ALL the
        elements (yes, ALL)
      * a 2nd containing only the {command} element
      * a 3rd containing the {iodata, out} elements
      * a 4th containing the {profiles, profile, actions, action}
        elements.

Note that, according to the XML namespace spec, unqualified attributes
are in NO namespace (not even the default) whereas unqualified elements
are in the default namespace (assuming a default ns has been declared).

[ sidenote: I doubt this effect was intended by design here. If it won't
get you into trouble, do smack the author ever so gently at the back of
the head. :-) ]

Given that an .xsd can define a schema for only a single namespace I
think you're going to have to create a separate .xsd for each of the
above namespaces and set the targetNamespace to the appropriate xmlns.
I'm not absolutely sure but I think for the "no namespace" stuff (i.e.
<iq> and all the attributes) you should create an .xsd without a
targetNamespace attr -- don't make it empty, leave it out entirely.

Alternatively, you might be able to get away with creating a single "no
namespace" .xsd and turning off namespace processing when parsing the
xml docs. However, I'm not sure XmlBeans or Jaxb can function this way.


On Tue, 2010-11-09 at 01:31 -0800, olamalam wrote:
> Hello Tim, Thanks for your reply.
> 
> I'm developing an integration project and I created that xsd file from the
> xml file that our client sends us. I tried several different tools but none
> of them creates a targetnamespace from the xml file that I attached. When I
> try to assign a namespace manually I'm getting invalid xsd errors. 
> 
> But yes, you are right, there must be stg wrong with the xsd since I'm
> having the same problem with Jaxb too. 
> 
> In the Jaxb forum, they advised me to remove xmlns="..." field from the tags
> of xml. This is maybe why my xsd doesnt have a targetnamespace. Removing
> xmlns fields from the each xml file received by my system programatically is
> not a very practical solution. Therefore I guess I need to assign a
> targetnamespace to my xsd. What should I put there?
> 
> Thanks again,
> ilker
> 
> 
> Tim Watts-3 wrote:
> > 
> > I could be wrong, but the odd thing I noticed was that the .xsd doesn't
> > have a targetNamespace attr. I don't think simply declaring a namespace
> > in the .xsd makes it part of the xml schema being defined. But maybe I'm
> > misunderstanding your intent. It looks like you're trying to define a
> > schema that spans multiple namespaces and I"m not sure that's supported
> > in XML Schema. I'd love to learn otherwise.
> > 
> > 
> > On Mon, 2010-11-08 at 08:27 -0800, olamalam wrote:
> >> Hi to all,
> >> 
> >> Actually, I'm not new to XmlBeans :) however I've faced with a problem
> >> for
> >> the first time and couldn't solve it.
> >> 
> >> I"m using xmlBeans 2.4.0 and the xml file I'm trying to parse and it's
> >> schema are attached. I created the .jar file by using "scomp" command
> >> properly but when I parse the file, the first tag is returned with
> >> correct
> >> values at "id", "to", "from" and "type" fields but "command" object
> >> returns
> >> null. I also tried parsing it with JaxB but I got the same problem there
> >> too. (I'm going to ask the same question to Jaxb forum)
> >> 
> >> Can you see what I'm missing?
> >> 
> >> http://old.nabble.com/file/p30162231/getProfile.xml getProfile.xml 
> >> http://old.nabble.com/file/p30162231/getProfile.xsd getProfile.xsd 
> > 
> > ________
> > It does not matter how slowly you go so long as you do not stop.
> > -- Confucius
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
> > For additional commands, e-mail: user-h...@xmlbeans.apache.org
> > 
> > 
> > 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: user-h...@xmlbeans.apache.org

Reply via email to