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 7183357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:57:48+00:00 2026-05-28T17:57:48+00:00

I got XML items.xml file with (almost) the same values as my items table

  • 0

I got XML items.xml file with (almost) the same values as my items table has, I mean fe. there is a field in the items table: level and for any id the level is set to 144, but in the XML file, the level= attribute is set to "1" (for the same id) – what is the best way to correct values like this?

It should go like this:

  • Check value level in the database table for any id.
  • If the level value from the database is other than the level="" attribute for this ID, set it to the same level value as in the
    database.

It can be kinda hard, since there is about ~40000 records to check.

I will appreciate some examples also!

  • 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-05-28T17:57:48+00:00Added an answer on May 28, 2026 at 5:57 pm

    Depending on what programming-language you are using, find the corresponding StAX-implementation. For Java I would go with XMLStreamReader (JavaDocs) and XMLStreamWriter (JavaDocs). You should find some tutorials on the internet.

    When you encounter the START_ELEMENT event while reading the XML, check the tag’s name (getLocalName()). If you are on the correct tag, check for the attributes, i.e. using the getAttribute...()-methods and handle the writing differently.

    Along all of this, use an XMLStreamWriter to write your new XML to some OutputStream. After all, just write the OutputStream to whereever you wish (File, etc.).

    Don’t forget to read your Input-XML using a BufferedInputStream (or some other buffered way).

    Good luck!

    P.S.: You can also use XMLEventReader or XMLEventWriter, but personally I prefer XMLStreamReader / XMLStreamWriter. Also, you could use different StAX-Implementations like Woodstox.

    P.P.S.: For PHP use XMLReader and XMLWriter. See here.

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

Sidebar

Related Questions

I've got an XML file that has the label @attributes for one of the
Let's say that I've got this xml: <items> <item name=thumb> <downloadStream>test1</downloadStream> <downloadStream>test2</downloadStream> <downloadStream>test3</downloadStream> </item>
I've got an XML file that contains a list of questions. I'd like to
I've got a XML Schema (xsd file) snippet bellow, in which I want the
I've basically got an XML file full of product information for use in an
Crux of my problem: I've got an XML file that returns 20 results. Within
I've got the following layout XML file: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/main_layout android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical> <GridView
I am parsing an XML file into a table and want to use the
The file format my application uses is Xml based. I just got a customer
I've got an xml file with the following: <content_item> <primary_keys> <primary_key> <source>firstone</source> <value>123</value> </primary_key>

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.