首页 \ 问答 \ 查询XML CLOB列以获取列中的子XML(Query XML CLOB column to get sub XML in the column)

查询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.substrdbms_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
更新时间:2022-06-19 08:06

最满意答案

您没有提到您正在使用的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 DirectoryTarget NameTarget 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 be

echo 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.

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)