public static object GetOption(PhpResource parser, int option) { XmlParserResource xmlParser = parser as XmlParserResource; if (xmlParser != null) { switch ((XmlOption)option) { case XmlOption.XML_OPTION_CASE_FOLDING: return(xmlParser.EnableCaseFolding); case XmlOption.XML_OPTION_SKIP_WHITE: return(xmlParser.EnableSkipWhitespace); case XmlOption.XML_OPTION_SKIP_TAGSTART: break; case XmlOption.XML_OPTION_TARGET_ENCODING: break; } PhpException.Throw(PhpError.Warning, "invalid option value"); return(false); } else { PhpException.Throw(PhpError.Warning, "invalid parser"); return(false); } }
public static object GetErrorCode(PhpResource parser) { XmlParserResource xmlParser = parser as XmlParserResource; if (xmlParser != null) { return(xmlParser.ErrorCode); } return(false); }
public static int Parse(NamingContext /*!*/ namingContext, DTypeDesc caller, PhpResource parser, string data, bool is_final) { XmlParserResource xmlParser = XmlParserResource.ValidResource(parser); if (xmlParser != null) { return(xmlParser.Parse(caller, namingContext, data, is_final) ? 1 : 0); } return(0); }
public static int GetCurrentByteIndex(PhpResource parser) { XmlParserResource xmlParser = parser as XmlParserResource; if (xmlParser != null) { return(xmlParser.CurrentByteIndex); } return(-1); }
public static int GetCurrentLineNumber(PhpResource parser) { XmlParserResource xmlParser = parser as XmlParserResource; if (xmlParser != null) { return(xmlParser.CurrentLineNumber); } return(-1); }
public static bool SetExternalEntityRefHandler(PhpResource parser, object external_entity_ref_handler_obj) { XmlParserResource xmlParser = XmlParserResource.ValidResource(parser); if (xmlParser == null) { return(false); } PhpException.FunctionNotSupported(PhpError.Warning); return(false); }
public static bool SetNotationDeclHandler(PhpResource parser, object notation_decl_handler_obj) { XmlParserResource xmlParser = XmlParserResource.ValidResource(parser); if (xmlParser == null) { return(false); } PhpException.FunctionNotSupported(PhpError.Warning); return(false); }
public static bool SetProcessingInstructionHandler(PhpResource parser, object processing_instruction_handler_obj) { XmlParserResource xmlParser = XmlParserResource.ValidResource(parser); if (xmlParser == null) { return(false); } var processing_instruction_handler = xmlParser.ObjectToXmlCallback(processing_instruction_handler_obj); if (processing_instruction_handler != null) { xmlParser.ProcessingInstructionHandler = processing_instruction_handler; return(true); } return(false); }
public static bool Free(PhpResource parser) { XmlParserResource xmlParser = XmlParserResource.ValidResource(parser); if (xmlParser == null) { return(false); } // Since .NET hasn't online XML parser, we need the whole XML data to parse them properly. // Notice user, he has to parse the XML by passing is_final=true to the last xml_parse function call. if (!xmlParser.InputQueueIsEmpty) { PhpException.Throw(PhpError.Notice, Strings.not_parsed_data_left); } xmlParser.Dispose(); return(true); }
public static bool SetEndNamespaceDeclHandler(PhpResource parser, object end_namespace_decl_handler_obj) { XmlParserResource xmlParser = XmlParserResource.ValidResource(parser); if (xmlParser == null) { return(false); } var end_namespace_decl_handler = xmlParser.ObjectToXmlCallback(end_namespace_decl_handler_obj); if (end_namespace_decl_handler != null) { xmlParser.EndNamespaceDeclHandler = end_namespace_decl_handler; return(true); } return(false); }
public static bool SetCharacterDataHandler(PhpResource parser, object character_data_handler_obj) { XmlParserResource xmlParser = XmlParserResource.ValidResource(parser); if (xmlParser == null) { return(false); } var character_data_handler = xmlParser.ObjectToXmlCallback(character_data_handler_obj); if (character_data_handler != null) { xmlParser.CharacterDataHandler = character_data_handler; return(true); } return(false); }
public static bool SetDefaultHandler(PhpResource parser, object default_handler_obj) { XmlParserResource xmlParser = XmlParserResource.ValidResource(parser); if (xmlParser == null) { return(false); } var default_handler = xmlParser.ObjectToXmlCallback(default_handler_obj); if (default_handler != null) { xmlParser.DefaultHandler = default_handler; return(true); } return(false); }
public static bool SetElementHandler(PhpResource parser, object start_element_handler_obj, object end_element_handler_obj) { XmlParserResource xmlParser = XmlParserResource.ValidResource(parser); if (xmlParser == null) { return(false); } var start_element_handler = xmlParser.ObjectToXmlCallback(start_element_handler_obj); var end_element_handler = xmlParser.ObjectToXmlCallback(end_element_handler_obj); if (start_element_handler != null && end_element_handler != null) { xmlParser.StartElementHandler = start_element_handler; xmlParser.EndElementHandler = end_element_handler; return(true); } return(false); }
public static bool SetObject(PhpResource parser, PhpReference objRef) { XmlParserResource xmlParser = parser as XmlParserResource; if (xmlParser != null) { DObject dObject = objRef != null ? objRef.Value as DObject : null; if (dObject != null) { xmlParser.HandlerObject = dObject; } else { xmlParser.HandlerObject = null; } return(true); } return(false); }
public static int ParseIntoStruct(NamingContext /*!*/ namingContext, DTypeDesc caller, PhpResource parser, string data, PhpReference values, PhpReference index) { if (values == null) { PhpException.Throw(PhpError.Warning, "values argument should not be null"); return(0); } values.Value = new PhpArray(); if (index != null) { index.Value = new PhpArray(); } XmlParserResource xmlParser = parser as XmlParserResource; if (xmlParser != null) { return(xmlParser.ParseIntoStruct(caller, namingContext, data, (PhpArray)values.Value, index != null ? (PhpArray)index.Value : null) ? 1 : 0); } PhpException.Throw(PhpError.Warning, "parser argument should contain valid XML parser"); return(0); }
public HandlerWrapper(XmlParserResource parser, string name) { Parser = parser; Name = name; }
public HandlerWrapper(XmlParserResource parser, string name) { Parser = parser; Name = name; }