Tree customization in the firstobject XML editor

Many XML editors have a tree view to let you navigate the XML document by opening containing nodes and handling entire subtrees as a single unit. But when you have a list of elements like the attendees in the following example you can't tell them apart until you open them up (see the tree view on the left).

tree view without customization

It would be handy to display important information next to the ATTENDEE tag name. That's what tree customization is for. For example, by adding a simple line to the to the Tools -> Preferences Tree Customizations, you get the additional information displayed in the tree.

ATTENDEE @lastname

tree view with customization showing additional information

This example illustrates the connection between what you are seeing in the tree on the left with the text edit area on the right, but usually the information in the text edit area on the right is much deeper and "messier."

Attributes are prefixed with an @ sign, while child elements are not. So, you can display the values of immediate child elements next to the parent.

<Log>
  <Purchase id="786.AC">
    <Amount>29.99</Amount>
    <Name>J. Smith</Name>
  </Purchase>
  <Control>
    <Code>BCD</Code>
  </Control>
  <Purchase id="536.AB">
    <Amount>87.99</Amount>
    <Name>Ben Bryant</Name>
  </Purchase>
</Log>

Without customizing, the Purchase and Control nodes in the tree would be blank. To view the amount name and id next to the Purchase tag name in the tree, and the code next to the Control tag name, specify these Tree Customizations:

Purchase Amount Name @id
Control Code

Each line in your Tree Customizations specifies the customization for a particular element. Right now there is no way to separate customizations for different document types, so leave your customizations together:

ATTENDEE @lastname
Purchase Amount Name @id
Control Code
* @id @name @title

 

comment posted Tree customization wildcard?

w. jordan 19-Feb-2008

Is it possible to use "*" in the tree customization? For example, "* @id" will have the tree display the id attribute value for any element which has an id attribute. I guess that this can help a lot since there're so many documents having @id, @name, @title attributes.

Update December 29, 2008: with release 2.3.2 you can specify a wildcard item in your Tools -> Preferences Tree Customizations just like you described.

* @id @name @title

The id and/or name and/or title attribute value will be displayed for any element in the tree that has any of them.

 

comment posted Tree customization won't show name attribute

w. jordan 04-Dec-2008

A "Proc @name" customization should take the "name" attribute as the tree node text, but it did not.

It works better now in release 2.3.2. Tree customization was originally implemented to only honor customizations for elements with child elements or no text data, so it was showing the text data of the element instead of the information specified in the customization. But now I have changed it to display what the tree customization specifies for the element even if it is not a parent element and has text data.

 

comment posted Tree Customization, save options

John Black 28-Aug-2007

Tree Customization has got to be the best feature of this product (aside from the speed of loading large XML.) The XML we routinely deal with is mostly "normalized", with thousands of identical tag names whose identity is defined by their attributes or child node values.

For the Wish List: Allow us to save/load options. In a large team, this allows one of us to (for example) get the Tree Customizations just right, and send around the option file to everyone else. (True, we could find it in our App Data, but users shouldn't play with those folders too much.)

Great suggestion. The settings.xml also has machine specific information such as screen position coordinates and most recent file list, so you're right it would be clumsy copying that around or extracting the Tree Customzations. An export/import settings function would be ideal. In the meantime you can share the tree customizations by copying and pasting the text in the Preferences Tree Customizations editbox.

 

comment posted Tree customization lower level child element

Jim Chakour 08-May-2009

Is it possible to have a lower level child element (not direct child) displayed in the Tree? As an example, I have the following reoccurring nodes and would like the BusinessNameLine1 displayed on the SubsidiaryReturn tree.

<SubsidiaryReturn> 
  <ReturnHeader> 
    <SubsidiaryCorp> 
      <EIN>999999999</EIN> 
      <Name> 
        <BusinessNameLine1>Company Name</BusinessNameLine1> 
      </Name>

We've got over two hundred subsidiary returns in our consolidated Federal Tax Return XML eFile data which makes it very hard to traverse the list.

You can add the following line to your Tools Preferences Tree Customization:

SubsidiaryReturn ReturnHeader/SubsidiaryCorp/Name/BusinessNameLine1

Update May 11, 2009: In foxe 2.3.4 you can specify multiple lower level child elements and attributes of lower level child elements too:

<Customer>
  <Name first="John" last="Smith" mi="C">John C. Smith</Name>
  <Address>
    <Street1>100 Industrial Ct.</Street1>
    <City>Businesstown</City>
    <Zip>23000</Zip>
    <State>VA</State>
  </Address>
</Customer>
Customer Address/State Name/@last Name/@first

Shows: Customer VA Smith John