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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:06:50+00:00 2026-05-27T03:06:50+00:00

I have an xml file which looks like this <?xml version=1.0 encoding=UTF-8 ?> <BulkDataExchangeRequests

  • 0

I have an xml file which looks like this

     <?xml version="1.0" encoding="UTF-8" ?> 
 <BulkDataExchangeRequests xmlns="urn:ebay:apis:eBLBaseComponents">
 <Header>
  <Version>583</Version> 
  <SiteID>0</SiteID> 
  </Header>
 <AddFixedPriceItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <ErrorLanguage>en_US</ErrorLanguage> 
  <WarningLevel>High</WarningLevel> 
  <Version>583</Version> 
 <Item>
  <CategoryMappingAllowed>true</CategoryMappingAllowed> 
  <ConditionID>1000</ConditionID> 
  <Country>US</Country> 
  <Currency>USD</Currency> 
  <Description>Minimal fixed-price shoe listing with SKU, free shipping, 3-day dispatch time, return policy, and no Item Specifics. New Nike Shox Elite TB White/White-Black-Chrome. Size: Mens US 12, UK 11, Europe 46 (Medium, D, M). Condition: New in box.</Description> 
  <DispatchTimeMax>3</DispatchTimeMax> 
  <InventoryTrackingMethod>SKU</InventoryTrackingMethod> 
  <ListingDuration>Days_30</ListingDuration> 
  <ListingType>FixedPriceItem</ListingType> 
  <Location>San Jose, CA</Location> 
  <PaymentMethods>PayPal</PaymentMethods> 
  <PayPalEmailAddress>MegaOnlineMerchant@gmail.com</PayPalEmailAddress> 
 <PrimaryCategory>
  <CategoryID>63850</CategoryID> 
  </PrimaryCategory>
  <Quantity>6</Quantity> 
 <ReturnPolicy>
  <ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption> 
  <RefundOption>MoneyBack</RefundOption> 
  <ReturnsWithinOption>Days_30</ReturnsWithinOption> 
  <Description>Text description of return policy details here.</Description> 
  <ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption> 
  </ReturnPolicy>
 <ShippingDetails>
  <ShippingType>Flat</ShippingType> 
 <ShippingServiceOptions>
  <ShippingServicePriority>1</ShippingServicePriority> 
  <ShippingService>USPSPriority</ShippingService> 
  <ShippingServiceCost currencyID="USD">0.0</ShippingServiceCost> 
  <ShippingServiceAdditionalCost>0.00</ShippingServiceAdditionalCost> 
  <FreeShipping>true</FreeShipping> 
  </ShippingServiceOptions>
  </ShippingDetails>
  <Site>US</Site> 
  <SKU>1122334455-36</SKU> 
  <StartPrice>50.00</StartPrice> 
  <Title>Latest Nike Shox Elite TB White Mens Basketball Shoes S 12</Title> 
  <UUID>7d004a30b0f511ddad8b0807654c9a55</UUID> 
  </Item>
  </AddFixedPriceItemRequest>

when i modify this xml from java to put a new UUID the AddFixedPriceItemRequest element loses its xmlns=”urn:ebay:apis:eBLBaseComponents” attribute.
I am using the following code.

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.parse(new File(path + System.getProperty("file.separator") + "sc_input" + System.getProperty("file.separator") + "input.xml"));

NodeList list = doc.getElementsByTagName("UUID");
            for (int i = 0; i < list.getLength(); i++) {
                // Get element
                Element element = (Element) list.item(i);
                System.out.println(element.getTextContent());

                element.setTextContent(java.util.UUID.randomUUID().toString().replace("-", ""));
            }
            //setting up a transformer
            TransformerFactory transfac = TransformerFactory.newInstance();
            Transformer trans = transfac.newTransformer();

            //generating string from xml tree
            StringWriter sw = new StringWriter();
            StreamResult result = new StreamResult(sw);
            DOMSource source = new DOMSource(doc);
            trans.transform(source, result);
            String xmlString = sw.toString();

            //Saving the XML content to File
            OutputStream f0;
            byte buf[] = xmlString.getBytes();
            f0 = new FileOutputStream(path + System.getProperty("file.separator") + "sc_input" + System.getProperty("file.separator") + "input.xml");
            for (int i = 0; i < buf.length; i++) {
                f0.write(buf[i]);
            }
            f0.close();
            buf = null;

I tried to rectify this by setting the namespace for that particular element by using the following

 NodeList nodeList = doc.getElementsByTagName("AddFixedPriceItemRequest");
                for(int j = 0; j < nodeList.getLength(); j++){
                    Element element = (Element) nodeList.item(j);
                    if(!element.hasAttributes()){
                    element.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns","urn:ebay:apis:eBLBaseComponents");
                    }
                    System.out.println(element.getNodeValue());
   }

but this doesnt seem to work.

  • 1 1 Answer
  • 3 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-27T03:06:50+00:00Added an answer on May 27, 2026 at 3:06 am

    yes, that is perfectly valid output. since the AddFixedPriceItemRequest element is nested under the BulkDataExchangeRequests element, the xmlns declaration on the AddFixedPriceItemRequest element is superfluous.

    UPDATE:
    if for some reason you need the redundant xmlns, you could try using a different namespace prefix for the BulkDataExchangeRequests element.

    • 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 which looks like this : <?xml version=1.0 encoding=UTF-8?> <resultset
Say I have an XML file which looks like this: <?xml version=1.0 encoding=UTF-8?> <Project
I have sitemap which looks like this: <?xml version=1.0 encoding=utf-8 ?> <siteMap xmlns=http://schemas.microsoft.com/AspNet/SiteMap-File-1.0 >
I'm trying to read in an xml file which looks like this <?xml version=1.0
So say I have this XML file: <?xml version=1.0 encoding=utf-8 standalone=yes?> <Root> <Category Name=Tasties>
I have an XML document in this format: <?xml version=1.0 encoding=utf-8 ?> <SupportedServices> <Service>
I have an XML file which has many section like the one below: <Operations>
I have an XML file which I'd like to parse into a non-XML (text)
I'm still playing around with xml. Now I have a file that looks like
I have created my own XML-file on my Android phone, which looks similar to

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.