I get a ComponentData object and need to query the Component's content using XPath. I am using the full XPath to the field.

Currently I'm getting it from the Schema, but wonder if it's possible to get the Namespace directly from the Component?

SchemaData schema = client.Read(compData.Schema.IdRef, new ReadOptions()) as SchemaData;
string namespaceUri = schema.NamespaceUri;

1 Answer 1


Try this code

ComponentData component = (ComponentData)channel.Read("[ComponentId]", new ReadOptions());
XElement xComponent = XElement.Parse(component.Content);
string ns = xComponent.FirstAttribute.Value;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.