Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8455733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:21:35+00:00 2026-06-10T12:21:35+00:00

I need to parse an XML file stored in the blobstore. How do I

  • 0

I need to parse an XML file stored in the blobstore. How do I do that?

This is what I have done till now:

FileService fileService = FileServiceFactory.getFileService();
AppEngineFile file = fileService.getBlobFile(new BlobKey(key));

I cannot parse the XML file using javax.xml package or can I? The classes in that package if put into action requires a reference of a java.io.File object. But I do not have that.

This is what I have been doing till now : (not on the server but locally)

         File blobKeys = new File("/home/non-admin/NetBeansProjects/Personal Site_Testers/web/xml/xml_1.xml");
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(blobKeys);
        Element root = doc.getDocumentElement();

        Element firstName = doc.createElement("first-name");
        firstName.setTextContent(name);

        root.appendChild(firstName);

        TransformerFactory tf = TransformerFactory.newInstance();
        Transformer transformer = tf.newTransformer();
        DOMSource source = new DOMSource(doc);
        StreamResult result = new StreamResult(new File("/home/non-admin/NetBeansProjects/Personal Site_Testers/web/xml/xml_1.xml"));
        transformer.transform(source, result);

Note : There are 3 xml files uploaded to the blobstore. Those xml files just have a root tag . I want to get the xml reference and parse them to append child node several times depending upon the request made.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:21:37+00:00Added an answer on June 10, 2026 at 12:21 pm

    If you want to parse *.xml, I think jdom2 may be is more convenient which I use in the app engine and it works.

    However, you can read the FileService API document and there is an example with how to read and write the file. If you can get a InputStream or Reader, then you can use javax.xml to parse the xml content in the InputStream or Reader.

        FileService fileService = FileServiceFactory.getFileService();
        AppEngineFile readableFile = new AppEngineFile("your_file_name");
        FileReadChannel readChannel = fileService.openReadChannel(readableFile,
                false);
        InputStream input = Channels.newInputStream(readChannel);
    
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(input);
    
        Element root = doc.getDocumentElement();
    
        Element firstName = doc.createElement("first-name");
        firstName.setTextContent("content");
    
        root.appendChild(firstName);
        // Now write
        GSFileOptionsBuilder optionsBuilder = new GSFileOptionsBuilder()
                .setBucket("mybucket").setKey("myfile")
                .setMimeType("text/html").setAcl("public_read")
                .addUserMetadata("myfield1", "my field value"); // change as
                                                                // your need
        AppEngineFile writableFile = fileService.createNewGSFile(optionsBuilder
                .build());
        FileWriteChannel writeChannel = fileService.openWriteChannel(
                writableFile, false);
        OutputStream output = Channels.newOutputStream(writeChannel);
    
        TransformerFactory tf = TransformerFactory.newInstance();
        Transformer transformer = tf.newTransformer();
        DOMSource source = new DOMSource(doc);
        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        StreamResult result = new StreamResult(output);
        transformer.transform(source, result);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file that I am trying to parse with Sax (this
I have an XML file which I need to parse using PHP and send
I have a xml document stored in a file on the server, now i
i need to parse this php xml response in android: <?phpxml version=1.0 encoding=utf-8?> <SmsResponse>
I need to parse a bunch of incoming xml documents, they all have the
I need to parse a XML file which I get from third party to
I am parsing through a XML file that's about 12mb big. I need to
I need to parse an xml File in C#...The File will look some thing
I have a process that parses an XML file using JDOM and xpath to
I have a 60mb XML file that has a list of products, approx 8k

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.