From 9c7303de8f8454c2a2e1705c7ac2dfdb53df4e4d Mon Sep 17 00:00:00 2001 From: "peterv%netscape.com" Date: Thu, 14 Mar 2002 11:12:51 +0000 Subject: [PATCH] New files for bug 103235 (Implement DOM Level 3 XPath WD). r=sicking, sr=jst, a=dbaron. git-svn-id: svn://10.0.0.236/trunk@116537 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/dom/macbuild/dom_xpathIDL.xml | 1568 +++++++++++++++++ mozilla/dom/public/idl/xpath/MANIFEST_IDL | 43 + mozilla/dom/public/idl/xpath/Makefile.in | 57 + mozilla/dom/public/idl/xpath/makefile.win | 52 + .../public/idl/xpath/nsIDOMXPathEvaluator.idl | 66 + .../public/idl/xpath/nsIDOMXPathException.idl | 54 + .../idl/xpath/nsIDOMXPathExpression.idl | 57 + .../idl/xpath/nsIDOMXPathNSResolver.idl | 50 + .../public/idl/xpath/nsIDOMXPathNamespace.idl | 53 + .../public/idl/xpath/nsIDOMXPathResult.idl | 85 + .../source/xpath/nsXPathEvaluator.cpp | 116 ++ .../source/xpath/nsXPathEvaluator.h | 72 + .../source/xpath/nsXPathException.cpp | 282 +++ .../source/xpath/nsXPathException.h | 93 + .../source/xpath/nsXPathExpression.cpp | 154 ++ .../source/xpath/nsXPathExpression.h | 66 + .../source/xpath/nsXPathNSResolver.cpp | 70 + .../source/xpath/nsXPathNSResolver.h | 66 + .../source/xpath/nsXPathNamespace.cpp | 212 +++ .../source/xpath/nsXPathNamespace.h | 71 + .../source/xpath/nsXPathResult.cpp | 472 +++++ .../transformiix/source/xpath/nsXPathResult.h | 158 ++ 22 files changed, 3917 insertions(+) create mode 100644 mozilla/dom/macbuild/dom_xpathIDL.xml create mode 100644 mozilla/dom/public/idl/xpath/MANIFEST_IDL create mode 100644 mozilla/dom/public/idl/xpath/Makefile.in create mode 100644 mozilla/dom/public/idl/xpath/makefile.win create mode 100644 mozilla/dom/public/idl/xpath/nsIDOMXPathEvaluator.idl create mode 100644 mozilla/dom/public/idl/xpath/nsIDOMXPathException.idl create mode 100644 mozilla/dom/public/idl/xpath/nsIDOMXPathExpression.idl create mode 100644 mozilla/dom/public/idl/xpath/nsIDOMXPathNSResolver.idl create mode 100644 mozilla/dom/public/idl/xpath/nsIDOMXPathNamespace.idl create mode 100644 mozilla/dom/public/idl/xpath/nsIDOMXPathResult.idl create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathEvaluator.cpp create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathEvaluator.h create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathException.cpp create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathException.h create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathExpression.cpp create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathExpression.h create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.cpp create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.h create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathNamespace.cpp create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathNamespace.h create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathResult.cpp create mode 100644 mozilla/extensions/transformiix/source/xpath/nsXPathResult.h diff --git a/mozilla/dom/macbuild/dom_xpathIDL.xml b/mozilla/dom/macbuild/dom_xpathIDL.xml new file mode 100644 index 00000000000..d81a204c0bd --- /dev/null +++ b/mozilla/dom/macbuild/dom_xpathIDL.xml @@ -0,0 +1,1568 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + + + headers + + + + UserSourceTrees + + + AlwaysSearchUserPathsfalse + InterpretDOSAndUnixPathsfalse + RequireFrameworkStyleIncludesfalse + UserSearchPaths + + SearchPath + Path:::dist:idl: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path::public: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SystemSearchPaths + + SearchPath + Path: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + + + MWRuntimeSettings_WorkingDirectory + MWRuntimeSettings_CommandLine + MWRuntimeSettings_HostApplication + Path + PathFormatGeneric + PathRootAbsolute + + MWRuntimeSettings_EnvVars + + + Linkerxpt Linker + PreLinker + PostLinker + Targetnameheaders + OutputDirectory + Path:::dist:dom:dom_xpath: + PathFormatMacOS + PathRootProject + + SaveEntriesUsingRelativePathsfalse + + + FileMappings + + FileTypeRSRC + FileExtension + CompilerRez + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.bh + CompilerBalloon Help + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c + CompilerRunTSScript + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.idl + Compilerxpidl + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.r + CompilerRez + EditLanguageRez + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypersrc + FileExtension + CompilerRez + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileExtension.xpt + Compiler + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + + + CacheModDatestrue + ActivateBrowsertrue + DumpBrowserInfofalse + CacheSubprojectstrue + UseThirdPartyDebuggerfalse + DebuggerAppPath + Path + PathFormatGeneric + PathRootAbsolute + + DebuggerCmdLineArgs + DebuggerWorkingDir + Path + PathFormatGeneric + PathRootAbsolute + + + + LogSystemMessagestrue + AutoTargetDLLsfalse + StopAtWatchpointstrue + PauseWhileRunningfalse + PauseInterval5 + PauseUIFlags0 + AltExePath + Path + PathFormatGeneric + PathRootAbsolute + + StopAtTempBPOnLaunchtrue + CacheSymbolicstrue + TempBPFunctionNamemain + TempBPType0 + + + Enabledfalse + ConnectionName + DownloadPath + LaunchRemoteAppfalse + RemoteAppPath + + + OtherExecutables + + + CustomColor1 + Red0 + Green32767 + Blue0 + + CustomColor2 + Red0 + Green32767 + Blue0 + + CustomColor3 + Red0 + Green32767 + Blue0 + + CustomColor4 + Red0 + Green32767 + Blue0 + + + + MWFrontEnd_C_cplusplus0 + MWFrontEnd_C_checkprotos0 + MWFrontEnd_C_arm0 + MWFrontEnd_C_trigraphs0 + MWFrontEnd_C_onlystdkeywords0 + MWFrontEnd_C_enumsalwaysint0 + MWFrontEnd_C_mpwpointerstyle0 + MWFrontEnd_C_prefixname + MWFrontEnd_C_ansistrict0 + MWFrontEnd_C_mpwcnewline0 + MWFrontEnd_C_wchar_type1 + MWFrontEnd_C_enableexceptions1 + MWFrontEnd_C_dontreusestrings0 + MWFrontEnd_C_poolstrings0 + MWFrontEnd_C_dontinline0 + MWFrontEnd_C_useRTTI1 + MWFrontEnd_C_multibyteaware0 + MWFrontEnd_C_unsignedchars0 + MWFrontEnd_C_autoinline0 + MWFrontEnd_C_booltruefalse1 + MWFrontEnd_C_direct_to_som0 + MWFrontEnd_C_som_env_check0 + MWFrontEnd_C_alwaysinline0 + MWFrontEnd_C_inlinelevel0 + MWFrontEnd_C_ecplusplus0 + MWFrontEnd_C_objective_c0 + MWFrontEnd_C_defer_codegen0 + + + MWWarning_C_warn_illpragma0 + MWWarning_C_warn_emptydecl0 + MWWarning_C_warn_possunwant0 + MWWarning_C_warn_unusedvar0 + MWWarning_C_warn_unusedarg0 + MWWarning_C_warn_extracomma0 + MWWarning_C_pedantic0 + MWWarning_C_warningerrors0 + MWWarning_C_warn_hidevirtual0 + MWWarning_C_warn_implicitconv0 + MWWarning_C_warn_notinlined0 + MWWarning_C_warn_structclass0 + + + MWFTP_Post_hostName + MWFTP_Post_username + MWFTP_Post_password0 + MWFTP_Post_remoteDir + MWFTP_Post_ftp_PathVersion1 + MWFTP_Post_ftp_PathType0 + MWFTP_Post_ftp_PathFormat0 + MWFTP_Post_ftp_tree + MWFTP_Post_uploadDir + MWFTP_Post_ftp_port21 + MWFTP_Post_SendBin1 + MWFTP_Post_ShouldLog1 + + + MWCommandLine_Java_clsName + MWCommandLine_Java_args + + + MWVJavaDebugging_Protocol1 + MWVJavaDebugging_JDKVersion1 + MWVJavaDebugging_TimeOut25 + MWVJavaDebugging_SupportSlowDevicesfalse + + + MWJava_Language_optimizefalse + MWJava_Language_warnDeprecatedfalse + MWJava_Language_emitMapfalse + MWJava_Language_strictFileNamesfalse + MWJava_Language_strictFileHierarchyfalse + MWJava_Language_1_1_Compatiblefalse + MWJava_Language_emitHeaders0 + MWJava_Language_headerTypeJNINativeHeaders + MWJava_Language_packageFilter + MWJava_Language_genCommentstrue + MWJava_Language_genHeadersfalse + + + MWJava_MRJAppBuilder_outFileMRJApplication + MWJava_MRJAppBuilder_mergefalse + MWJava_MRJAppBuilder_quitMenutrue + MWJava_MRJAppBuilder_growfalse + MWJava_MRJAppBuilder_stdoutTypeConsole + MWJava_MRJAppBuilder_stderrTypeConsole + MWJava_MRJAppBuilder_stdinTypeConsole + MWJava_MRJAppBuilder_appIconPVersion0 + MWJava_MRJAppBuilder_appIconPType0 + MWJava_MRJAppBuilder_appIconPFormat0 + MWJava_MRJAppBuilder_appIconPTree + MWJava_MRJAppBuilder_appIconFile + MWJava_MRJAppBuilder_splashScreenPVersion0 + MWJava_MRJAppBuilder_splashScreenPType0 + MWJava_MRJAppBuilder_splashScreenPFormat0 + MWJava_MRJAppBuilder_splashScreenPTree + MWJava_MRJAppBuilder_splashScreenPICTFile + MWJava_MRJAppBuilder_aboutName + MWJava_MRJAppBuilder_stdoutPVersion0 + MWJava_MRJAppBuilder_stdoutPType0 + MWJava_MRJAppBuilder_stdoutPFormat0 + MWJava_MRJAppBuilder_stdoutPTree + MWJava_MRJAppBuilder_stdoutFile + MWJava_MRJAppBuilder_stdoutAppendfalse + MWJava_MRJAppBuilder_stderrPType0 + MWJava_MRJAppBuilder_stderrPFormat0 + MWJava_MRJAppBuilder_stderrPTree + MWJava_MRJAppBuilder_stderrFile + MWJava_MRJAppBuilder_stderrAppendfalse + MWJava_MRJAppBuilder_stdinPType0 + MWJava_MRJAppBuilder_stdinPFormat0 + MWJava_MRJAppBuilder_stdinPTree + MWJava_MRJAppBuilder_stdinFile + + + MWJava_Output_outputtypeJarFile + MWJava_Output_outfileJavaClasses.jar + MWJava_Output_ftype1514754080 + MWJava_Output_fcreator1297570384 + MWJava_Output_compress0 + MWJava_Output_genManifest0 + MWJava_Output_trunctypeFront + MWJava_Output_deleteClasses0 + MWJava_Output_consoleApp1 + + + MWJava_Proj_projtypeApplet + MWJava_Proj_mainClassName + MWJava_Proj_HTMLAppCreator1145457748 + MWJava_Proj_HTMLAppNameMetrowerks Java + MWJava_Proj_PathVersion1 + MWJava_Proj_PathType0 + MWJava_Proj_PathFormat0 + MWJava_Proj_tree + MWJava_Proj_HTMLAppWin32NameInternet Explorer + MWJava_Proj_compress0 + MWJava_Proj_useVM1 + MWJava_Proj_vmarguments + MWJava_Proj_vmName + MWJava_Proj_simPropFile + + + MWJavaDoc_Proj_Version1 + MWJavaDoc_Proj_Depricated1 + MWJavaDoc_Proj_Author1 + MWJavaDoc_Proj_Index1 + MWJavaDoc_Proj_Tree1 + MWJavaDoc_Proj_SunResolveToSame0 + MWJavaDoc_Proj_Shortnames1 + MWJavaDoc_Proj_Folder0 + MWJavaDoc_Proj_GenerateAPILinks0 + MWJavaDoc_Proj_scopePublic + MWJavaDoc_Proj_fcreator1297303877 + MWJavaDoc_Proj_encodingName + MWJavaDoc_Proj_decodingName + MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ + + + MWMerge_MacOS_projectTypeApplication + MWMerge_MacOS_outputNameMerge Out + MWMerge_MacOS_outputCreator???? + MWMerge_MacOS_outputTypeAPPL + MWMerge_MacOS_suppressWarning0 + MWMerge_MacOS_copyFragments1 + MWMerge_MacOS_copyResources1 + MWMerge_MacOS_flattenResource0 + MWMerge_MacOS_flatFileNamea.rsrc + MWMerge_MacOS_flatFileOutputPath + Path: + PathFormatMacOS + PathRootProject + + MWMerge_MacOS_skipResources + DLGX + ckid + Proj + WSPC + + + + FileLockedfalse + ResourcesMapIsReadOnlyfalse + PrinterDriverIsMultiFinderCompatiblefalse + Invisiblefalse + HasBundlefalse + NameLockedfalse + Stationeryfalse + HasCustomIconfalse + Sharedfalse + HasBeenInitedfalse + Label0 + Comments + + + MWMacOSPackager_UsePackager0 + MWMacOSPackager_FolderToPackage + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreateClassicAlias0 + MWMacOSPackager_ClassicAliasMethodUseTargetOutput + MWMacOSPackager_ClassicAliasPath + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreatePkgInfo0 + MWMacOSPackager_PkgCreatorType???? + MWMacOSPackager_PkgFileTypeAPPL + + + MWCodeGen_PPC_structalignmentMC68K + MWCodeGen_PPC_tracebacktablesNone + MWCodeGen_PPC_processorGeneric + MWCodeGen_PPC_readonlystrings0 + MWCodeGen_PPC_tocdata1 + MWCodeGen_PPC_profiler0 + MWCodeGen_PPC_fpcontract1 + MWCodeGen_PPC_schedule0 + MWCodeGen_PPC_peephole1 + MWCodeGen_PPC_processorspecific0 + MWCodeGen_PPC_altivec0 + MWCodeGen_PPC_vectortocdata0 + MWCodeGen_PPC_vrsave0 + + + MWCodeGen_MachO_structalignmentPPC + MWCodeGen_MachO_tracebacktablesNone + MWCodeGen_MachO_processorGeneric + MWCodeGen_MachO_readonlystrings0 + MWCodeGen_MachO_profiler0 + MWCodeGen_MachO_fpcontract1 + MWCodeGen_MachO_schedule0 + MWCodeGen_MachO_peephole1 + MWCodeGen_MachO_processorspecific0 + MWCodeGen_MachO_altivec0 + MWCodeGen_MachO_vrsave1 + MWCodeGen_MachO_common0 + MWCodeGen_MachO_implicit_templates1 + + + MWDisassembler_PPC_showcode1 + MWDisassembler_PPC_extended1 + MWDisassembler_PPC_mix0 + MWDisassembler_PPC_nohex0 + MWDisassembler_PPC_showdata1 + MWDisassembler_PPC_showexceptions1 + MWDisassembler_PPC_showsym0 + MWDisassembler_PPC_shownames1 + + + GlobalOptimizer_PPC_optimizationlevelLevel0 + GlobalOptimizer_PPC_optforSpeed + + + MWLinker_PPC_linksym1 + MWLinker_PPC_symfullpath1 + MWLinker_PPC_linkmap0 + MWLinker_PPC_nolinkwarnings0 + MWLinker_PPC_dontdeadstripinitcode0 + MWLinker_PPC_permitmultdefs0 + MWLinker_PPC_linkmodeFast + MWLinker_PPC_initname + MWLinker_PPC_mainname__start + MWLinker_PPC_termname + + + MWLinker_MachO_exportsNone + MWLinker_MachO_mainnamestart + MWLinker_MachO_currentversion0 + MWLinker_MachO_compatibleversion0 + MWLinker_MachO_symfullpath0 + MWLinker_MachO_supresswarnings0 + MWLinker_MachO_multisymerror0 + MWLinker_MachO_prebind1 + MWLinker_MachO_deadstrip1 + MWLinker_MachO_objectivecsemantics0 + MWLinker_MachO_whichfileloaded0 + MWLinker_MachO_whyfileloaded0 + MWLinker_MachO_readonlyrelocsErrors + MWLinker_MachO_undefinedsymbolsErrors + MWLinker_MachO_twolevelnamespace1 + MWLinker_MachO_stripdebugsymbols0 + + + MWProject_MachO_typeExecutable + MWProject_MachO_outfilea.exe + MWProject_MachO_filecreator???? + MWProject_MachO_filetypeMEXE + MWProject_MachO_stacksize64 + MWProject_MachO_stackaddress0 + MWProject_MachO_flatrsrc1 + MWProject_MachO_flatrsrcfilenamea.rsrc + MWProject_MachO_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_MachO_installpath./ + + + MWPEF_exportsNone + MWPEF_libfolder0 + MWPEF_sortcodeNone + MWPEF_expandbss0 + MWPEF_sharedata0 + MWPEF_olddefversion0 + MWPEF_oldimpversion0 + MWPEF_currentversion0 + MWPEF_fragmentname + MWPEF_collapsereloads0 + + + MWProject_PPC_typeApplication + MWProject_PPC_outfilea.out + MWProject_PPC_filecreator???? + MWProject_PPC_filetypeAPPL + MWProject_PPC_size384 + MWProject_PPC_minsize384 + MWProject_PPC_stacksize64 + MWProject_PPC_flags22720 + MWProject_PPC_symfilename + MWProject_PPC_rsrcname + MWProject_PPC_rsrcheaderNative + MWProject_PPC_rsrctype???? + MWProject_PPC_rsrcid0 + MWProject_PPC_rsrcflags0 + MWProject_PPC_rsrcstore0 + MWProject_PPC_rsrcmerge0 + MWProject_PPC_flatrsrc0 + MWProject_PPC_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_PPC_flatrsrcfilename + + + MWAssembler_PPC_auxheader0 + MWAssembler_PPC_symmodeMac + MWAssembler_PPC_dialectPPC + MWAssembler_PPC_prefixfile + MWAssembler_PPC_typecheck0 + MWAssembler_PPC_warnings0 + MWAssembler_PPC_casesensitive0 + + + MWRez_Language_maxwidth80 + MWRez_Language_scriptRoman + MWRez_Language_alignmentAlign1 + MWRez_Language_filtermodeFilterSkip + MWRez_Language_suppresswarnings0 + MWRez_Language_escapecontrolchars1 + MWRez_Language_prefixname + MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' + + + MWWinRC_prefixname + + + MWCodeGen_X86_processorGeneric + MWCodeGen_X86_alignmentbytes8 + MWCodeGen_X86_exceptionsZeroOverhead + MWCodeGen_X86_extinst_mmx0 + MWCodeGen_X86_extinst_3dnow0 + MWCodeGen_X86_use_mmx_3dnow_convention0 + MWCodeGen_X86_machinecodelisting0 + MWCodeGen_X86_intrinsics0 + MWCodeGen_X86_syminfo0 + MWCodeGen_X86_codeviewinfo1 + MWCodeGen_X86_extinst_cmov_fcomi0 + MWCodeGen_X86_extinst_sse0 + + + PDisasmX86_showHeaderstrue + PDisasmX86_showSymTabtrue + PDisasmX86_showCodetrue + PDisasmX86_showSourcefalse + PDisasmX86_showHextrue + PDisasmX86_showRelocationtrue + PDisasmX86_showCommentsfalse + PDisasmX86_showDebugfalse + PDisasmX86_showExceptionsfalse + PDisasmX86_showDatatrue + PDisasmX86_showRawfalse + PDisasmX86_verbosetrue + + + MWDebugger_X86_Exceptions + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + GlobalOptimizer_X86_optimizationlevelLevel0 + GlobalOptimizer_X86_optforSpeed + + + MWLinker_X86_entrypointusageDefault + MWLinker_X86_entrypoint + MWLinker_X86_subsystemWinGUI + MWLinker_X86_subsysmajorid4 + MWLinker_X86_subsysminorid0 + MWLinker_X86_usrmajorid0 + MWLinker_X86_usrminorid0 + MWLinker_X86_commandfile + MWLinker_X86_generatemap0 + MWLinker_X86_linksym0 + MWLinker_X86_linkCV1 + + + MWProject_X86_typeApplication + MWProject_X86_outfilenoname.exe + MWProject_X86_baseaddress4194304 + MWProject_X86_maxstacksize1024 + MWProject_X86_minstacksize4 + MWProject_X86_size1024 + MWProject_X86_minsize4 + MWProject_X86_importlib + xpidl Settings + 00010001010111646F6D5F78706174682E686561646572730000000000000000 + 0000000000000000 + + + + + Name + nsIDOMXPathNamespace.idl + MacOS + Text + + + + Name + nsIDOMXPathResult.idl + MacOS + Text + + + + Name + nsIDOMXPathNSResolver.idl + MacOS + Text + + + + Name + nsIDOMXPathExpression.idl + MacOS + Text + + + + Name + nsIDOMXPathException.idl + MacOS + Text + + + + Name + nsIDOMXPathEvaluator.idl + MacOS + Text + + + + + + Name + nsIDOMXPathNamespace.idl + MacOS + + + Name + nsIDOMXPathResult.idl + MacOS + + + Name + nsIDOMXPathNSResolver.idl + MacOS + + + Name + nsIDOMXPathExpression.idl + MacOS + + + Name + nsIDOMXPathException.idl + MacOS + + + Name + nsIDOMXPathEvaluator.idl + MacOS + + + + + dom_xpath.xpt + + + + UserSourceTrees + + + AlwaysSearchUserPathsfalse + InterpretDOSAndUnixPathsfalse + RequireFrameworkStyleIncludesfalse + UserSearchPaths + + SearchPath + Path:::dist:idl: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path::public: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SystemSearchPaths + + SearchPath + Path: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + + + MWRuntimeSettings_WorkingDirectory + MWRuntimeSettings_CommandLine + MWRuntimeSettings_HostApplication + Path + PathFormatGeneric + PathRootAbsolute + + MWRuntimeSettings_EnvVars + + + Linkerxpt Linker + PreLinker + PostLinker + Targetnamedom_xpath.xpt + OutputDirectory + Path: + PathFormatMacOS + PathRootProject + + SaveEntriesUsingRelativePathsfalse + + + FileMappings + + FileTypeRSRC + FileExtension + CompilerRez + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.bh + CompilerBalloon Help + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c + CompilerRunTSScript + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.idl + Compilerxpidl + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.r + CompilerRez + EditLanguageRez + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypersrc + FileExtension + CompilerRez + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileExtension.xpt + Compiler + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + + + CacheModDatestrue + ActivateBrowsertrue + DumpBrowserInfofalse + CacheSubprojectstrue + UseThirdPartyDebuggerfalse + DebuggerAppPath + Path + PathFormatGeneric + PathRootAbsolute + + DebuggerCmdLineArgs + DebuggerWorkingDir + Path + PathFormatGeneric + PathRootAbsolute + + + + LogSystemMessagestrue + AutoTargetDLLsfalse + StopAtWatchpointstrue + PauseWhileRunningfalse + PauseInterval5 + PauseUIFlags0 + AltExePath + Path + PathFormatGeneric + PathRootAbsolute + + StopAtTempBPOnLaunchtrue + CacheSymbolicstrue + TempBPFunctionNamemain + TempBPType0 + + + Enabledfalse + ConnectionName + DownloadPath + LaunchRemoteAppfalse + RemoteAppPath + + + OtherExecutables + + + CustomColor1 + Red0 + Green32767 + Blue0 + + CustomColor2 + Red0 + Green32767 + Blue0 + + CustomColor3 + Red0 + Green32767 + Blue0 + + CustomColor4 + Red0 + Green32767 + Blue0 + + + + MWFrontEnd_C_cplusplus0 + MWFrontEnd_C_checkprotos0 + MWFrontEnd_C_arm0 + MWFrontEnd_C_trigraphs0 + MWFrontEnd_C_onlystdkeywords0 + MWFrontEnd_C_enumsalwaysint0 + MWFrontEnd_C_mpwpointerstyle0 + MWFrontEnd_C_prefixname + MWFrontEnd_C_ansistrict0 + MWFrontEnd_C_mpwcnewline0 + MWFrontEnd_C_wchar_type1 + MWFrontEnd_C_enableexceptions1 + MWFrontEnd_C_dontreusestrings0 + MWFrontEnd_C_poolstrings0 + MWFrontEnd_C_dontinline0 + MWFrontEnd_C_useRTTI1 + MWFrontEnd_C_multibyteaware0 + MWFrontEnd_C_unsignedchars0 + MWFrontEnd_C_autoinline0 + MWFrontEnd_C_booltruefalse1 + MWFrontEnd_C_direct_to_som0 + MWFrontEnd_C_som_env_check0 + MWFrontEnd_C_alwaysinline0 + MWFrontEnd_C_inlinelevel0 + MWFrontEnd_C_ecplusplus0 + MWFrontEnd_C_objective_c0 + MWFrontEnd_C_defer_codegen0 + + + MWWarning_C_warn_illpragma0 + MWWarning_C_warn_emptydecl0 + MWWarning_C_warn_possunwant0 + MWWarning_C_warn_unusedvar0 + MWWarning_C_warn_unusedarg0 + MWWarning_C_warn_extracomma0 + MWWarning_C_pedantic0 + MWWarning_C_warningerrors0 + MWWarning_C_warn_hidevirtual0 + MWWarning_C_warn_implicitconv0 + MWWarning_C_warn_notinlined0 + MWWarning_C_warn_structclass0 + + + MWFTP_Post_hostName + MWFTP_Post_username + MWFTP_Post_password0 + MWFTP_Post_remoteDir + MWFTP_Post_ftp_PathVersion1 + MWFTP_Post_ftp_PathType0 + MWFTP_Post_ftp_PathFormat0 + MWFTP_Post_ftp_tree + MWFTP_Post_uploadDir + MWFTP_Post_ftp_port21 + MWFTP_Post_SendBin1 + MWFTP_Post_ShouldLog1 + + + MWCommandLine_Java_clsName + MWCommandLine_Java_args + + + MWVJavaDebugging_Protocol1 + MWVJavaDebugging_JDKVersion1 + MWVJavaDebugging_TimeOut25 + MWVJavaDebugging_SupportSlowDevicesfalse + + + MWJava_Language_optimizefalse + MWJava_Language_warnDeprecatedfalse + MWJava_Language_emitMapfalse + MWJava_Language_strictFileNamesfalse + MWJava_Language_strictFileHierarchyfalse + MWJava_Language_1_1_Compatiblefalse + MWJava_Language_emitHeaders0 + MWJava_Language_headerTypeJNINativeHeaders + MWJava_Language_packageFilter + MWJava_Language_genCommentstrue + MWJava_Language_genHeadersfalse + + + MWJava_MRJAppBuilder_outFileMRJApplication + MWJava_MRJAppBuilder_mergefalse + MWJava_MRJAppBuilder_quitMenutrue + MWJava_MRJAppBuilder_growfalse + MWJava_MRJAppBuilder_stdoutTypeConsole + MWJava_MRJAppBuilder_stderrTypeConsole + MWJava_MRJAppBuilder_stdinTypeConsole + MWJava_MRJAppBuilder_appIconPVersion0 + MWJava_MRJAppBuilder_appIconPType0 + MWJava_MRJAppBuilder_appIconPFormat0 + MWJava_MRJAppBuilder_appIconPTree + MWJava_MRJAppBuilder_appIconFile + MWJava_MRJAppBuilder_splashScreenPVersion0 + MWJava_MRJAppBuilder_splashScreenPType0 + MWJava_MRJAppBuilder_splashScreenPFormat0 + MWJava_MRJAppBuilder_splashScreenPTree + MWJava_MRJAppBuilder_splashScreenPICTFile + MWJava_MRJAppBuilder_aboutName + MWJava_MRJAppBuilder_stdoutPVersion0 + MWJava_MRJAppBuilder_stdoutPType0 + MWJava_MRJAppBuilder_stdoutPFormat0 + MWJava_MRJAppBuilder_stdoutPTree + MWJava_MRJAppBuilder_stdoutFile + MWJava_MRJAppBuilder_stdoutAppendfalse + MWJava_MRJAppBuilder_stderrPType0 + MWJava_MRJAppBuilder_stderrPFormat0 + MWJava_MRJAppBuilder_stderrPTree + MWJava_MRJAppBuilder_stderrFile + MWJava_MRJAppBuilder_stderrAppendfalse + MWJava_MRJAppBuilder_stdinPType0 + MWJava_MRJAppBuilder_stdinPFormat0 + MWJava_MRJAppBuilder_stdinPTree + MWJava_MRJAppBuilder_stdinFile + + + MWJava_Output_outputtypeJarFile + MWJava_Output_outfileJavaClasses.jar + MWJava_Output_ftype1514754080 + MWJava_Output_fcreator1297570384 + MWJava_Output_compress0 + MWJava_Output_genManifest0 + MWJava_Output_trunctypeFront + MWJava_Output_deleteClasses0 + MWJava_Output_consoleApp1 + + + MWJava_Proj_projtypeApplet + MWJava_Proj_mainClassName + MWJava_Proj_HTMLAppCreator1145457748 + MWJava_Proj_HTMLAppNameMetrowerks Java + MWJava_Proj_PathVersion1 + MWJava_Proj_PathType0 + MWJava_Proj_PathFormat0 + MWJava_Proj_tree + MWJava_Proj_HTMLAppWin32NameInternet Explorer + MWJava_Proj_compress0 + MWJava_Proj_useVM1 + MWJava_Proj_vmarguments + MWJava_Proj_vmName + MWJava_Proj_simPropFile + + + MWJavaDoc_Proj_Version1 + MWJavaDoc_Proj_Depricated1 + MWJavaDoc_Proj_Author1 + MWJavaDoc_Proj_Index1 + MWJavaDoc_Proj_Tree1 + MWJavaDoc_Proj_SunResolveToSame0 + MWJavaDoc_Proj_Shortnames1 + MWJavaDoc_Proj_Folder0 + MWJavaDoc_Proj_GenerateAPILinks0 + MWJavaDoc_Proj_scopePublic + MWJavaDoc_Proj_fcreator1297303877 + MWJavaDoc_Proj_encodingName + MWJavaDoc_Proj_decodingName + MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ + + + MWMerge_MacOS_projectTypeApplication + MWMerge_MacOS_outputNameMerge Out + MWMerge_MacOS_outputCreator???? + MWMerge_MacOS_outputTypeAPPL + MWMerge_MacOS_suppressWarning0 + MWMerge_MacOS_copyFragments1 + MWMerge_MacOS_copyResources1 + MWMerge_MacOS_flattenResource0 + MWMerge_MacOS_flatFileNamea.rsrc + MWMerge_MacOS_flatFileOutputPath + Path: + PathFormatMacOS + PathRootProject + + MWMerge_MacOS_skipResources + DLGX + ckid + Proj + WSPC + + + + FileLockedfalse + ResourcesMapIsReadOnlyfalse + PrinterDriverIsMultiFinderCompatiblefalse + Invisiblefalse + HasBundlefalse + NameLockedfalse + Stationeryfalse + HasCustomIconfalse + Sharedfalse + HasBeenInitedfalse + Label0 + Comments + + + MWMacOSPackager_UsePackager0 + MWMacOSPackager_FolderToPackage + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreateClassicAlias0 + MWMacOSPackager_ClassicAliasMethodUseTargetOutput + MWMacOSPackager_ClassicAliasPath + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreatePkgInfo0 + MWMacOSPackager_PkgCreatorType???? + MWMacOSPackager_PkgFileTypeAPPL + + + MWCodeGen_PPC_structalignmentMC68K + MWCodeGen_PPC_tracebacktablesNone + MWCodeGen_PPC_processorGeneric + MWCodeGen_PPC_readonlystrings0 + MWCodeGen_PPC_tocdata1 + MWCodeGen_PPC_profiler0 + MWCodeGen_PPC_fpcontract1 + MWCodeGen_PPC_schedule0 + MWCodeGen_PPC_peephole1 + MWCodeGen_PPC_processorspecific0 + MWCodeGen_PPC_altivec0 + MWCodeGen_PPC_vectortocdata0 + MWCodeGen_PPC_vrsave0 + + + MWCodeGen_MachO_structalignmentPPC + MWCodeGen_MachO_tracebacktablesNone + MWCodeGen_MachO_processorGeneric + MWCodeGen_MachO_readonlystrings0 + MWCodeGen_MachO_profiler0 + MWCodeGen_MachO_fpcontract1 + MWCodeGen_MachO_schedule0 + MWCodeGen_MachO_peephole1 + MWCodeGen_MachO_processorspecific0 + MWCodeGen_MachO_altivec0 + MWCodeGen_MachO_vrsave1 + MWCodeGen_MachO_common0 + MWCodeGen_MachO_implicit_templates1 + + + MWDisassembler_PPC_showcode1 + MWDisassembler_PPC_extended1 + MWDisassembler_PPC_mix0 + MWDisassembler_PPC_nohex0 + MWDisassembler_PPC_showdata1 + MWDisassembler_PPC_showexceptions1 + MWDisassembler_PPC_showsym0 + MWDisassembler_PPC_shownames1 + + + GlobalOptimizer_PPC_optimizationlevelLevel0 + GlobalOptimizer_PPC_optforSpeed + + + MWLinker_PPC_linksym1 + MWLinker_PPC_symfullpath1 + MWLinker_PPC_linkmap0 + MWLinker_PPC_nolinkwarnings0 + MWLinker_PPC_dontdeadstripinitcode0 + MWLinker_PPC_permitmultdefs0 + MWLinker_PPC_linkmodeFast + MWLinker_PPC_initname + MWLinker_PPC_mainname__start + MWLinker_PPC_termname + + + MWLinker_MachO_exportsNone + MWLinker_MachO_mainnamestart + MWLinker_MachO_currentversion0 + MWLinker_MachO_compatibleversion0 + MWLinker_MachO_symfullpath0 + MWLinker_MachO_supresswarnings0 + MWLinker_MachO_multisymerror0 + MWLinker_MachO_prebind1 + MWLinker_MachO_deadstrip1 + MWLinker_MachO_objectivecsemantics0 + MWLinker_MachO_whichfileloaded0 + MWLinker_MachO_whyfileloaded0 + MWLinker_MachO_readonlyrelocsErrors + MWLinker_MachO_undefinedsymbolsErrors + MWLinker_MachO_twolevelnamespace1 + MWLinker_MachO_stripdebugsymbols0 + + + MWProject_MachO_typeExecutable + MWProject_MachO_outfilea.exe + MWProject_MachO_filecreator???? + MWProject_MachO_filetypeMEXE + MWProject_MachO_stacksize64 + MWProject_MachO_stackaddress0 + MWProject_MachO_flatrsrc1 + MWProject_MachO_flatrsrcfilenamea.rsrc + MWProject_MachO_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_MachO_installpath./ + + + MWPEF_exportsNone + MWPEF_libfolder0 + MWPEF_sortcodeNone + MWPEF_expandbss0 + MWPEF_sharedata0 + MWPEF_olddefversion0 + MWPEF_oldimpversion0 + MWPEF_currentversion0 + MWPEF_fragmentname + MWPEF_collapsereloads0 + + + MWProject_PPC_typeApplication + MWProject_PPC_outfilea.out + MWProject_PPC_filecreator???? + MWProject_PPC_filetypeAPPL + MWProject_PPC_size384 + MWProject_PPC_minsize384 + MWProject_PPC_stacksize64 + MWProject_PPC_flags22720 + MWProject_PPC_symfilename + MWProject_PPC_rsrcname + MWProject_PPC_rsrcheaderNative + MWProject_PPC_rsrctype???? + MWProject_PPC_rsrcid0 + MWProject_PPC_rsrcflags0 + MWProject_PPC_rsrcstore0 + MWProject_PPC_rsrcmerge0 + MWProject_PPC_flatrsrc0 + MWProject_PPC_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_PPC_flatrsrcfilename + + + MWAssembler_PPC_auxheader0 + MWAssembler_PPC_symmodeMac + MWAssembler_PPC_dialectPPC + MWAssembler_PPC_prefixfile + MWAssembler_PPC_typecheck0 + MWAssembler_PPC_warnings0 + MWAssembler_PPC_casesensitive0 + + + MWRez_Language_maxwidth80 + MWRez_Language_scriptRoman + MWRez_Language_alignmentAlign1 + MWRez_Language_filtermodeFilterSkip + MWRez_Language_suppresswarnings0 + MWRez_Language_escapecontrolchars1 + MWRez_Language_prefixname + MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' + + + MWWinRC_prefixname + + + MWCodeGen_X86_processorGeneric + MWCodeGen_X86_alignmentbytes8 + MWCodeGen_X86_exceptionsZeroOverhead + MWCodeGen_X86_extinst_mmx0 + MWCodeGen_X86_extinst_3dnow0 + MWCodeGen_X86_use_mmx_3dnow_convention0 + MWCodeGen_X86_machinecodelisting0 + MWCodeGen_X86_intrinsics0 + MWCodeGen_X86_syminfo0 + MWCodeGen_X86_codeviewinfo1 + MWCodeGen_X86_extinst_cmov_fcomi0 + MWCodeGen_X86_extinst_sse0 + + + PDisasmX86_showHeaderstrue + PDisasmX86_showSymTabtrue + PDisasmX86_showCodetrue + PDisasmX86_showSourcefalse + PDisasmX86_showHextrue + PDisasmX86_showRelocationtrue + PDisasmX86_showCommentsfalse + PDisasmX86_showDebugfalse + PDisasmX86_showExceptionsfalse + PDisasmX86_showDatatrue + PDisasmX86_showRawfalse + PDisasmX86_verbosefalse + + + MWDebugger_X86_Exceptions + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + GlobalOptimizer_X86_optimizationlevelLevel0 + GlobalOptimizer_X86_optforSpeed + + + MWLinker_X86_entrypointusageDefault + MWLinker_X86_entrypoint + MWLinker_X86_subsystemWinGUI + MWLinker_X86_subsysmajorid4 + MWLinker_X86_subsysminorid0 + MWLinker_X86_usrmajorid0 + MWLinker_X86_usrminorid0 + MWLinker_X86_commandfile + MWLinker_X86_generatemap0 + MWLinker_X86_linksym0 + MWLinker_X86_linkCV1 + + + MWProject_X86_typeApplication + MWProject_X86_outfilenoname.exe + MWProject_X86_baseaddress4194304 + MWProject_X86_maxstacksize1024 + MWProject_X86_minstacksize4 + MWProject_X86_size1024 + MWProject_X86_minsize4 + MWProject_X86_importlib + xpidl Settings + 0001000301010D646F6D5F78706174682E787074000000000000000000000000 + 0000000000000000 + + + + + Name + nsIDOMXPathNamespace.idl + MacOS + Text + + + + Name + nsIDOMXPathResult.idl + MacOS + Text + + + + Name + nsIDOMXPathNSResolver.idl + MacOS + Text + + + + Name + nsIDOMXPathExpression.idl + MacOS + Text + + + + Name + nsIDOMXPathException.idl + MacOS + Text + + + + Name + nsIDOMXPathEvaluator.idl + MacOS + Text + + + + + + Name + nsIDOMXPathNamespace.idl + MacOS + + + Name + nsIDOMXPathResult.idl + MacOS + + + Name + nsIDOMXPathNSResolver.idl + MacOS + + + Name + nsIDOMXPathExpression.idl + MacOS + + + Name + nsIDOMXPathException.idl + MacOS + + + Name + nsIDOMXPathEvaluator.idl + MacOS + + + + + + + headers + dom_xpath.xpt + + + + + headers + Name + nsIDOMXPathNamespace.idl + MacOS + + + headers + Name + nsIDOMXPathResult.idl + MacOS + + + headers + Name + nsIDOMXPathNSResolver.idl + MacOS + + + headers + Name + nsIDOMXPathExpression.idl + MacOS + + + headers + Name + nsIDOMXPathException.idl + MacOS + + + headers + Name + nsIDOMXPathEvaluator.idl + MacOS + + + + diff --git a/mozilla/dom/public/idl/xpath/MANIFEST_IDL b/mozilla/dom/public/idl/xpath/MANIFEST_IDL new file mode 100644 index 00000000000..1328acfdfa1 --- /dev/null +++ b/mozilla/dom/public/idl/xpath/MANIFEST_IDL @@ -0,0 +1,43 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2001 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Peter Van der Beken (original author) +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +nsIDOMXPathEvaluator.idl +nsIDOMXPathException.idl +nsIDOMXPathExpression.idl +nsIDOMXPathNamespace.idl +nsIDOMXPathNSResolver.idl +nsIDOMXPathResult.idl diff --git a/mozilla/dom/public/idl/xpath/Makefile.in b/mozilla/dom/public/idl/xpath/Makefile.in new file mode 100644 index 00000000000..5fb9f0bd53e --- /dev/null +++ b/mozilla/dom/public/idl/xpath/Makefile.in @@ -0,0 +1,57 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2001 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Peter Van der Beken (original author) +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = dom +XPIDL_MODULE = dom_xpath + +XPIDLSRCS = \ + nsIDOMXPathEvaluator.idl \ + nsIDOMXPathException.idl \ + nsIDOMXPathExpression.idl \ + nsIDOMXPathNamespace.idl \ + nsIDOMXPathNSResolver.idl \ + nsIDOMXPathResult.idl \ + $(NULL) + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/dom/public/idl/xpath/makefile.win b/mozilla/dom/public/idl/xpath/makefile.win new file mode 100644 index 00000000000..efd87b70fd5 --- /dev/null +++ b/mozilla/dom/public/idl/xpath/makefile.win @@ -0,0 +1,52 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2001 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Peter Van der Beken (original author) +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH=..\..\..\.. + +MODULE=dom +XPIDL_MODULE=dom_xpath + +XPIDLSRCS = \ + .\nsIDOMXPathEvaluator.idl \ + .\nsIDOMXPathException.idl \ + .\nsIDOMXPathExpression.idl \ + .\nsIDOMXPathNamespace.idl \ + .\nsIDOMXPathNSResolver.idl \ + .\nsIDOMXPathResult.idl \ + $(NULL) + +include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/dom/public/idl/xpath/nsIDOMXPathEvaluator.idl b/mozilla/dom/public/idl/xpath/nsIDOMXPathEvaluator.idl new file mode 100644 index 00000000000..1ca42f74cd4 --- /dev/null +++ b/mozilla/dom/public/idl/xpath/nsIDOMXPathEvaluator.idl @@ -0,0 +1,66 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/** + * Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208 + */ + +#include "domstubs.idl" + +interface nsIDOMXPathNSResolver; +interface nsIDOMXPathResult; +interface nsIDOMXPathExpression; +interface XPathException; + +[scriptable, uuid(75506f8a-b504-11d5-a7f2-ca108ab8b6fc)] +interface nsIDOMXPathEvaluator : nsISupports +{ + nsIDOMXPathExpression createExpression(in DOMString expression, + in nsIDOMXPathNSResolver resolver) + raises(XPathException, + DOMException); + nsIDOMXPathNSResolver createNSResolver(in nsIDOMNode nodeResolver); + nsIDOMXPathResult evaluate(in DOMString expression, + in nsIDOMNode contextNode, + in nsIDOMXPathNSResolver resolver, + in unsigned short type, + in nsIDOMXPathResult result) + raises(XPathException, + DOMException); +}; diff --git a/mozilla/dom/public/idl/xpath/nsIDOMXPathException.idl b/mozilla/dom/public/idl/xpath/nsIDOMXPathException.idl new file mode 100644 index 00000000000..066998c1dca --- /dev/null +++ b/mozilla/dom/public/idl/xpath/nsIDOMXPathException.idl @@ -0,0 +1,54 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/** + * Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208 + */ + +#include "domstubs.idl" + +[scriptable, uuid(75506f89-b504-11d5-a7f2-ca108ab8b6fc)] +interface nsIDOMXPathException : nsISupports +{ + // XPathExceptionCode + const unsigned short INVALID_EXPRESSION_ERR = 1; + const unsigned short TYPE_ERR = 2; + + readonly attribute unsigned short code; +}; diff --git a/mozilla/dom/public/idl/xpath/nsIDOMXPathExpression.idl b/mozilla/dom/public/idl/xpath/nsIDOMXPathExpression.idl new file mode 100644 index 00000000000..a88f578e537 --- /dev/null +++ b/mozilla/dom/public/idl/xpath/nsIDOMXPathExpression.idl @@ -0,0 +1,57 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/** + * Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208 + */ + +#include "domstubs.idl" + +interface nsIDOMXPathResult; +interface XPathException; + +[scriptable, uuid(75506f82-b504-11d5-a7f2-ca108ab8b6fc)] +interface nsIDOMXPathExpression : nsISupports +{ + nsIDOMXPathResult evaluate(in nsIDOMNode contextNode, + in unsigned short type, + in nsIDOMXPathResult result) + raises(XPathException, + DOMException); +}; diff --git a/mozilla/dom/public/idl/xpath/nsIDOMXPathNSResolver.idl b/mozilla/dom/public/idl/xpath/nsIDOMXPathNSResolver.idl new file mode 100644 index 00000000000..3fcbdca40bf --- /dev/null +++ b/mozilla/dom/public/idl/xpath/nsIDOMXPathNSResolver.idl @@ -0,0 +1,50 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/** + * Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208 + */ + +#include "domstubs.idl" + +[scriptable, function, uuid(75506f83-b504-11d5-a7f2-ca108ab8b6fc)] +interface nsIDOMXPathNSResolver : nsISupports +{ + DOMString lookupNamespaceURI(in DOMString prefix); +}; diff --git a/mozilla/dom/public/idl/xpath/nsIDOMXPathNamespace.idl b/mozilla/dom/public/idl/xpath/nsIDOMXPathNamespace.idl new file mode 100644 index 00000000000..adc18709a95 --- /dev/null +++ b/mozilla/dom/public/idl/xpath/nsIDOMXPathNamespace.idl @@ -0,0 +1,53 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/** + * Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208 + */ + +#include "nsIDOMNode.idl" + +[scriptable, uuid(75506f87-b504-11d5-a7f2-ca108ab8b6fc)] +interface nsIDOMXPathNamespace : nsIDOMNode +{ + // XPathNodeType + const unsigned short XPATH_NAMESPACE_NODE = 13; + + readonly attribute nsIDOMElement ownerElement; +}; diff --git a/mozilla/dom/public/idl/xpath/nsIDOMXPathResult.idl b/mozilla/dom/public/idl/xpath/nsIDOMXPathResult.idl new file mode 100644 index 00000000000..e80efc940b4 --- /dev/null +++ b/mozilla/dom/public/idl/xpath/nsIDOMXPathResult.idl @@ -0,0 +1,85 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/** + * Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208 + */ + +#include "domstubs.idl" + +interface XPathException; + +[scriptable, uuid(75506f84-b504-11d5-a7f2-ca108ab8b6fc)] +interface nsIDOMXPathResult : nsISupports +{ + // XPathResultType + const unsigned short ANY_TYPE = 0; + const unsigned short NUMBER_TYPE = 1; + const unsigned short STRING_TYPE = 2; + const unsigned short BOOLEAN_TYPE = 3; + const unsigned short UNORDERED_NODE_ITERATOR_TYPE = 4; + const unsigned short ORDERED_NODE_ITERATOR_TYPE = 5; + const unsigned short UNORDERED_NODE_SNAPSHOT_TYPE = 6; + const unsigned short ORDERED_NODE_SNAPSHOT_TYPE = 7; + const unsigned short ANY_UNORDERED_NODE_TYPE = 8; + const unsigned short FIRST_ORDERED_NODE_TYPE = 9; + + readonly attribute unsigned short resultType; + readonly attribute double numberValue; + // raises(XPathException) on retrieval + + readonly attribute DOMString stringValue; + // raises(XPathException) on retrieval + + readonly attribute boolean booleanValue; + // raises(XPathException) on retrieval + + readonly attribute nsIDOMNode singleNodeValue; + // raises(XPathException) on retrieval + + readonly attribute boolean invalidIteratorState; + readonly attribute unsigned long snapshotLength; + // raises(XPathException) on retrieval + + nsIDOMNode iterateNext() + raises(XPathException, + DOMException); + nsIDOMNode snapshotItem(in unsigned long index) + raises(XPathException); +}; diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathEvaluator.cpp b/mozilla/extensions/transformiix/source/xpath/nsXPathEvaluator.cpp new file mode 100644 index 00000000000..6af02b97a7e --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathEvaluator.cpp @@ -0,0 +1,116 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsXPathEvaluator.h" +#include "nsCOMPtr.h" +#include "nsIDOMClassInfo.h" +#include "nsXPathException.h" +#include "nsXPathExpression.h" +#include "nsXPathNSResolver.h" +#include "nsXPathResult.h" +#include "ProcessorState.h" + +NS_IMPL_ADDREF(nsXPathEvaluator) +NS_IMPL_RELEASE(nsXPathEvaluator) +NS_INTERFACE_MAP_BEGIN(nsXPathEvaluator) + NS_INTERFACE_MAP_ENTRY(nsIDOMXPathEvaluator) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathEvaluator) + NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathEvaluator) +NS_INTERFACE_MAP_END + +nsXPathEvaluator::nsXPathEvaluator() +{ + NS_INIT_ISUPPORTS(); +} + +nsXPathEvaluator::~nsXPathEvaluator() +{ +} + +NS_IMETHODIMP +nsXPathEvaluator::CreateExpression(const nsAReadableString & aExpression, + nsIDOMXPathNSResolver *aResolver, + nsIDOMXPathExpression **aResult) +{ + String expressionString(PromiseFlatString(aExpression).get()); + // XXX (pvdb) TODO Set the right resolver on the ExprParser + Expr* expression = mParser.createExpr(expressionString); + if (!expression) + return NS_ERROR_DOM_INVALID_EXPRESSION_ERR; + + *aResult = new nsXPathExpression(expression); + if (!*aResult) { + delete expression; + return NS_ERROR_OUT_OF_MEMORY; + } + + NS_ADDREF(*aResult); + return NS_OK; +} + +NS_IMETHODIMP +nsXPathEvaluator::CreateNSResolver(nsIDOMNode *aNodeResolver, + nsIDOMXPathNSResolver **aResult) +{ + NS_ENSURE_ARG(aNodeResolver); + *aResult = new nsXPathNSResolver(aNodeResolver); + NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY); + + NS_ADDREF(*aResult); + return NS_OK; +} + +NS_IMETHODIMP +nsXPathEvaluator::Evaluate(const nsAString & aExpression, + nsIDOMNode *aContextNode, + nsIDOMXPathNSResolver *aResolver, + PRUint16 aType, + nsIDOMXPathResult *aInResult, + nsIDOMXPathResult **aResult) +{ + // XXX Need to check document of aContextNode if created by + // QI'ing a document. + + nsCOMPtr expression; + nsresult rv = CreateExpression(aExpression, aResolver, + getter_AddRefs(expression)); + NS_ENSURE_SUCCESS(rv, rv); + + return expression->Evaluate(aContextNode, aType, aInResult, aResult); +} diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathEvaluator.h b/mozilla/extensions/transformiix/source/xpath/nsXPathEvaluator.h new file mode 100644 index 00000000000..4d183d428aa --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathEvaluator.h @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsXPathEvaluator_h__ +#define nsXPathEvaluator_h__ + +#include "nsIDOMXPathEvaluator.h" +#include "ExprParser.h" + +/** + * A class for evaluating an XPath expression string + */ +class nsXPathEvaluator : public nsIDOMXPathEvaluator +{ +public: + nsXPathEvaluator(); + virtual ~nsXPathEvaluator(); + + // nsISupports interface + NS_DECL_ISUPPORTS + + // nsIDOMXPathEvaluator interface + NS_DECL_NSIDOMXPATHEVALUATOR + +private: + ExprParser mParser; +}; + +/* d0a75e02-b5e7-11d5-a7f2-df109fb8a1fc */ +#define TRANSFORMIIX_XPATH_EVALUATOR_CID \ +{ 0xd0a75e02, 0xb5e7, 0x11d5, { 0xa7, 0xf2, 0xdf, 0x10, 0x9f, 0xb8, 0xa1, 0xfc } } + +#define TRANSFORMIIX_XPATH_EVALUATOR_CONTRACTID \ +"@mozilla.org/transformiix/xpath-evaluator;1" + +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathException.cpp b/mozilla/extensions/transformiix/source/xpath/nsXPathException.cpp new file mode 100644 index 00000000000..8ebd9cb3c4d --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathException.cpp @@ -0,0 +1,282 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsXPathException.h" +#include "nsCRT.h" +#include "nsIDOMClassInfo.h" +#include "nsString.h" +#include "prprf.h" + +NS_IMPL_ISUPPORTS1(nsXPathExceptionProvider, nsIExceptionProvider) + +nsXPathExceptionProvider::nsXPathExceptionProvider() +{ + NS_INIT_ISUPPORTS(); +} + +nsXPathExceptionProvider::~nsXPathExceptionProvider() +{ +} + +NS_IMETHODIMP +nsXPathExceptionProvider::GetException(nsresult aNSResult, + nsIException *aDefaultException, + nsIException **aException) +{ + NS_ENSURE_ARG_POINTER(aException); + + *aException = new nsXPathException(aNSResult, aDefaultException); + NS_ENSURE_TRUE(*aException, NS_ERROR_OUT_OF_MEMORY); + + NS_IF_ADDREF(*aException); + + return NS_OK; +} + +NS_IMPL_ADDREF(nsXPathException) +NS_IMPL_RELEASE(nsXPathException) +NS_INTERFACE_MAP_BEGIN(nsXPathException) + NS_INTERFACE_MAP_ENTRY(nsIException) + NS_INTERFACE_MAP_ENTRY(nsIDOMXPathException) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIException) + NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathException) +NS_INTERFACE_MAP_END + +nsXPathException::nsXPathException(nsresult aNSResult, nsIException* aInner) + : mResult(aNSResult), + mInner(aInner) +{ + NS_INIT_ISUPPORTS(); +} + +nsXPathException::~nsXPathException() +{ +} + +NS_IMETHODIMP +nsXPathException::GetCode(PRUint16* aCode) +{ + NS_ENSURE_ARG_POINTER(aCode); + + if (NS_ERROR_GET_MODULE(mResult) == NS_ERROR_MODULE_DOM_XPATH) { + *aCode = NS_ERROR_GET_CODE(mResult); + } else { + NS_WARNING("Non DOM nsresult passed to a DOM exception!"); + + *aCode = (PRUint32)mResult; + } + + return NS_OK; +} + +NS_IMETHODIMP +nsXPathException::GetMessage(char **aMessage) +{ + NS_ENSURE_ARG_POINTER(aMessage); + + if (mResult == NS_ERROR_DOM_INVALID_EXPRESSION_ERR) { + *aMessage = nsCRT::strdup(NS_ERROR_DOM_INVALID_EXPRESSION_MSG); + } + else if (mResult == NS_ERROR_DOM_TYPE_ERR) { + *aMessage = nsCRT::strdup(NS_ERROR_DOM_TYPE_MSG); + } + else { + *aMessage = nsnull; + } + + return NS_OK; +} + +NS_IMETHODIMP +nsXPathException::GetResult(PRUint32* aResult) +{ + NS_ENSURE_ARG_POINTER(aResult); + + *aResult = mResult; + + return NS_OK; +} + +NS_IMETHODIMP +nsXPathException::GetName(char **aName) +{ + NS_ENSURE_ARG_POINTER(aName); + + if (mResult == NS_ERROR_DOM_INVALID_EXPRESSION_ERR) { + *aName = nsCRT::strdup("NS_ERROR_DOM_INVALID_EXPRESSION_ERR"); + } + else if (mResult == NS_ERROR_DOM_TYPE_ERR) { + *aName = nsCRT::strdup("NS_ERROR_DOM_TYPE_ERR"); + } + else { + *aName = nsnull; + } + + return NS_OK; +} + +NS_IMETHODIMP +nsXPathException::GetFilename(char **aFilename) +{ + if (mInner) { + return mInner->GetFilename(aFilename); + } + + NS_ENSURE_ARG_POINTER(aFilename); + + *aFilename = nsnull; + + return NS_OK; +} + +NS_IMETHODIMP +nsXPathException::GetLineNumber(PRUint32 *aLineNumber) +{ + if (mInner) { + return mInner->GetLineNumber(aLineNumber); + } + + NS_ENSURE_ARG_POINTER(aLineNumber); + + *aLineNumber = 0; + + return NS_OK; +} + +NS_IMETHODIMP +nsXPathException::GetColumnNumber(PRUint32 *aColumnNumber) +{ + if (mInner) { + return mInner->GetColumnNumber(aColumnNumber); + } + + NS_ENSURE_ARG_POINTER(aColumnNumber); + + *aColumnNumber = 0; + + return NS_OK; +} + +NS_IMETHODIMP +nsXPathException::GetLocation(nsIStackFrame **aLocation) +{ + if (mInner) { + return mInner->GetLocation(aLocation); + } + + NS_ENSURE_ARG_POINTER(aLocation); + + *aLocation = nsnull; + + return NS_OK; +} + +NS_IMETHODIMP +nsXPathException::GetInner(nsIException **aInner) +{ + NS_ENSURE_ARG_POINTER(aInner); + + *aInner = nsnull; + + return NS_OK; +} + +NS_IMETHODIMP +nsXPathException::GetData(nsISupports **aData) +{ + if (mInner) { + return mInner->GetData(aData); + } + + NS_ENSURE_ARG_POINTER(aData); + + *aData = nsnull; + + return NS_OK; +} + +NS_IMETHODIMP +nsXPathException::ToString(char **aReturn) +{ + *aReturn = nsnull; + + static const char defaultMsg[] = ""; + static const char defaultLocation[] = ""; + static const char defaultName[] = ""; + static const char format[] = + "[Exception... \"%s\" code: \"%d\" nsresult: \"0x%x (%s)\" location: \"%s\"]"; + + nsCAutoString location; + + if (mInner) { + nsXPIDLCString filename; + + mInner->GetFilename(getter_Copies(filename)); + + if (!filename.IsEmpty()) { + PRUint32 line_nr = 0; + + mInner->GetLineNumber(&line_nr); + + char *temp = PR_smprintf("%s Line: %d", filename.get(), line_nr); + if (temp) { + location.Assign(temp); + PR_smprintf_free(temp); + } + } + } + + if (location.IsEmpty()) { + location = defaultLocation; + } + + char* msg; + char* resultName; + PRUint16 code; + + GetMessage(&msg); + GetName(&resultName); + GetCode(&code); + + *aReturn = PR_smprintf(format, (msg ? msg : defaultMsg), code, mResult, + (resultName ? resultName : defaultName), location.get()); + + return *aReturn ? NS_OK : NS_ERROR_OUT_OF_MEMORY; +} + diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathException.h b/mozilla/extensions/transformiix/source/xpath/nsXPathException.h new file mode 100644 index 00000000000..66f8a1622fb --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathException.h @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsXPathException_h__ +#define nsXPathException_h__ + +#include "nsCOMPtr.h" +#include "nsIDOMXPathException.h" +#include "nsIException.h" +#include "nsIExceptionService.h" + +/* DOM error codes from http://www.w3.org/TR/DOM-Level-3-XPath */ + +#define NS_ERROR_DOM_INVALID_EXPRESSION_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_XPATH, 1) +#define NS_ERROR_DOM_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_XPATH, 2) + +#define NS_ERROR_DOM_INVALID_EXPRESSION_MSG "The expression is not a legal expression or it contains namespace prefixes that can't be resolved." +#define NS_ERROR_DOM_TYPE_MSG "The expression cannot be converted to return the specified type." + +class nsXPathExceptionProvider : public nsIExceptionProvider +{ +public: + nsXPathExceptionProvider(); + virtual ~nsXPathExceptionProvider(); + + // nsISupports interface + NS_DECL_ISUPPORTS + + // nsIExceptionProvider interface + NS_DECL_NSIEXCEPTIONPROVIDER +}; + +/** + * A class for evaluating an XPath expression string + */ +class nsXPathException : public nsIException, + public nsIDOMXPathException +{ +public: + nsXPathException(nsresult aNSResult, nsIException* aInner); + virtual ~nsXPathException(); + + // nsISupports interface + NS_DECL_ISUPPORTS + + // nsIException interface + NS_DECL_NSIEXCEPTION + + // nsIDOMXPathException interface + NS_DECL_NSIDOMXPATHEXCEPTION + +private: + nsresult mResult; + nsCOMPtr mInner; +}; + +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathExpression.cpp b/mozilla/extensions/transformiix/source/xpath/nsXPathExpression.cpp new file mode 100644 index 00000000000..2cca6bd2192 --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathExpression.cpp @@ -0,0 +1,154 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsXPathExpression.h" +#include "Expr.h" +#include "nsDOMError.h" +#include "nsIDOMClassInfo.h" +#include "nsIDOMXPathNamespace.h" +#include "nsXPathResult.h" +#include "ProcessorState.h" + +NS_IMPL_ADDREF(nsXPathExpression) +NS_IMPL_RELEASE(nsXPathExpression) +NS_INTERFACE_MAP_BEGIN(nsXPathExpression) + NS_INTERFACE_MAP_ENTRY(nsIDOMXPathExpression) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathExpression) + NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathExpression) +NS_INTERFACE_MAP_END + +nsXPathExpression::nsXPathExpression(Expr* aExpression) : mExpression(aExpression) +{ + NS_INIT_ISUPPORTS(); +} + +nsXPathExpression::~nsXPathExpression() +{ + delete mExpression; +} + +NS_IMETHODIMP +nsXPathExpression::Evaluate(nsIDOMNode *aContextNode, + PRUint16 aType, + nsIDOMXPathResult *aInResult, + nsIDOMXPathResult **aResult) +{ + NS_ENSURE_ARG(aContextNode); + + nsresult rv; + PRUint16 nodeType; + rv = aContextNode->GetNodeType(&nodeType); + NS_ENSURE_SUCCESS(rv, rv); + + if (nodeType == nsIDOMNode::TEXT_NODE || + nodeType == nsIDOMNode::CDATA_SECTION_NODE) { + nsCOMPtr textNode = do_QueryInterface(aContextNode); + NS_ENSURE_TRUE(textNode, NS_ERROR_FAILURE); + + if (textNode) { + PRUint32 textLength; + textNode->GetLength(&textLength); + if (textLength == 0) + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; + } + + // XXX Need to get logical XPath text node for CDATASection + // and Text nodes. + } + else if (nodeType != nsIDOMNode::DOCUMENT_NODE && + nodeType != nsIDOMNode::ELEMENT_NODE && + nodeType != nsIDOMNode::ATTRIBUTE_NODE && + nodeType != nsIDOMNode::COMMENT_NODE && + nodeType != nsIDOMNode::PROCESSING_INSTRUCTION_NODE && + nodeType != nsIDOMXPathNamespace::XPATH_NAMESPACE_NODE) { + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; + } + + NS_ENSURE_ARG(aResult); + *aResult = nsnull; + + nsCOMPtr ownerDOMDocument; + aContextNode->GetOwnerDocument(getter_AddRefs(ownerDOMDocument)); + if (!ownerDOMDocument) { + ownerDOMDocument = do_QueryInterface(aContextNode); + NS_ENSURE_TRUE(ownerDOMDocument, NS_ERROR_FAILURE); + } + Document document(ownerDOMDocument); + Node* node = document.createWrapper(aContextNode); + + ProcessorState processorState; + ExprResult* exprResult = mExpression->evaluate(node, &processorState); + NS_ENSURE_TRUE(exprResult, NS_ERROR_OUT_OF_MEMORY); + + PRUint16 resultType = aType; + if (aType == nsIDOMXPathResult::ANY_TYPE) { + short exprResultType = exprResult->getResultType(); + switch (exprResultType) { + case ExprResult::NUMBER: + resultType = nsIDOMXPathResult::NUMBER_TYPE; + break; + case ExprResult::STRING: + resultType = nsIDOMXPathResult::STRING_TYPE; + break; + case ExprResult::BOOLEAN: + resultType = nsIDOMXPathResult::BOOLEAN_TYPE; + break; + case ExprResult::NODESET: + resultType = nsIDOMXPathResult::UNORDERED_NODE_ITERATOR_TYPE; + break; + case ExprResult::TREE_FRAGMENT: + NS_ERROR("Can't return a tree fragment!"); + delete exprResult; + return NS_ERROR_FAILURE; + } + } + + // We need a result object and it must be our implementation. + nsCOMPtr xpathResult = do_QueryInterface(aInResult); + if (!xpathResult) { + // Either no aInResult or not one of ours. + xpathResult = new nsXPathResult(); + NS_ENSURE_TRUE(xpathResult, NS_ERROR_OUT_OF_MEMORY); + } + rv = xpathResult->SetExprResult(exprResult, resultType); + delete exprResult; + NS_ENSURE_SUCCESS(rv, rv); + + return CallQueryInterface(xpathResult, aResult); +} diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathExpression.h b/mozilla/extensions/transformiix/source/xpath/nsXPathExpression.h new file mode 100644 index 00000000000..4f52676d5f7 --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathExpression.h @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsXPathExpression_h__ +#define nsXPathExpression_h__ + +#include "nsIDOMXPathExpression.h" + +class Expr; + +/** + * A class for evaluating an XPath expression string + */ +class nsXPathExpression : public nsIDOMXPathExpression +{ +public: + nsXPathExpression(Expr* aExpression); + virtual ~nsXPathExpression(); + + // nsISupports interface + NS_DECL_ISUPPORTS + + // nsIDOMXPathExpression interface + NS_DECL_NSIDOMXPATHEXPRESSION + +private: + Expr* mExpression; +}; + +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.cpp b/mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.cpp new file mode 100644 index 00000000000..d57392ffd9d --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.cpp @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsXPathNSResolver.h" +#include "nsIDOMClassInfo.h" + +NS_IMPL_ADDREF(nsXPathNSResolver) +NS_IMPL_RELEASE(nsXPathNSResolver) +NS_INTERFACE_MAP_BEGIN(nsXPathNSResolver) + NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNSResolver) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathNSResolver) + NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathNSResolver) +NS_INTERFACE_MAP_END + +nsXPathNSResolver::nsXPathNSResolver(nsIDOMNode* aNode) +{ + NS_INIT_ISUPPORTS(); + mNode = do_QueryInterface(aNode); + NS_ASSERTION(mNode, "Need a node to resolve namespaces."); +} + +nsXPathNSResolver::~nsXPathNSResolver() +{ +} + +NS_IMETHODIMP +nsXPathNSResolver::LookupNamespaceURI(const nsAString & aPrefix, + nsAString & aResult) +{ + if (mNode) + return mNode->LookupNamespaceURI(aPrefix, aResult); + SetDOMStringToNull(aResult); + return NS_OK; +} diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.h b/mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.h new file mode 100644 index 00000000000..5d4226b6b51 --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.h @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsXPathNSResolver_h__ +#define nsXPathNSResolver_h__ + +#include "nsIDOMXPathNSResolver.h" +#include "nsIDOMNode.h" +#include "nsCOMPtr.h" + +/** + * A class for evaluating an XPath expression string + */ +class nsXPathNSResolver : public nsIDOMXPathNSResolver +{ +public: + nsXPathNSResolver(nsIDOMNode* aNode); + virtual ~nsXPathNSResolver(); + + // nsISupports interface + NS_DECL_ISUPPORTS + + // nsIDOMXPathNSResolver interface + NS_DECL_NSIDOMXPATHNSRESOLVER + +private: + nsCOMPtr mNode; +}; + +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathNamespace.cpp b/mozilla/extensions/transformiix/source/xpath/nsXPathNamespace.cpp new file mode 100644 index 00000000000..e03bd9fb761 --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathNamespace.cpp @@ -0,0 +1,212 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsXPathNamespace.h" +#include "nsIDOMClassInfo.h" + +NS_IMPL_ADDREF(nsXPathNamespace) +NS_IMPL_RELEASE(nsXPathNamespace) +NS_INTERFACE_MAP_BEGIN(nsXPathNamespace) + NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNamespace) + NS_INTERFACE_MAP_ENTRY(nsIDOMNode) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathNamespace) + NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathNamespace) +NS_INTERFACE_MAP_END + +nsXPathNamespace::nsXPathNamespace() +{ + NS_INIT_ISUPPORTS(); +} + +nsXPathNamespace::~nsXPathNamespace() +{ +} + +/* readonly attribute DOMString nodeName; */ +NS_IMETHODIMP nsXPathNamespace::GetNodeName(nsAString & aNodeName) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* attribute DOMString nodeValue; */ +NS_IMETHODIMP nsXPathNamespace::GetNodeValue(nsAString & aNodeValue) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} +NS_IMETHODIMP nsXPathNamespace::SetNodeValue(const nsAString & aNodeValue) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute unsigned short nodeType; */ +NS_IMETHODIMP nsXPathNamespace::GetNodeType(PRUint16 *aNodeType) +{ + *aNodeType = XPATH_NAMESPACE_NODE; + return NS_OK; +} + +/* readonly attribute nsIDOMNode parentNode; */ +NS_IMETHODIMP nsXPathNamespace::GetParentNode(nsIDOMNode * *aParentNode) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMNodeList childNodes; */ +NS_IMETHODIMP nsXPathNamespace::GetChildNodes(nsIDOMNodeList * *aChildNodes) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMNode firstChild; */ +NS_IMETHODIMP nsXPathNamespace::GetFirstChild(nsIDOMNode * *aFirstChild) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMNode lastChild; */ +NS_IMETHODIMP nsXPathNamespace::GetLastChild(nsIDOMNode * *aLastChild) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMNode previousSibling; */ +NS_IMETHODIMP nsXPathNamespace::GetPreviousSibling(nsIDOMNode * *aPreviousSibling) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMNode nextSibling; */ +NS_IMETHODIMP nsXPathNamespace::GetNextSibling(nsIDOMNode * *aNextSibling) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMNamedNodeMap attributes; */ +NS_IMETHODIMP nsXPathNamespace::GetAttributes(nsIDOMNamedNodeMap * *aAttributes) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMDocument ownerDocument; */ +NS_IMETHODIMP nsXPathNamespace::GetOwnerDocument(nsIDOMDocument * *aOwnerDocument) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMNode insertBefore (in nsIDOMNode newChild, in nsIDOMNode refChild) raises (DOMException); */ +NS_IMETHODIMP nsXPathNamespace::InsertBefore(nsIDOMNode *newChild, nsIDOMNode *refChild, nsIDOMNode **aResult) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMNode replaceChild (in nsIDOMNode newChild, in nsIDOMNode oldChild) raises (DOMException); */ +NS_IMETHODIMP nsXPathNamespace::ReplaceChild(nsIDOMNode *newChild, nsIDOMNode *oldChild, nsIDOMNode **aResult) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMNode removeChild (in nsIDOMNode oldChild) raises (DOMException); */ +NS_IMETHODIMP nsXPathNamespace::RemoveChild(nsIDOMNode *oldChild, nsIDOMNode **aResult) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMNode appendChild (in nsIDOMNode newChild) raises (DOMException); */ +NS_IMETHODIMP nsXPathNamespace::AppendChild(nsIDOMNode *newChild, nsIDOMNode **aResult) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* boolean hasChildNodes (); */ +NS_IMETHODIMP nsXPathNamespace::HasChildNodes(PRBool *aResult) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMNode cloneNode (in boolean deep); */ +NS_IMETHODIMP nsXPathNamespace::CloneNode(PRBool deep, nsIDOMNode **aResult) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* void normalize (); */ +NS_IMETHODIMP nsXPathNamespace::Normalize() +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* boolean isSupported (in DOMString feature, in DOMString version); */ +NS_IMETHODIMP nsXPathNamespace::IsSupported(const nsAString & feature, const nsAString & version, PRBool *aResult) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute DOMString namespaceURI; */ +NS_IMETHODIMP nsXPathNamespace::GetNamespaceURI(nsAString & aNamespaceURI) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* attribute DOMString prefix; */ +NS_IMETHODIMP nsXPathNamespace::GetPrefix(nsAString & aPrefix) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} +NS_IMETHODIMP nsXPathNamespace::SetPrefix(const nsAString & aPrefix) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute DOMString localName; */ +NS_IMETHODIMP nsXPathNamespace::GetLocalName(nsAString & aLocalName) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* boolean hasAttributes (); */ +NS_IMETHODIMP nsXPathNamespace::HasAttributes(PRBool *aResult) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMElement ownerElement; */ +NS_IMETHODIMP nsXPathNamespace::GetOwnerElement(nsIDOMElement * *aOwnerElement) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathNamespace.h b/mozilla/extensions/transformiix/source/xpath/nsXPathNamespace.h new file mode 100644 index 00000000000..823463aaaee --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathNamespace.h @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsXPathNamespace_h__ +#define nsXPathNamespace_h__ + +#include "nsIDOMXPathNamespace.h" + +/* d0a75e07-b5e7-11d5-a7f2-df109fb8a1fc */ +#define TRANSFORMIIX_XPATH_NAMESPACE_CID \ +{ 0xd0a75e07, 0xb5e7, 0x11d5, { 0xa7, 0xf2, 0xdf, 0x10, 0x9f, 0xb8, 0xa1, 0xfc } } + +#define TRANSFORMIIX_XPATH_NAMESPACE_CONTRACTID \ +"@mozilla.org/transformiix/xpath-namespace;1" + +/** + * A class for representing XPath namespace nodes in the DOM. + */ +class nsXPathNamespace : public nsIDOMXPathNamespace +{ +public: + nsXPathNamespace(); + virtual ~nsXPathNamespace(); + + // nsISupports interface + NS_DECL_ISUPPORTS + + // nsIDOMNode interface + NS_DECL_NSIDOMNODE + + // nsIDOMXPathNamespace interface + NS_DECL_NSIDOMXPATHNAMESPACE +}; + +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathResult.cpp b/mozilla/extensions/transformiix/source/xpath/nsXPathResult.cpp new file mode 100644 index 00000000000..43ad405f14f --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathResult.cpp @@ -0,0 +1,472 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsXPathResult.h" +#include "ExprResult.h" +#include "NodeSet.h" +#include "nsDOMError.h" +#include "nsIContent.h" +#include "nsIDOMClassInfo.h" +#include "nsSupportsArray.h" +#include "nsXPathException.h" + +NS_IMPL_ADDREF(nsXPathResult) +NS_IMPL_RELEASE(nsXPathResult) +NS_INTERFACE_MAP_BEGIN(nsXPathResult) + NS_INTERFACE_MAP_ENTRY(nsIDOMXPathResult) + NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver) + NS_INTERFACE_MAP_ENTRY(nsIXPathResult) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathResult) + NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathResult) +NS_INTERFACE_MAP_END + +nsXPathResult::nsXPathResult() : mNumberValue(0), + mDocument(0), + mCurrentPos(0), + mResultType(ANY_TYPE), + mInvalidIteratorState(PR_TRUE) +{ + NS_INIT_ISUPPORTS(); +} + +nsXPathResult::~nsXPathResult() +{ + Reset(); +} + +NS_IMETHODIMP +nsXPathResult::GetResultType(PRUint16 *aResultType) +{ + NS_ENSURE_ARG(aResultType); + *aResultType = mResultType; + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::GetNumberValue(double *aNumberValue) +{ + if (mResultType != NUMBER_TYPE) + return NS_ERROR_DOM_TYPE_ERR; + + NS_ENSURE_ARG(aNumberValue); + *aNumberValue = mNumberValue; + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::GetStringValue(nsAString &aStringValue) +{ + if (mResultType != STRING_TYPE) + return NS_ERROR_DOM_TYPE_ERR; + + if (mStringValue) + aStringValue.Assign(mStringValue->getConstNSString()); + else + SetDOMStringToNull(aStringValue); + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::GetBooleanValue(PRBool *aBooleanValue) +{ + if (mResultType != BOOLEAN_TYPE) + return NS_ERROR_DOM_TYPE_ERR; + + NS_ENSURE_ARG(aBooleanValue); + *aBooleanValue = mBooleanValue; + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::GetSingleNodeValue(nsIDOMNode **aSingleNodeValue) +{ + if (mResultType != FIRST_ORDERED_NODE_TYPE && + mResultType != ANY_UNORDERED_NODE_TYPE) + return NS_ERROR_DOM_TYPE_ERR; + + NS_ENSURE_ARG(aSingleNodeValue); + *aSingleNodeValue = mNode; + NS_IF_ADDREF(*aSingleNodeValue); + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::GetInvalidIteratorState(PRBool *aInvalidIteratorState) +{ + NS_ENSURE_ARG(aInvalidIteratorState); + + if (mResultType != UNORDERED_NODE_ITERATOR_TYPE && + mResultType != ORDERED_NODE_ITERATOR_TYPE) { + *aInvalidIteratorState = PR_FALSE; + return NS_OK; + } + + *aInvalidIteratorState = mInvalidIteratorState; + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::GetSnapshotLength(PRUint32 *aSnapshotLength) +{ + if (mResultType != UNORDERED_NODE_SNAPSHOT_TYPE && + mResultType != ORDERED_NODE_SNAPSHOT_TYPE) + return NS_ERROR_DOM_TYPE_ERR; + + NS_ENSURE_ARG(aSnapshotLength); + if (mElements) + return mElements->Count(aSnapshotLength); + *aSnapshotLength = 0; + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::IterateNext(nsIDOMNode **aResult) +{ + if (mResultType != UNORDERED_NODE_ITERATOR_TYPE && + mResultType != ORDERED_NODE_ITERATOR_TYPE) + return NS_ERROR_DOM_TYPE_ERR; + + if (mDocument) + mDocument->FlushPendingNotifications(PR_FALSE); + + if (mInvalidIteratorState) + return NS_ERROR_DOM_INVALID_STATE_ERR; + + NS_ENSURE_ARG(aResult); + if (mElements) { + PRUint32 count; + mElements->Count(&count); + if (mCurrentPos < count) { + return mElements->QueryElementAt(mCurrentPos++, + NS_GET_IID(nsIDOMNode), + (void**)aResult); + } + } + *aResult = nsnull; + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::SnapshotItem(PRUint32 aIndex, nsIDOMNode **aResult) +{ + if (mResultType != UNORDERED_NODE_SNAPSHOT_TYPE && + mResultType != ORDERED_NODE_SNAPSHOT_TYPE) + return NS_ERROR_DOM_TYPE_ERR; + + NS_ENSURE_ARG(aResult); + if (mElements) { + PRUint32 count; + mElements->Count(&count); + if (aIndex < count) { + return mElements->QueryElementAt(aIndex, + NS_GET_IID(nsIDOMNode), + (void**)aResult); + } + } + *aResult = nsnull; + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::BeginUpdate(nsIDocument* aDocument) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::EndUpdate(nsIDocument* aDocument) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::BeginLoad(nsIDocument* aDocument) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::EndLoad(nsIDocument* aDocument) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::BeginReflow(nsIDocument* aDocument, + nsIPresShell* aShell) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::EndReflow(nsIDocument* aDocument, + nsIPresShell* aShell) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::ContentChanged(nsIDocument* aDocument, + nsIContent *aContent, + nsISupports *aSubContent) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::ContentStatesChanged(nsIDocument* aDocument, + nsIContent* aContent1, + nsIContent* aContent2, + nsIAtom* aChangedPseudoClass) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::AttributeChanged(nsIDocument* aDocument, + nsIContent* aContent, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType, + PRInt32 aHint) +{ + Invalidate(); + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::ContentAppended(nsIDocument* aDocument, + nsIContent* aContainer, + PRInt32 aNewIndexInContainer) +{ + Invalidate(); + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::ContentInserted(nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aChild, + PRInt32 aIndexInContainer) +{ + Invalidate(); + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::ContentReplaced(nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aOldChild, + nsIContent* aNewChild, + PRInt32 aIndexInContainer) +{ + Invalidate(); + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::ContentRemoved(nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aChild, + PRInt32 aIndexInContainer) +{ + Invalidate(); + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::StyleSheetAdded(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::StyleSheetRemoved(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::StyleSheetDisabledStateChanged(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet, + PRBool aDisabled) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::StyleRuleChanged(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule, + PRInt32 aHint) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::StyleRuleAdded(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::StyleRuleRemoved(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::DocumentWillBeDestroyed(nsIDocument* aDocument) +{ + Invalidate(); + return NS_OK; +} + +NS_IMETHODIMP +nsXPathResult::SetExprResult(ExprResult* aExprResult, PRUint16 aResultType) +{ + Reset(); + + mResultType = aResultType; + + if (mResultType == NUMBER_TYPE) { + mNumberValue = aExprResult->numberValue(); + return NS_OK; + } + + if (mResultType == STRING_TYPE) { + mStringValue = new String; + NS_ENSURE_TRUE(mStringValue, NS_ERROR_OUT_OF_MEMORY); + aExprResult->stringValue(*mStringValue); + return NS_OK; + } + + if (mResultType == BOOLEAN_TYPE) { + mBooleanValue = aExprResult->booleanValue(); + return NS_OK; + } + + if (aExprResult->getResultType() == ExprResult::NODESET) { + nsresult rv = NS_OK; + NodeSet* nodeSet = (NodeSet*)aExprResult; + + if (mResultType == FIRST_ORDERED_NODE_TYPE || + mResultType == ANY_UNORDERED_NODE_TYPE) { + Node* node = nodeSet->get(0); + if (node) + rv = CallQueryInterface(node->getNSObj(), &mNode); + } + else { + if (mResultType == UNORDERED_NODE_ITERATOR_TYPE || + mResultType == ORDERED_NODE_ITERATOR_TYPE) { + mInvalidIteratorState = PR_FALSE; + } + + int count = nodeSet->size(); + if (count == 0) + return NS_OK; + + NS_NewISupportsArray(&mElements); + NS_ENSURE_TRUE(mElements, NS_ERROR_OUT_OF_MEMORY); + + nsISupports* mozNode = nsnull; + int i; + for (i = 0; i < count; ++i) { + mozNode = nodeSet->get(i)->getNSObj(); + mElements->AppendElement(mozNode); + NS_ADDREF(mozNode); + } + if (mResultType == UNORDERED_NODE_ITERATOR_TYPE || + mResultType == ORDERED_NODE_ITERATOR_TYPE) { + nsCOMPtr content = do_QueryInterface(mozNode); + if (content) + content->GetDocument(*getter_AddRefs(mDocument)); + else + mDocument = do_QueryInterface(mozNode); + NS_ASSERTION(mDocument, "We need a document!"); + if (mDocument) + mDocument->AddObserver(this); + } + } + return rv; + } + + return NS_ERROR_DOM_TYPE_ERR; +} + +void +nsXPathResult::Invalidate() +{ + if (mDocument) { + mDocument->RemoveObserver(this); + mDocument = 0; + } + mInvalidIteratorState = PR_TRUE; +} + +void +nsXPathResult::Reset() +{ + Invalidate(); + + if (mResultType == STRING_TYPE) { + delete mStringValue; + mStringValue = 0; + } + else if (mResultType == UNORDERED_NODE_ITERATOR_TYPE || + mResultType == ORDERED_NODE_ITERATOR_TYPE || + mResultType == UNORDERED_NODE_SNAPSHOT_TYPE || + mResultType == ORDERED_NODE_SNAPSHOT_TYPE) { + NS_IF_RELEASE(mElements); + mCurrentPos = 0; + } + else if (mResultType == FIRST_ORDERED_NODE_TYPE || + mResultType == ANY_UNORDERED_NODE_TYPE) { + NS_IF_RELEASE(mNode); + } + + mResultType = ANY_TYPE; + return; +} diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathResult.h b/mozilla/extensions/transformiix/source/xpath/nsXPathResult.h new file mode 100644 index 00000000000..c620dd52b48 --- /dev/null +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathResult.h @@ -0,0 +1,158 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsXPathResult_h__ +#define nsXPathResult_h__ + +#include "nsIDOMXPathResult.h" +#include "nsIDocument.h" +#include "nsIDocumentObserver.h" +#include "nsCOMPtr.h" + +class ExprResult; +class String; +class nsISupportsArray; + +// {15b9b301-2012-11d6-a7f2-e6d0a678995c} +#define NS_IXPATHRESULT_IID \ +{ 0x15b9b301, 0x2012, 0x11d6, {0xa7, 0xf2, 0xe6, 0xd0, 0xa6, 0x78, 0x99, 0x5c }}; + +class nsIXPathResult : public nsISupports +{ +public: + NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXPATHRESULT_IID) + NS_IMETHOD SetExprResult(ExprResult* aExprResult, + PRUint16 aResultType) = 0; +}; + +/** + * A class for evaluating an XPath expression string + */ +class nsXPathResult : public nsIDOMXPathResult, + public nsIDocumentObserver, + public nsIXPathResult +{ +public: + nsXPathResult(); + virtual ~nsXPathResult(); + + // nsISupports interface + NS_DECL_ISUPPORTS + + // nsIDOMXPathResult interface + NS_DECL_NSIDOMXPATHRESULT + + // nsIDocumentObserver interface + NS_IMETHOD BeginUpdate(nsIDocument* aDocument); + NS_IMETHOD EndUpdate(nsIDocument* aDocument); + NS_IMETHOD BeginLoad(nsIDocument* aDocument); + NS_IMETHOD EndLoad(nsIDocument* aDocument); + NS_IMETHOD BeginReflow(nsIDocument* aDocument, + nsIPresShell* aShell); + NS_IMETHOD EndReflow(nsIDocument* aDocument, + nsIPresShell* aShell); + NS_IMETHOD ContentChanged(nsIDocument* aDocument, + nsIContent* aContent, + nsISupports* aSubContent); + NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument, + nsIContent* aContent1, + nsIContent* aContent2, + nsIAtom* aChangedPseudoClass); + NS_IMETHOD AttributeChanged(nsIDocument* aDocument, + nsIContent* aContent, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType, + PRInt32 aHint); + NS_IMETHOD ContentAppended(nsIDocument* aDocument, + nsIContent* aContainer, + PRInt32 aNewIndexInContainer); + NS_IMETHOD ContentInserted(nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aChild, + PRInt32 aIndexInContainer); + NS_IMETHOD ContentReplaced(nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aOldChild, + nsIContent* aNewChild, + PRInt32 aIndexInContainer); + NS_IMETHOD ContentRemoved(nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aChild, + PRInt32 aIndexInContainer); + NS_IMETHOD StyleSheetAdded(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet); + NS_IMETHOD StyleSheetRemoved(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet); + NS_IMETHOD StyleSheetDisabledStateChanged(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet, + PRBool aDisabled); + NS_IMETHOD StyleRuleChanged(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule, + PRInt32 aHint); + NS_IMETHOD StyleRuleAdded(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule); + NS_IMETHOD StyleRuleRemoved(nsIDocument* aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule); + NS_IMETHOD DocumentWillBeDestroyed(nsIDocument* aDocument); + + // nsIXPathResult interface + NS_IMETHOD SetExprResult(ExprResult* aExprResult, + PRUint16 aResultType); +private: + void Invalidate(); + void Reset(); + + union { + double mNumberValue; + String* mStringValue; + PRBool mBooleanValue; + nsIDOMNode* mNode; + nsISupportsArray* mElements; + }; + nsCOMPtr mDocument; + PRUint32 mCurrentPos; + PRUint16 mResultType; + PRPackedBool mInvalidIteratorState; +}; + +#endif