xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cezar Andrei" <ce...@bea.com>
Subject RE: How to select the root element
Date Fri, 05 Oct 2007 16:21:00 GMT
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.Ferlito@b-source.ch
[mailto:Patrizio.Ferlito@b-source.ch]
> Sent: Thursday, October 04, 2007 10:31 AM
> To: user@xmlbeans.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 "info@b-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-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.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-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Mime
View raw message