jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: Problem with importing using Document View - why is xmlns needed again? and how do I import non well-formed xml?
Date Mon, 13 Nov 2006 13:42:09 GMT
On 11/11/06, Sridhar Raman <sridhar.raman@gmail.com> wrote:
> This is the namespace declarations I am talking about.
>
> (sample Document View)
> <aa:ents jcr:primaryType="aa:Ents" xmlns:jcr="http://www.jcp.org/jcr/1.0"
> xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="
> http://www.jcp.org/jcr/mix/1.0" xmlns:aa="http://aaa.com/test">
> <aa:ent jcr:primaryType="aa:EntityType" aa:title="AA_Magnolia">
> ...
> ...
> </aa:ent>
> ..
> ..
> </aa:ents>
>
> If I try to import this above XML without any any of the xmlns definitions
> under aa:ents, I get an exception saying "prefix aa mapping not found". But
> the thing is that the mappings are all present. If I try to add a mapping
> for aa programmatically, it gives an error saying "mapping already present".
>
> It's just that when the import happens, the mappings are "not seen" by the
> method, and I need to specify them explicitly again here...which I don't
> want to do.

the xml to be imported has to be 'valid', i.e. every namespace used within
the document needs to be declared in the document. i.e.

  <?xml version="1.0"?>
  <a:foo b:bar="blah"/>

is not a valid xml document.

for more details on xml namesapces please refer e.g. to
http://www.w3.org/TR/REC-xml-names/.

cheers
stefan

>
> That's the problem I am facing. Any suggestions?
>
> Thanks,
> Sridhar
>
> On 11/10/06, Stefan Guggisberg <stefan.guggisberg@gmail.com> wrote:
> >
> > On 11/9/06, Sridhar Raman <sridhar.raman@gmail.com> wrote:
> > > I made my Document View, and did the importing, and assigned the
> > references
> > > programmatically. That works fine.
> > >
> > > But I have another small problem - concerning namespaces.
> > >
> > > This is the structure of the nodes:
> > > CON
> > > |---ENTS
> > >      |---DIM
> > >
> > > There can be many DIM nodes, and all should be under the main node of
> > > /CON/ENTS. So I create an XML document in Document View format, that
> > will be
> > > imported.
> > >
> > > The first time, I created a file in this style:
> > > <ents ...>
> > >   <dim/>
> > >   <dim/>
> > >   <dim/>
> > >   <dim/>
> > > </ents>
> > >
> > > And I did the importXML("/con", ...) using this method call. It worked
> > fine,
> > > with just a small hitch. I had to define all the namespaces again as
> > part of
> > > the <ent> element. Else, the import kept throwing unrecognised prefix
> > > exceptions. I did that and it worked.
> >
> > i don't see any namespaces being used in your example. what namespaces
> > are you talking of. can you provide a small sample xml file?
> >
> > >
> > > Now I want to do a second set of import to this same workspace. And I
> > > created the Document View in the same style as earlier. The import gives
> > me
> > > something like this.
> > >
> > > /con/ent/dim/...
> > > /con/ent/dim1/...
> > > /con/ent/dim2/...
> > > /con/ent/dim3/...
> > > /con/ent/dim4/...
> > > ..[DATA from first import]
> > > ..
> > > /con/ent2/dim/...
> > > /con/ent2/dim1/...
> > > /con/ent2/dim2/...
> > > /con/ent2/dim3/...
> > > ..[DATA from second import]
> > > ..
> > >
> > > What should be done to get the new list of <dim> nodes to go under the
> > > earlier <ent>?
> >
> > i don't think that this can be done by using the jcr importXML methods.
> > you'll either have to do it programmatically or write a custom SAX
> > ContentHandler.
> >
> > > I tried this kind of Document View
> > > <dim>
> > > <dim1>
> > > <dim2>
> > > ...
> > > and importing using the call importXML("/con/ent/", ..)
> > >
> > > This gives 2 problems:
> > > 1) it's not well formed
> > > 2) namespaces not found
> >
> > again, what namespaces are you talking of?
> >
> > cheers
> > stefan
> >
> > >
> > > What do I do?? Is there any solution to this?
> > > I would be glad if you could help me with this.
> > >
> > > Thanks in advance,
> > > Sridhar
> > >
> > >
> >
>
>

Mime
View raw message