Example #1
0
        /// <summary>
        /// Converts a <see cref="SimpleXMLElement"/> object to a <see cref="DOMElement"/>.
        /// </summary>
        public static object dom_import_simplexml(SimpleXMLElement node)
        {
            if (node == null)
            {
                PhpException.InvalidImplicitCast(nameof(node), "SimpleXMLElement", "dom_import_simplexml");
                return(null);
            }

            return(DOMNode.Create(node.XmlElement));
        }
Example #2
0
        public static DObject ImportSimpleXml(DObject node)
        {
            SimpleXMLElement sxe_node = node as SimpleXMLElement;

            if (sxe_node == null)
            {
                PhpException.InvalidImplicitCast(node, "SimpleXMLElement", "node");
                return(null);
            }

            return((DObject)DOMNode.Create(sxe_node.XmlElement));
        }
Example #3
0
        public static DOMElement dom_import_simplexml(Env env, SimpleXMLElement node)
        {
            if (node == null)
            {
                return(null);
            }

            DOMDocument document = DOMDocument.__construct(env, "1.0", null);

            Value xml = node.asXML(env, DefaultValue.DEFAULT);

            document.loadXML(env, xml.ToStringValue(env), DefaultValue.DEFAULT);

            return(document.getDocumentElement());
        }
Example #4
0
 /// <summary>
 /// Import a stylesheet.
 /// </summary>
 /// <param name="stylesheet">The imported style sheet passed as a <see cref="SimpleXMLElement"/> object.</param>
 /// <returns><B>True</B> or <B>false</B>.</returns>
 public bool importStylesheet(SimpleXMLElement stylesheet)
 {
     try
     {
         if (stylesheet.XmlElement.ParentNode is XmlDocument)
         {
             Load(stylesheet.XmlElement.ParentNode.GetXmlDocument());
         }
         else
         {
             PhpException.Throw(PhpError.Warning, Resources.InvalidDocument);
             return(false);
         }
     }
     catch (XsltException e)
     {
         PhpException.Throw(PhpError.Warning, e.Message);
         return(false);
     }
     return(true);
 }
Example #5
0
 public static DOMElement dom_import_simplexml(SimpleXMLElement node) => (DOMElement)DOMNode.Create(node.XmlElement);