查询XML CLOB列以获取列中的子XML(Query XML CLOB column to get sub XML in the column)
我的表中有一个包含XML的CLOB列。 我想要获取特定标签后的xml结尾标签即
CLOB列中的完整XML
<ParentTag> <Location>ABC XYZ ....</Location> <Person> <Name>Mohsin</Name> <Age>23</Age> </Person> </ParentTag>
我想要获取的是这样的:
<Person> <Name>Mohsin</Name> <Age>23</Age> </Person>
我试图使用dbms_lob.substr和dbms_lob.getlength,但这没有帮助,因为子XML可能包含从不同场景中的不同字节开始的
<Person>
标记。任何帮助将不胜感激。 谢谢
I have a CLOB column in my table which contains an XML. I want to fetch the xml after a specific tag to its ending tag i.e
Full XML in CLOB column
<ParentTag> <Location>ABC XYZ ....</Location> <Person> <Name>Mohsin</Name> <Age>23</Age> </Person> </ParentTag>
What I am trying to fetch is something like this:
<Person> <Name>Mohsin</Name> <Age>23</Age> </Person>
I have tried to use dbms_lob.substr and dbms_lob.getlength but that doesnt help as the sub XML may contain the
<Person>
tag starting at different bytes in different scenarios.Any help would be greatly appreciated. Thanks
原文:https://stackoverflow.com/questions/37077932
最满意答案
您没有提到您正在使用的Visual Studio版本。 从内存来看,答案并没有太大变化,但我会回答Visual Studio 2015,因为这就是我的方便。
探索适用于所有Visual Studio版本的宏值的一种方法是使用
ECHO
命令。 将您的构建后脚本更改为echo TargetPath: "$(TargetPath)"
并且您应该能够在构建项目时在“输出”窗口中读取宏的值。 在大多数现代版本的Visual Studio中,不应该使用
Echo
技巧。在Post-Build Event属性页面中,单击Command Line字段末尾的下拉列表,然后单击<Edit ...>。 在Visual Studio 2015中,随后出现的对话框将显示命令行和评估值,以便您可以查看扩展了宏的命令行。
还有Macros >>按钮。 单击该按钮,您将看到一个对话框,显示每个宏名称及其值。 列表顶部的文本框允许您将结果过滤到包含字符序列的结果。
$(TargetPath)
在此描述为“构建的主输出文件的绝对路径名(定义为驱动器+路径+基本名称+文件扩展名)” 。 这实际上意味着General属性页面上的Output Directory , Target Name和Target Extension属性的值。这里描述了 LIB工具。 要获得有关LIB运行的更多信息,您可以添加/ VERBOSE选项。 您也可以删除/ NOLOGO选项,这样您至少可以确认您正在运行LIB(并运行正确版本的LIB)。
很难说什么“无所作为”真正意味着什么。 我猜最可能的失败是要创建lib文件 - 但不是你期望的; 或者$(ProjectDir)\ Source中没有obj文件。
探索后一种情况的一种方法是将您的构建后事件更改为
dir "$(ProjectDir)\Source\*.obj"
然后检查构建输出以查看是否列出了obj文件。 如果目录中没有.obj文件,则输出窗口将显示类似的内容
1> Directory of C:\TestPrograms\vc.net.2015\VCConsole 1> 1> File Not Found
并且错误列表窗口将显示dir命令退出,代码为1。
You don't mention what version of Visual Studio you are working with. From memory the answer doesn't change very much but I'll answer for Visual Studio 2015 because that's what I've got handy.
One way to explore macro values that should work for all Visual Studio versions is to use the
ECHO
command. Change your post-build script to beecho TargetPath: "$(TargetPath)"
and you should be able to read the value of the macro in the Output window when you build the project. In most modern versions of Visual Studio, the
Echo
trick shouldn't be necessary however.In the Post-Build Event property page click on the drop-down at the end of the Command Line field and then click on < Edit...>. In Visual Studio 2015 the ensuing dialog will show you the command line(s) and the evaluated value so that you can see the command line(s) with the macros expanded.
There's also the Macros>> button. Click on that button and you'll get a dialog that shows every macro name and its value. The text box at the top of the list lets you filter results to those that contain a character sequence.
$(TargetPath)
is described here as "The absolute path name of the primary output file for the build (defined as drive + path + base name + file extension)". What that really means is the value of the Output Directory, Target Name, and Target Extension properties on the General property page.The LIB tool is described here. To get more information on the LIB run you could add the /VERBOSE option. You might also remove the /NOLOGO option so you at least get confirmation that you are running LIB (and running the correct version of LIB).
It's difficult to tell what "does nothing" really means. I'd guess the most likely failures are either the lib file is being created - but not where you expect; or there are no obj files in $(ProjectDir)\Source.
One way to explore that latter case would be to change your post-build event to
dir "$(ProjectDir)\Source\*.obj"
and then examine the build output to see if there are obj files listed. If there are no .obj files in the directory the Output Window will show something similar to
1> Directory of C:\TestPrograms\vc.net.2015\VCConsole 1> 1> File Not Found
and the Error List window will show that the dir command exited with code 1.
相关问答
更多-
Post-Build脚本在VIsual Studio 2010中引发错误(Post-Build script throws error in VIsual Studio 2010)[2022-02-28]
这应该更接近: if not exist "$(SolutionDir)lib" md "$(SolutionDir)lib" xcopy /y /d "$(TargetPath)" "$(SolutionDir)lib" This ought to be closer: if not exist "$(SolutionDir)lib" md "$(SolutionDir)lib" xcopy /y /d "$(TargetPath)" "$(SolutionDir)lib" -
我建议您添加一些简单的跟踪来尝试解决问题所在。 但是在脚本开头放置一个Write-Host "Checkpoint 1 $(get-date -DisplayHint Time)" ,然后将其他人放在关键部分之间。 我的猜测是问题是Get-Process花费的时间比你想象的要长。 一种可能性是加载默认配置文件/模块需要很长时间。 对于它的价值,我们在MSBuild / VS项目中使用powershell脚本,并没有这种问题。 Installed PowerShell 3.0, reinstalled VS ...
-
您可以根据需要输入尽可能多的后期制作命令。 只需用换行符分隔它们。 这是我的一个项目的例子。 You can type in as many post build commands as you want. Just separate them by newlines. Here's an example from one of my projects.
-
听起来你需要在路径上放置双引号。 例如: jsmin <“$(ProjectDir)\ debug.js”>“$(ProjectDir)\ min.js” Sounds like you need to put double-quotes around the path. e.g.: jsmin <"$(ProjectDir)\debug.js" >"$(ProjectDir)\min.js"
-
事实证明,解决方案中的构建配置非常巧妙。 我用手纠正了它们。 {31173859-02F5-4CFC-BD9A-C7BA45F8A7B7}.Dev|Any CPU.ActiveCfg = Dev|Any CPU {31173859-02F5-4CFC-BD9A-C7BA45F8A7B7}.Dev|Any CPU.Build.0 = Dev|Any CPU {31173859-02F5-4CFC-BD9A-C7BA45F8A7B7}.Dev|Mixed Platforms.ActiveCfg = Dev|An ...
-
Visual Studio 2010后生成步骤中的Powershell脚本(Powershell script in Visual Studio 2010 Post-Build Step)[2023-05-19]
变量$(SolutionDir) ,因为它是一个目录结尾反斜杠'\'。 因此,当变量被展开时, -SolutionDir "$(SolutionDir)"的参数如下所示: -SolutionDir "c:\Your Solution Dir\" 当这个被解析时,最后一个斜杠实际上逃避了最后的引用,并且shell解析器没有看到参数的结尾,所以-SolutionDir的参数将-SolutionDir的参数“吸入”到了SolutionDir参数中。 您可以通过添加一个尾部斜线来避免使用另一个反斜杠来解决这个问题 ... -
当我需要解决后期构建事件时,我添加了一个ECHO ON,并且通常做一个DIR,所以我可以看到我在哪个目录。 When I need to trouble shoot post build events I add an ECHO ON, and generally do a DIR so I can see what directory I am in.
-
据我所知,您无法在VS后期构建事件中将外部文件读入变量。 但是,您可以运行外部批处理文件并为其提供参数。 这允许我们通过从源代码控制中排除这些脚本来执行每个开发人员的构建后批处理脚本,然后在构建后事件中检查它们是否存在并在它们存在时执行它们,如下所示: CD "$(ProjectDir)" IF EXIST postBuild.bat ( @ECHO Post-build script exists at: $(ProjectDir)postBuild.bat - executing... CALL "$( ...
-
在Visual Studio中使用post-build事件构建控制台(Console build with post-build events in Visual Studio)[2021-08-07]
将我的评论转化为答案 您可以使用CMake的--build 命令行选项 (它确实抽象make / msbuild / ninja ...调用),例如: cmake --build . --target INSTALL --config Release Turning my comment into an answer You can use CMake's --build command line option (which does abstract the make/msbuild/ninja... ... -
如何在visual studio中正确设置我的后期构建脚本(How to correctly setup my post-build script in visual studio)[2024-01-15]
您没有提到您正在使用的Visual Studio版本。 从内存来看,答案并没有太大变化,但我会回答Visual Studio 2015,因为这就是我的方便。 探索适用于所有Visual Studio版本的宏值的一种方法是使用ECHO命令。 将您的构建后脚本更改为 echo TargetPath: "$(TargetPath)" 并且您应该能够在构建项目时在“输出”窗口中读取宏的值。 在大多数现代版本的Visual Studio中,不应该使用Echo技巧。 在Post-Build Event属性页面中,单击 ...