innerxml

PHP SimpleXML get innerXML

你。 提交于 2020-01-08 13:24:19
问题 I need to get the HTML contents of answer in this bit of XML: <qa> <question>Who are you?</question> <answer>Who who, <strong>who who</strong>, <em>me</em></answer> </qa> So I want to get the string "Who who, <strong>who who</strong>, <em>me</em>". If I have the answer as a SimpleXMLElement , I can call asXML() to get "<answer>Who who, <strong>who who</strong>, <em>me</em></answer>", but how to get the inner XML of an element without the element itself wrapped around it? I'd prefer ways that

Best way to get InnerXml of an XElement?

爱⌒轻易说出口 提交于 2019-12-17 01:40:40
问题 What's the best way to get the contents of the mixed body element in the code below? The element might contain either XHTML or text, but I just want its contents in string form. The XmlElement type has the InnerXml property which is exactly what I'm after. The code as written almost does what I want, but includes the surrounding <body> ... </body> element, which I don't want. XDocument doc = XDocument.Load(new StreamReader(s)); var templates = from t in doc.Descendants("template") where t

PHP SimpleXML get innerXML

痞子三分冷 提交于 2019-11-26 15:31:25
I need to get the HTML contents of answer in this bit of XML: <qa> <question>Who are you?</question> <answer>Who who, <strong>who who</strong>, <em>me</em></answer> </qa> So I want to get the string "Who who, <strong>who who</strong>, <em>me</em>". If I have the answer as a SimpleXMLElement , I can call asXML() to get "<answer>Who who, <strong>who who</strong>, <em>me</em></answer>", but how to get the inner XML of an element without the element itself wrapped around it? I'd prefer ways that don't involve string functions, but if that's the only way, so be it. To the best of my knowledge,

Best way to get InnerXml of an XElement?

不问归期 提交于 2019-11-26 10:17:45
What's the best way to get the contents of the mixed body element in the code below? The element might contain either XHTML or text, but I just want its contents in string form. The XmlElement type has the InnerXml property which is exactly what I'm after. The code as written almost does what I want, but includes the surrounding <body> ... </body> element, which I don't want. XDocument doc = XDocument.Load(new StreamReader(s)); var templates = from t in doc.Descendants("template") where t.Attribute("name").Value == templateName select new { Subject = t.Element("subject").Value, Body = t