I have a XML configuration for Query CAML:
<add key="QueryList" value="<Query><Where><Eq><FieldRef Name='Cargar_x0020_Optimyth'/><Value Type='Boolean'>1</Value></Eq></Where></Query>" />
<add key="PaginacionList" value="10" />
<add key="QueryOptions" value="<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns><Paging ListItemCollectionPositionNext=''/>" />
Now, I want do this:
XElement ndQuery = XElement.Parse(Configuracion.QueryList);
XElement ndViewFields = XElement.Parse(Configuracion.ViewFields);
XElement ndQueryOptions = XElement.Parse(Configuracion.QueryOptions);
but I get an error.
I try this using XmlElement
and its working:
XmlElement ndQuery = xmlDoc.CreateElement("Query");
if (!String.IsNullOrEmpty(Configuracion.QueryList))
{
ndQuery.InnerXml = Configuracion.QueryList;
}
XmlElement ndViewFields = xmlDoc.CreateElement("ViewFields");
if (!String.IsNullOrEmpty(Configuracion.ViewFields))
{
ndViewFields.InnerXml = Configuracion.ViewFields;
}
XmlElement ndQueryOptions = xmlDoc.CreateElement("QueryOptions");
if (!String.IsNullOrEmpty(Configuracion.QueryOptions))
{
ndQueryOptions.InnerXml = Configuracion.QueryOptions;
}
XElement ndQuery = XElement.Parse(ndQuery2.OuterXml);
XElement ndViewFields = XElement.Parse(ndViewFields2.OuterXml);
XElement ndQueryOptions = XElement.Parse(ndQueryOptions2.OuterXml);
I want avoid use XmlElement
, and only XElement
.
Any solution about it?