Menu

#54 Empty element/attribute enhancements

open
5
2007-03-05
2007-03-04
PieBandit
No

I propose the following built in transforms:
Removal of all empty attributes
Removal of all empty elements/sub elements
Both of the above
Addition of all attributes (via DTD)
Addition of all Elements (via DTD)
Both of the above

Example
<?xml version="1.0" encoding="UTF-8"?>
<Test AttrA="data" AttrB="" AttrC="" >
<Empty AttrD="" />
</Test>

Removing empty attributes & elements would leave us with:
<?xml version="1.0" encoding="UTF-8"?>
<Test AttrA="data">
</Test>

Discussion

  • gnschmidt

    gnschmidt - 2007-03-05

    Logged In: YES
    user_id=1298822
    Originator: NO

    All of these make perfect sense. I need to find some time for them - I'm keen to press on with XSD validation-as-you-type and the command interface – but I agree with all of your suggestions.

    Thanks for taking the time to log these suggestions! It's very much appreciated.

    Best,
    Gerald

     
  • gnschmidt

    gnschmidt - 2007-03-05
    • assigned_to: nobody --> gnschmidt
     
  • Roger Sperberg

    Roger Sperberg - 2007-04-05

    Logged In: YES
    user_id=611718
    Originator: NO

    When I first saw this suggestion, I didn't see its value.

    But I've started using a template for new documents and with several of the elements that the document starts out with, the attributes are optional and won't necessarily be filled in.

    I debated omitting those, but figured it was easier to plug in the values when I needed them and then delete the unused attributes when I didn't then to always enter those optional attributes manually (of course, in this case the "optional" attributes are appearing a little more than half the time so that tilted my decision).

    A command that removed all empty attributes (and/or elements with no content or attributes with values) would prove handy for me too. I could see making the templates more elaborate in this case, knowing a single command would remove the unwanted detritus once the information had been entered.

    Roger Sperberg
    "Offering unsolicited opinions as my contribution to open-source software since 2001"

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.