Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7603725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:43:43+00:00 2026-05-30T23:43:43+00:00

While writing a custom import tool for a Tridion 2011 project using the core

  • 0

While writing a custom import tool for a Tridion 2011 project using the core service I have come across an issue when trying to save a component.

The following code works fine when the field on the component has a value but when it does not I get an error.

Here’s my code (error handling removed for brevity):

//component is a ComponentData object from Tridion
var doc = new XmlDocument();
doc.LoadXml(component.Content);

var namespaces = new XmlNamespaceManager(doc.NameTable);
namespaces.AddNamespace("ns", doc.DocumentElement.NamespaceURI);

//componentFromSpreadsheet has a dictionary of fields and values to update
foreach (var field in componentFromSpreadsheet.Fields)
{
    XmlNode xmlNode = doc.SelectSingleNode("//ns:" + field.Key, namespaces);

    if (xmlNode == null)
    {
        xmlNode = doc.CreateNode(XmlNodeType.Element, field.Key,
                                 doc.DocumentElement.NamespaceURI);
        doc.DocumentElement.AppendChild(xmlNode);
    }

    //Namespace any Html in the field       
    string fieldValue = HtmlTidy.Tidy(field.Value);
    xmlNode.InnerXml = fieldValue;
}


component.Content = doc.OuterXml;

//This line throws a FaultException<CoreServiceException> with an 
//XmlException from tridion
client.Save(component, null);

Here’s the message from Tridion:

The element ‘Content’ in namespace
‘uuid:09ed2feb-f7cb-4760-ba4c-b9ff4f45d025’ has invalid child element
‘summary’ in namespace ‘uuid:09ed2feb-f7cb-4760-ba4c-b9ff4f45d025’.
List of possible elements expected: ‘related_links’ in namespace
‘uuid:09ed2feb-f7cb-4760-ba4c-b9ff4f45d025’

I know summary is a valid field for the schema of this component.

It seems like the schema is strict and cares about the order of the fields within the Xml. Is there any way around this or another approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:43:44+00:00Added an answer on May 30, 2026 at 11:43 pm

    Unfortunately you will have to add all mandatory fields in the correct order. The schema does indeed define the elements as an ordered sequence. You could try iterating the fields of the schema, and then selecting them from the spreadsheet rather than the approach you are currently using.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've come across a problem while writing a custom Adapter for the items on
I am using wpf Custom Commands. While writing a custom Command, one need to
while writing a custom attribute in C# i was wondering if there are any
While writing a file using ofstream, how do I know when the file's size
This popped-up while writing a script for vim. Using the well-documented ':normal' command: :normal
I'm in the process of writing a custom drop down button in silverlight. While
I'm writing a bulk insert script using Django's ORM + custom raw SQL. The
While writing this method for a custom NUnit Constraint. private void AddMatchFailure<TExpected, TActual>(string failureName,
I'm writing a custom light-weight in/out board (AKA Status, Presence, etc.) application using the
While writing some C code, I decided to compile it to assembly and read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.