Hello,
I think there is problem with element names. You probably insert
element with name "NET:link" in namespace with prefix "NET". You
should instead use only "link" name. The same with attribute
"link:href" instead of "href". Be careful of different methods for
creating elements or QNames - some of them use only local part of
element name and namespace with prefix is passed on as the second
parameter, another use full name of element (ns-prefix:local-name) and
only namespace URI is passed on as the second parameter. Could you
post part of the code where you create new elements?

Best regards,

Filip Jirsák



2010/8/9  <fr...@gmx.net>:
> Hello,
>
> @Filip:,
> thanks a lot, it works now.
>
> But now I've got the next problem. I try to merge two GML-Files with an XSL 
> Stylesheet in JAVA. It worked quite well until I insert the new Elements.
>
> Now I've got the problem that I got an non-valid XML because of this line:
> <NET:NET:link xmlns:NET="" xmlns:xlink="" xlink:xlink:href="..."/>
>
> It should look like that:
> <NET:link xlink:href="..."/>
>
> This only happens with the new insert elements.
>
> I suppose this might be a namespace problem, so I tried to remove the 
> namespace out of the XSL Stylesheet or insert it in the new Element by "add 
> Namespace". But it doesn't work.
>
> I'm a little bit surprised about the fact, that the same transformation 
> worked on a manually task with Altova XML Spy which I tried. But in JAVA it 
> failed.
>
> Does anyone know about this problem and know how to solve it?
> Maybe it would work just to ignore the namespaces - but I don't know if and 
> how this is possible with DOM4J
>
> Thanks and Best regards,
> André
>
>
> -------- Original-Nachricht --------
>> Datum: Wed, 4 Aug 2010 13:39:34 +0200
>> Von: "Filip Jirsák" <fi...@jirsak.org>
>> An: fr...@gmx.net
>> CC: "dom4j-user@lists.sourceforge.net" <dom4j-user@lists.sourceforge.net>
>> Betreff: Re: [dom4j-user] sibiling node
>
>> Hello,
>> I think you can do this. Try this:
>>
>> Element featureElement = document.getRootelement();
>> Element newElement = DocumentHelper.createElement("new-element");
>> featureElement.content().add(4, newElement);
>>
>> Best regards
>>
>> Filip Jirsák
>>
>>
>>
>> 2010/8/4  <fr...@gmx.net>:
>> > Hello,
>> >
>> > is there any possibility to insert an sibiling node in DOM4J?
>> >
>> > I've got an XML like that:
>> >
>> > <feature>
>> >  <Element Level 1>
>> >  <Element Level 2/>
>> >  </Element Level 1>
>> >  <Element Level 1/>
>> >  <here I like to insert my new Element>
>> >  <Element Level 1/>
>> > [...]
>> > </feature>
>> >
>> > So I need a possibility to insert an Element on this exact position but
>> I can't find a solution.
>> >
>> > I can attach an Element at the beginning and the end of the
>> <feature>-Container and also as child-Element to an spezific Element in the 
>> XML. But I
>> can't find a way to insert it between two sibilings.
>> >
>> > Does anyone know a solution and might even give some code which could be
>> helpful?
>> >
>> > Thanks and best regards,
>> > André
>> > --
>> > GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.
>> > Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
>> >
>> >
>> ------------------------------------------------------------------------------
>> > The Palm PDK Hot Apps Program offers developers who use the
>> > Plug-In Development Kit to bring their C/C++ apps to Palm for a share
>> > of $1 Million in cash or HP Products. Visit us here for more details:
>> > http://p.sf.net/sfu/dev2dev-palm
>> > _______________________________________________
>> > dom4j-user mailing list
>> > dom4j-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/dom4j-user
>> >
>>
>> ------------------------------------------------------------------------------
>> The Palm PDK Hot Apps Program offers developers who use the
>> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
>> of $1 Million in cash or HP Products. Visit us here for more details:
>> http://p.sf.net/sfu/dev2dev-palm
>> _______________________________________________
>> dom4j-user mailing list
>> dom4j-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>
>
> --
> Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
> Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
>

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to