cant achive creation of this xml tag with jdom

View: New views
8 Messages — Rating Filter:   Alert me  

cant achive creation of this xml tag with jdom

by eial@cs.bgu.ac.il :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


hello, I need to create this xml tag using jdom in java:
Code:

<stream:features>
  <bind xmlns="urn:ietf:params:xml:ns:xmpp­-bind" />
  <session xmlns="urn:ietf:params:xml:ns:xmpp­-session" />
</stream:features>


the closest I've been able to get is this:
Code:

<stream:features xmlns:stream="features">
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-­bind" />
  <session xmlns="urn:ietf:params:xml:ns:xmpp-­session" />
</stream:features>

I've cant seems to remove the added xmlns attribute in the main.
how can I remove it, thanks.
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

RE: cant achive creation of this xml tag with jdom

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hello, I need to create this xml tag using jdom in java:
Code:

<stream:features>
  <bind xmlns="urn:ietf:params:xml:ns:xmpp­-bind" />
  <session xmlns="urn:ietf:params:xml:ns:xmpp­-session" />
</stream:features>

That is not namespace-well-formed XML: the "stream" prefix is used, but is not bound to any namespace URI. Why would you want to create XML that violates the namespaces specification? - no application is going to be able to process it.
 
Michael Kay

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

Re: cant achive creation of this xml tag with jdom

by Rolf Lear-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

JDom is right.

You can't have an undeclared namespace declaration:

http://www.w3.org/TR/2006/REC-xml-names-20060816/#ns-qualnames

Qualified name stream:features must be associated with a namespace
declaration.

You must declare the namespace as specified in:

http://www.w3.org/TR/2006/REC-xml-names-20060816/#ns-decl

Rolf

eial@... wrote:

>
> hello, I need to create this xml tag using jdom in java:
> Code:
>
> <stream:features>
>   <bind xmlns="urn:ietf:params:xml:ns:xmpp­-bind" />
>   <session xmlns="urn:ietf:params:xml:ns:xmpp­-session" />
> </stream:features>
>
>
> the closest I've been able to get is this:
> Code:
>
> <stream:features xmlns:stream="features">
>   <bind xmlns="urn:ietf:params:xml:ns:xmpp-­bind" />
>   <session xmlns="urn:ietf:params:xml:ns:xmpp-­session" />
> </stream:features>
>
> I've cant seems to remove the added xmlns attribute in the main.
> how can I remove it, thanks.
> ------------------------------------------------------------------------
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

Re: cant achive creation of this xml tag with jdom

by eial@cs.bgu.ac.il :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

it's not that I want, its that I need... I think that I'll have to go about it the other way

On Tue 25 Mar 1:26 2008 Rolf wrote:

> JDom is right.
>
> You can't have an undeclared namespace declaration:
>
> http://www.w3.org/TR/2006/REC-xml-names-20060816/#ns-qualnames
>
> Qualified name stream:features must be associated with a namespace
> declaration.
>
> You must declare the namespace as specified in:
>
> http://www.w3.org/TR/2006/REC-xml-names-20060816/#ns-decl
>
> Rolf
>
> eial@... wrote:
> >
> > hello, I need to create this xml tag using jdom in java:
> > Code:
> >
> > <stream:features>
> >   <bind xmlns="urn:ietf:params:xml:ns:xmpp­-bind" />
> >   <session xmlns="urn:ietf:params:xml:ns:xmpp­-session" />
> > </stream:features>
> >
> >
> > the closest I've been able to get is this:
> > Code:
> >
> > <stream:features xmlns:stream="features">
> >   <bind xmlns="urn:ietf:params:xml:ns:xmpp-­bind" />
> >   <session xmlns="urn:ietf:params:xml:ns:xmpp-­session" />
> > </stream:features>
> >
> > I've cant seems to remove the added xmlns attribute in the main.
> > how can I remove it, thanks.
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://www.jdom.org/mailman/options/jdom-interest/youraddr@...
>




_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

Re: cant achive creation of this xml tag with jdom

by eial@cs.bgu.ac.il :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ok, another question, how can I access childs or attributes of an element which has two namespaces?
On Tue 25 Mar 8:14 2008 eial@... wrote:

> it's not that I want, its that I need... I think that I'll have to go about it the other way
>
> On Tue 25 Mar 1:26 2008 Rolf wrote:
> > JDom is right.
> >
> > You can't have an undeclared namespace declaration:
> >
> > http://www.w3.org/TR/2006/REC-xml-names-20060816/#ns-qualnames
> >
> > Qualified name stream:features must be associated with a namespace
> > declaration.
> >
> > You must declare the namespace as specified in:
> >
> > http://www.w3.org/TR/2006/REC-xml-names-20060816/#ns-decl
> >
> > Rolf
> >
> > eial@... wrote:
> > >
> > > hello, I need to create this xml tag using jdom in java:
> > > Code:
> > >
> > > <stream:features>
> > >   <bind xmlns="urn:ietf:params:xml:ns:xmpp­-bind" />
> > >   <session xmlns="urn:ietf:params:xml:ns:xmpp­-session" />
> > > </stream:features>
> > >
> > >
> > > the closest I've been able to get is this:
> > > Code:
> > >
> > > <stream:features xmlns:stream="features">
> > >   <bind xmlns="urn:ietf:params:xml:ns:xmpp-­bind" />
> > >   <session xmlns="urn:ietf:params:xml:ns:xmpp-­session" />
> > > </stream:features>
> > >
> > > I've cant seems to remove the added xmlns attribute in the main.
> > > how can I remove it, thanks.
> > > ------------------------------------------------------------------------
> > >
> > > _______________________________________________
> > > To control your jdom-interest membership:
> > > http://www.jdom.org/mailman/options/jdom-interest/youraddr@...
> >
>
>
>
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@...
>




_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

RE: cant achive creation of this xml tag with jdom

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> it's not that I want, its that I need...

If you need to create something that isn't XML, then don't try to use XML
tools for the job.

Michael Kay
http://www.saxonica.com/

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

RE: cant achive creation of this xml tag with jdom

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>
> ok, another question, how can I access childs or attributes
> of an element which has two namespaces?

Same way as you select attributes or children of elements with no
namespaces, one namespace, or three namespaces.

Michael Kay
http://www.saxonica.com/

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

Re: cant achive creation of this xml tag with jdom

by Mattias Jiderhamn-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

eial@... wrote (2008-03-25 08:22):
> ok, another question, how can I access childs or attributes of an element which has two namespaces?
>  
An element can only "have" one namespace. Althought it can declare
multiple namespaces, but this has nothing to with identifying the
element or its children.

 /Mattias
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...
LightInTheBox - Buy quality products at wholesale price