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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:07:03+00:00 2026-06-05T07:07:03+00:00

I have made an XML generator with a few different options, one is a

  • 0

I have made an XML generator with a few different options, one is a style option which defines whether to use attributes or elements for primitive data types.

XML schemas aren’t supported right now, but I need to allow the setup of an XML Namespace, and I have been doing some research. My understanding is the XML namespace can have a prefix, but it doesn’t have to. It also needs a unique string attribute value that is usually a URI, but doesn’t have to be.

I am a little bit confused, as I am new to XML namespaces, and I have a few questions about this, if we take a look at an example xml document

<?xml version="1.0"?>
<root xmlns="some_identifier">
<oneKey>value</oneKey>
</root>

This is using an element style of the key value example, and I’m going to allow the configuration of “some_identifier”. In this example is the “oneKey” element under the XML namespace? Or do I have to specify a prefix like xmlns:ns and then prefix “oneKey” with “ns”?

Also if we take a look at attribute style:

<?xml version="1.0"?>
<root xmlns="some_identifier" oneKey="value" />

Do we need to define a similar prefix in oneKey in this example?

I apologize if I’m way off the mark in these questions, please let me know if I’m just not making sense,

UPDATE:

I have found this site: http://www.rpbourret.com/xml/NamespacesFAQ.htm#exec_1

That says these two are identical:

<foo:A xmlns:foo="http://www.foo.org/">
     <foo:B>abcd</foo:B>
</foo:A>

and

<A xmlns="http://www.foo.org/">
     <B>abcd</B>
</A>

which is very useful, but regarding the attribute style. Do I need to prefix attributes? Or will the xmlns default work for these as well?

  • 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-05T07:07:04+00:00Added an answer on June 5, 2026 at 7:07 am
    <root xmlns="some_identifier">
    

    this declares default namespace, root and all its children will belong to it, you don’t need prefixes.

    <root xmlns="some_identifier" oneKey="value" />
    

    Default namespaces do not apply to attributes. If you want oneKey to belong to a namespace, you have to create a prefix and use it on the attribute

    <root xmlns="some_identifier" xmlns:myns="some_identifier" myns:oneKey="value"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamically generated XML document made with PHP DOMDocument . I use
I have a bunch of XML files which I use to generate HTML pages.
I have made a XML parser that list correctly in the UITableViewController. It passes
I have an XDocument class with the XML contents already made. I basically want
I have made a game which is nearly identical to Popcap's Atomica. ( http://www.popcap.com/gamepopup.php?theGame=atomica
I have made a basic ascx control which is just a panel with a
I have gwt web project, which must use application.properties (on client side) loaded as
I have add a ViewFlipper in which has 2 linearlayout,and I have made an
I have made a popup, which works fine, but I'd like to write to
I have a datagrid buttoncolumn which acts as delete buttons for my xml nodes.

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.