XML Tree depth greater than 50

BillBill ๐Ÿ’Ž
edited May 12, 2020 in Questions
I was creating response grids and received this message:

"System.XmlException: XML Tree depth greater than 50ย An unexpected error has occurred. Your solution provider has been notified. (skuid)

I cannot even open the page.

Comments

  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited March 2, 2017
    Bill, you'll need to go to the Pages list, find your page, and use the Versions row action to find the most recent auto-save version, and revert to it.

    The "XML Tree Depth" limit is a known issue that right now the best way to avoid is to reorganize your pages to avoid having extremely deep XML trees.ย 
  • BillBill ๐Ÿ’Ž
    edited May 12, 2020
    I am trying to open the last version but freezes. ย The name of the page is: "D_Detail_CR_Member_DNA" ย 
  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited December 21, 2016
    I'd keep going backwards trying previous versions until you find one that works.
  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited December 21, 2016
    Another alternative is to try to open the most recent version, but replace "PageBuilder" in your URL with "PageXMLEdit" and then you will get taken to the XML editor. There you can find the deepest point of your XML and attempt to remove pieces that way.
  • BillBill ๐Ÿ’Ž
    edited May 12, 2020
    I have tried to go to :
    https://dorothy--skuid.na16.visual.force.com/apex/PageXMLEdit?D_Detail_CR_Member_DNA

    But I get the "Loading" screen.
    I have given you access
  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited December 21, 2016
    That link will not work, you need to provide the ID of the page to edit, not the name (plus in the URL above you are not providing any URL parameters at all). You need to go to the Pages list, and click to edit your page. Then, find "PageBuilder" in the URL and replace it with "PageXMLEdit".
  • BillBill ๐Ÿ’Ž
    edited May 12, 2020
    Ok. I was able to get in but I have now idea how to change the xml or what to change or why this happened. ย Salesforce also does not know.

  • BillBill ๐Ÿ’Ž
    edited May 12, 2020
    I have given you access to my skuid account
    https://drive.google.com/file/d/0B409lhd9sYDcYXg0azdFMFpwTVE/view
  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited March 2, 2017
    Bill, we have fixed the page to make it usable again by commenting out the Grid contained in the Popup for your "Select Document" section. We added a Template component to the page where we did this, making a note that we did this. You can retrieve the contents of this Grid by going to line 1909 of the XML for this page as it stands right now.

    Please refresh this page before making any further edits, or revert to the named version "Working - edited by Skuid Support" if you need to go back and find the page at the state where we edited it:

    image

  • BillBill ๐Ÿ’Ž
    edited May 12, 2020
    I must not done it correctly as I can not get in. ย I tried to restore my 1:00 PM version, save it and it failed. ย So, can you do it again. ย  I have had the "Select document" ย window in page for months. ย I have spent the last 3 days changing the page over to a responsive page. ย So, I do not know what not to do going forward.
  • JD BellJD Bell โœญโœญ
    edited March 16, 2018
    Bill,

    I think it'd be helpful to define what is meant by "XML Tree depth". Skuid pages are stored as an XML document. XML is a hierarchically structured set of "nodes" that resembles a tree, where the top level node is the "trunk" (also called the "root") and its child nodes are branches.

    For example, here is a simple Skuid page with no models and a template contained within a wrapper. The "skuidpage" node is the trunk with two branches, "models" and "components".
    <skuidpage>     <models/>     <components>         <wrapper uniqueid="sk-ZayGn-60">             <components>                 <template multiple="false" uniqueid="sk-Zazqa-67">                     <contents>Hello World</contents>                 </template>             </components>         </wrapper>     </components> </skuidpage>
    The "depth" (a confusing term given we're talking about a "tree") is a simple measure of how many steps we've taken away from the trunk. So "skuidpage" is at a "depth" of 0, the "models" and "components" nodes are both at depth 1. The "wrapper" node is at depth 2, etc., down to the "template" node at depth 4 and its "contents" node at depth 5.
    • 0. skuidpage
    • 1. components
    • 2. wrapper
    • 3. components
    • 4. template
    • 5. contents
    As we increase the complexity of the page (by moving the wrapper into a panel set, for example), the depth of the template component increases:
    <skuidpage>     <models/>     <components>         <panelset type="standard" uniqueid="sk-Zcj6D-64" scroll="">             <panels>                 <panel>                     <components>                         <wrapper uniqueid="sk-ZayGn-60">                             <components>                                 <template multiple="false" uniqueid="sk-Zazqa-67">                                     <contents>Hello World</contents>                                 </template>                             </components>                         </wrapper>                     </components>                 </panel>             </panels>         </panelset>     </components> </skuidpage>
    • 0. skuidpage
    • 1. components
    • 2. panelset
    • 3. panels
    • 4. panel
    • 5. components
    • 6. wrapper
    • 7. components
    • 8. template
    • 9. contents
    Our template is now at a depth of 8 and its contents node is at a depth of 9.

    Now, your browser (IE, Chrome, etc) has a built-in Javascript XML parser which is what we use in the composer to build your page. As you drag and drop elements, we modify the XML document appropriately. Your browser's XML parser doesn't really care how deeply nested the nodes of your XML document are... it only cares about the "size" (number of characters), the limit for which is so large that you'll run into other problems before you ever hit it.

    But, as soon as you save and then reload the page (either in the composer or the page preview), we process that XML document using Salesforce's XML parser. This is where you are running into trouble. Salesforce appears to have an undocumented depth limit built into its XML parser. I don't know why they chose to do this (probably another safeguard against over-utilization of shared resources), but once your deepest node surpasses a depth of 50, the XML parser will refuse to process it and we can no longer load the page.

    If this happens, then the only solution is to either restore a previous, working version of the page or to open Skuid's XML page editor and remove the offending nodes. You can just copy and paste the following URL to access Skuid's XML page editor:
    https://YOUR_ORGS_DOMAIN (e.g. skuid.na11.visual.force.com)/apex/skuid__PageXMLEdit?id=THE_PAGE_ID (e.g. a02G000000UvFmrIAF)

    You need to be careful to remove everything between the beginning and ending tags (otherwise you end up with an imbalanced document. Kind of like how I just left off the ending parenthesis on the previous sentence. Here's an example of what your document will look like, with the text that needs to be deleted highlighted in red:

    image

    You could also try removing one of the container components, though this tends to be trickier and more error prone (so proceed with caution):

    image

    Hitting this limit is very rare, but we are investigating how we might prevent or resolve this issue automatically in the future. In the meantime, restoring prior versions or manually editing the XML are the only options.
  • JD BellJD Bell โœญโœญ
    edited March 16, 2018
    If you would like to petition Salesforce to remove or increase this arbitrary limit, please visit the IdeaExchange and vote for it:

    https://success.salesforce.com/ideaView?id=08730000000Drs2AAC
  • BillBill ๐Ÿ’Ž
    edited May 12, 2020
    I voted yes.
  • BillBill ๐Ÿ’Ž
    edited May 12, 2020
    JD. ย Thanks for the tutorial. ย It would be nice to have a warning but now I get it. ย I was able to rebuild the page. ย Thanks.
  • Jack SanfordJack Sanford San Antonio, TX ๐Ÿ’Ž๐Ÿ’Ž
    edited May 12, 2020
    Thanks for this post. Just hit the limit with a filter on reference field in a field editor in a tabset in a popup from a page title in grid in a tabset in a drawer in a table in a tabset. Vote added to SF Idea.ย 
  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited December 21, 2016
    That is some deep XML :)
  • Jack SanfordJack Sanford San Antonio, TX ๐Ÿ’Ž๐Ÿ’Ž
    edited May 25, 2016
    ...tabset is also in a panel set in another panel set in a wrapper. So, able to fix by removing some excessive nesting.ย 
  • Rob HatchRob Hatch ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited September 1, 2016
    That's the Skuid tongue-twister...
  • BillBill ๐Ÿ’Ž
    edited November 26, 2016
    Just hit it again. ย Frustrating
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!