Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2006

Tip: Looking for answers? Try searching our database.

Parsing Xml document in java

Thread view: 
carlito@whitmore.fsnet.co.uk - 17 Mar 2006 00:04 GMT
Hi people can you help me?

Well heres my problem. I am trying to parse an xml document via a uri.
i have the following code to parse the URI and get the document.

String uri = "http://someServer.com/Server/Database"

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(uri);

The server just contains an XML document containing information on the
server.

However when i parse the document i dont think it parses correctly. Is
there a way to View the contents of the document object i have created
or is there a better way to parse the uri and get back a document?

Many thanks in advance

Andrew
opalpa@gmail.com opalinski from opalpaweb - 17 Mar 2006 00:56 GMT
To print the entire document to standard output:

DOMSource source = new DOMSource(document);
StreamResult stdout = new StreamResult(System.out);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.transform(source, stdout);

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
carlito@whitmore.fsnet.co.uk - 18 Mar 2006 16:08 GMT
Thankyou very much it worked


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.