[
Lists Home |
Date Index |
Thread Index
]
Sorry if this is an old idea. The more I have experimented with the idea
recently, the more compelling it seems.
What if repetitive fragments of xml had default non-flat format? Perhaps
a "standard" non-flat syntax would be always recognized and flattened in
a manner understood by all processors.
Essentially a block of flat records would be entered as <e/> leaf nodes
of nested <g/> outer elements. All attributes on the <g/> elements would
be repeated on the <e/> elements.
For example here is a fragment of flat records.
<record grpname="Current assets" grpsign="debit" grpsum="2065.00"
month="JUN" year="2004" type="actual" division="ABC" account="Cash"
sign="debit">500</record>
<record grpname="Current assets" grpsign="debit" grpsum="2065.00"
month="JUN" year="2004" type="actual" division="ABC" account="Marketable
securities" sign="debit">250</record>
<record grpname="Current assets" grpsign="debit" grpsum="2065.00"
month="JUN" year="2004" type="actual" division="ABC" account="Trade
receivables" sign="debit">750</record>
<record grpname="Current assets" grpsign="debit" grpsum="2065.00"
month="JUN" year="2004" type="actual" division="ABC" account="Other
receivables" sign="debit">175</record>
<record grpname="Current assets" grpsign="debit" grpsum="2065.00"
month="JUN" year="2004" type="actual" division="ABC" account="Inventory"
sign="debit">110</record>
<record grpname="Current assets" grpsign="debit" grpsum="2065.00"
month="JUN" year="2004" type="actual" division="ABC" account="Prepaid
expenses" sign="debit">340</record>
<record grpname="Current assets" grpsign="debit" grpsum="2065.00"
month="JUN" year="2004" type="actual" division="ABC" account="Reserve
for bad debts" sign="credit">60</record>
Below is a new fragment that could be understood as being those
equivalent <record>'s based on a reading of this <g><e/></g> block. Note
that attributes "ename" and "etext" are like reserved words and might
need namespace prefixes in practice.
<g ename="record" grpname="Current assets" grpsign="debit" month="JUN"
year="2004" type="actual" division="ABC">
<gx sign="debit">
<e account="Cash" etext="500.00"/>
<e account="Marketable securities" etext="250.00"/>
<e account="Trade receivables" etext="750.00"/>
<e account="Other receivables" etext="175.00"/>
<e account="Inventory" etext="110.00"/>
<e account="Prepaid expenses" etext="340.00"/>
</gx>
<gx sign="credit">
<e account="Reserve for bad debts" etext="60.00"></e>
</gx>
<gi grpsum="2065.00"/>
</g>
Note a couple of other innovations.
A <gi/> tag is an internal tag inside of <g/> so that global attributes
can be added after the <e/>'s. In this example that might occur because
the accounts are being added to a total which must also appear on each
final <record/> item.
The other innovation is using a <gx/> inside <g/> to subset the global
lookups. I would think that each level inward should be different like
<gx2/> for the next level in so that a processor always knows how far
away is the top <g/> ancestor.
Note that you could arrange the attributes in any way desirable. The
ename attribute could be on every <e/> instead of on <g/>. This would be
necessary if all elements were not <record/> but something like <Cash/>,
etc.
The <e/> tags would not have to be empty, they could contain markup
between <e>...</e>.
What else could we do with such a format?
- Add meta-data as comments or ignorable attributes. We might use the
<g><e/></g> just for that reason alone.
- Use it as a default format for loading to database tables or
spreadsheets when the <g/> format is more tabular than original true
format, i.e. the case where the above had unique names not all <record/>
elements but <Cash/>, etc.
- This might be useful in schema files that need to be very repetitive
and redundant. Some svg may be a candidate too.
- This may come in handy just for the sake of reducing xml file sizes
for messaging systems etc.
- This special syntax would allow haumans a better visual review to
avoid errors in repetitive attributes.
regards,
bill p
|