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

  • Home
  • SEARCH
  • 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 8922599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:52:57+00:00 2026-06-15T06:52:57+00:00

Attached are two screen shots, and my code. I am trying to get the

  • 0

Attached are two screen shots, and my code. I am trying to get the animation_sequence as a closing and ending bracket, I’ve tried my best but now I seek your help. Please help. The code I have produces it as a

Code:

 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document testDoc = builder.parse(new File("./data/sprite_types/" + spriteName + "/" + spriteName + ".xml"));
        Element state = testDoc.createElement("state");
        state.setTextContent(element);
        Element animationState = testDoc.createElement("animation_state");
        Element sequence = testDoc.createElement("animation_sequence");
        testDoc.getElementsByTagName("animations_list").item(0).appendChild(animationState).appendChild(state);
        testDoc.getElementsByTagName("animation_state").item(testDoc.getElementsByTagName("state").getLength() - 1).appendChild(sequence);
        DOMSource source = new DOMSource(testDoc);
        PrintStream ps = new PrintStream("./data/sprite_types/" + spriteName + "/" + spriteName + ".xml");
        StreamResult result = new StreamResult(ps);
        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        Transformer transformer = transformerFactory.newTransformer();
        transformer.transform(source, result);

not good
good

  • 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-15T06:52:59+00:00Added an answer on June 15, 2026 at 6:52 am

    The reason is that you’re creating the animation_sequence element but not creating any child node under it. Effectively, you are creating an empty element. Empty elements, when serialized to string, will always appear as <tag/>, rather than <tag></tag>.

    To avoid this, you need to add an empty Text node as a child node of the animation_sequence element:

    sequence.appendChild(testDoc.createTextNode(""));
    

    (Or, if you use Commons Lang, replace "" with StringUtils.EMPTY)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attached are two screen shots, and my code. I am trying to get the
I have an interface that has two toolbars, one attached to the frame and
I have an EC2 small instance, which has two EBS volumes attached and has
In the attached screen shot you can she that to rename a selected tab
Firebug shows some requests in Gray(screenshot attached and marked in Red) with status code
I have layout with two forms. I'm using scroller but scrollbars don't align to
I got a strange problem. You can see the two attached screenshots. The problem
I was looking of border between two ListViews as shown in the attached screenshot(in
The AutomationProperties.AutomationId attached property seems to have two purposes: Identifying UI controls during automated
I've got two models: Message and Attachment. Each attachment is attached to a specific

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.