Tech Off Thread

8 posts

Xml Question

Back to Forum: Tech Off
  • User profile image
    brownsoft

    Hello,
        I am in the process of designing an app.  I am thinking of using an xml file to dynamically load all the label in the form instead of hardcoding them into the form. 
        Q: I need both the names of the node and its children.  Is there a easy way of traversing a Xml Document and fetching the names of both the nodes and its elements.
        Q:Or the above is real out of the way thing to do and just hardcode the labels??


  • User profile image
    W3bbo

    Sounds like you're wanting a string table solution.

    Why XML files? What's wrong with Resource files?

  • User profile image
    PaoloM

    XML is cooler Smiley

    But, in the form Load event, open the XML file with an Xml Reader, start parsing out the values (I usually use XmlDocument for that, but you can also use a stream reader) and programatically set the .Text attribute of the labels.

  • User profile image
    PaoloM

    What is the schema of your XML file?

  • User profile image
    W3bbo

    PaoloM wrote:
    XML is cooler Smiley


    Only by name. Processing XML files incurrs an overhead.

  • User profile image
    PaoloM

    Processing any file incurs in an overhead. The issue is to define the acceptable tradeoff between performance hit and easy of maintenance/compatibility.

    People use XML because it's very very simple to parse Xml documents in every system using standardized techniques. Yes, it's a bit slower, but then raw binary sector read from the disc is faster than anything else Smiley

  • User profile image
    brownsoft

    Be honest with you, I am just learning XML and I thought this could be a test.  Basically I typed my Xml File into VS 2003 and then right click and told VS to create me a schema file for my xml file.

  • User profile image
    Nate​Furtwangler

    PaoloM wrote:
    Processing any file incurs in an overhead. The issue is to define the acceptable tradeoff between performance hit and easy of maintenance/compatibility.

    People use XML because it's very very simple to parse Xml documents in every system using standardized techniques. Yes, it's a bit slower, but then raw binary sector read from the disc is faster than anything else


    Agreed, it all comes down to interoperability, if there's a chance that another program or machine will be using the same data as your application (or data used by your application) then XML is a good choice because chances are whatever technology that the other program uses will also have XML support making it easier to integrate your data.  If you create proprietary file formats it may be easier to process but it becomes much more difficult to share data,  especially when you consider the existing technology and standards (XSLT for example).

    However, XML isn't the solution to everything and unless your going to be injesting data and/or sharing data a proprietary format could very well be the best solution.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.