XML Namespaces: Which is preferable? Confused Beginner....?

I'm currently writing a parser for a custom XML file of my own design (a requirement mgmt tool to be specific), but am struggling with how to deal w/namespaces. Every requirement has a set of native attributes (int, float, enum, etc), but I'm worried I'm overcomplicating things. Here is what I want to do:

<int:attr id=”100” name=”Int Attr 1”>





<float:attr id=”101” name=”Float Attr 1”/>

<float:default value=”1.0”/>

<float:precision value=”5”>




...and so on. The nice thing is, everything has the same name (just different namespace)... Alternatively, I could just name everything "floatattr", "intattr", and avoid namespaces all together.

To any one knowledgable or experienced w/XML - Which would you choose?

1 Answer

  • GK
    Lv 6
    1 decade ago
    Favorite Answer

    I think you are using namespaces wrong here and you could just get buy without them. Usually for a project, you can just read in the file and not worry about namespaces unless you are doing something where a xml file is going to have a bunch of different namespaces.

    I wouldn't use them for this or this way.

    • Login to reply the answers
Still have questions? Get your answers by asking now.