List Info

Thread: How to select the root element




How to select the root element
country flaguser name
Switzerland
2007-10-04 10:30:40
Hi all,

I need to select the root element from a xml document but
without
knowing its structure.

XmlObject[] elems = document.selectPath("...");

I would like to know how to execute a statement like
"document.getRootElement()."

How can I do that ?

Regards
ferp

IMPORTANT:
This e-mail transmission is intended for the named
addressee(s)only.
Its contents are private, confidential and protected
from disclosure and should not be read, copied or
disclosed by any other person.
If you are not the intended recipient, we kindly ask
you to notify the sender immediately by telephone
(+41 (0)58 806 50 00), to redirect the message to the
account "infob-source.ch" and to delete this
e-mail.
E-mail transmissions may be intercepted, altered or
read by unauthorized persons and may contain viruses.
Therefore, it is recommended that you use regular mail
or courier services for any information intended to be
confidential. However, by sending us messages through
e-mail, you authorize and instruct us to correspond by
e-mail in the relevant matter.
Thank you.


------------------------------------------------------------
---------
To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
For additional commands, e-mail: user-helpxmlbeans.apache.org


RE: How to select the root element
user name
2007-10-05 11:21:00
Patrizio,

There are a number of ways to find out the name of the
document root or
return the object that represents its content, but the first
that comes
to mind is using the cursor:

XmlCursor xc = document.newCursor();
xc.toFirstChild();
QName nameOfTopLevelElement = xc.getName();
XmlObject contentOfTopLevelElement = xc.getObject();

Cezar

> -----Original Message-----
> From: Patrizio.Ferlitob-source.ch
[mailto:Patrizio.Ferlitob-source.ch]
> Sent: Thursday, October 04, 2007 10:31 AM
> To: userxmlbeans.apache.org
> Subject: How to select the root element
> 
> Hi all,
> 
> I need to select the root element from a xml document
but without
> knowing its structure.
> 
> XmlObject[] elems =
document.selectPath("...");
> 
> I would like to know how to execute a statement like
> "document.getRootElement()."
> 
> How can I do that ?
> 
> Regards
> ferp
> 
> IMPORTANT:
> This e-mail transmission is intended for the named
> addressee(s)only.
> Its contents are private, confidential and protected
> from disclosure and should not be read, copied or
> disclosed by any other person.
> If you are not the intended recipient, we kindly ask
> you to notify the sender immediately by telephone
> (+41 (0)58 806 50 00), to redirect the message to the
> account "infob-source.ch" and to delete this
e-mail.
> E-mail transmissions may be intercepted, altered or
> read by unauthorized persons and may contain viruses.
> Therefore, it is recommended that you use regular mail
> or courier services for any information intended to be
> confidential. However, by sending us messages through
> e-mail, you authorize and instruct us to correspond by
> e-mail in the relevant matter.
> Thank you.
> 
> 
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
> For additional commands, e-mail: user-helpxmlbeans.apache.org


Notice:  This email message, together with any attachments,
may contain information  of  BEA Systems,  Inc.,  its
subsidiaries  and  affiliated entities,  that may be
confidential,  proprietary,  copyrighted  and/or legally
privileged, and is intended solely for the use of the
individual or entity named in this message. If you are not
the intended recipient, and have received this message in
error, please immediately return this by email and then
delete it.

------------------------------------------------------------
---------
To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
For additional commands, e-mail: user-helpxmlbeans.apache.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )