0

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;
3

Try this code

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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