logo
down
shadow

Parent xml in sql query, xpath


Parent xml in sql query, xpath

By : user6066516
Date : November 28 2020, 11:01 PM
will be helpful for those in need The extract function is deprecated; you can use it for this but it's better to use XMLQuery/XMLTable, e.g. assuming get_xml is a function that returns your properly-formatted XML as an XMLType:
code :
select *
from xmltable('/persons/person/version'
  passing get_xml
  columns person_code varchar2(10) path './../@code',
    type_code varchar2(10) path './../type/@code',
    version_code number path '@code',
    version_datefrom date path '@dateFrom'
);
select *
from xmltable('/persons/person/version'
  passing xmltype('<persons>
  <person code="SNIPER">
    <type code="SINGLE" />
    <version code="1" dateFrom="2015-03-20" />
    <version code="2" dateFrom="2012-06-15" />
  </person>
</persons>')
  columns person_code varchar2(10) path './../@code',
    type_code varchar2(10) path './../type/@code',
    version_code number path '@code',
    version_datefrom date path '@dateFrom'
);

PERSON_COD TYPE_CODE  VERSION_CODE VERSION_DA
---------- ---------- ------------ ----------
SNIPER     SINGLE                1 2015-03-20
SNIPER     SINGLE                2 2012-06-15
select person_code, type_code, version_code,
  cast(version_datefrom as date) as version_datefrom
from xmltable('/persons/person/version'
  passing xmltype('<persons>
  <person code="SNIPER">
    <type code="SINGLE" />
    <version code="1" dateFrom="2015-03-20T12:34:56+04:00" />
    <version code="2" dateFrom="2012-06-15T23:00:00+00:00" />
  </person>
</persons>')
  columns person_code varchar2(10) path './../@code',
    type_code varchar2(10) path './../type/@code',
    version_code number path '@code',
    version_datefrom timestamp with time zone path '@dateFrom'
);


Share : facebook icon twitter icon
Query DOMElement's parent - XPath

Query DOMElement's parent - XPath


By : Thanapat Tummati
Date : March 29 2020, 07:55 AM
may help you . DOMXPath's constructor requires you pass it the DOMDocument of the node:
code :
$xpath = new DOMXPath($element->parentNode->ownerDocument);
$xpath->execute($expression, $element->parentNode);
Is there a better way of getting parent node of XPath query result?

Is there a better way of getting parent node of XPath query result?


By : Lucas Rehn
Date : March 29 2020, 07:55 AM
will be helpful for those in need The nice thing about xpath queries is that you can essentially treat them like a file system path, so simply having
code :
//div[contains(@class,'foo')]/div/span[contains(@class,'a1')]/..
                                                              ^^
Umbraco 7 Multinode Treepicker xpath query root node parent of parent

Umbraco 7 Multinode Treepicker xpath query root node parent of parent


By : Oscar Kemboi
Date : March 29 2020, 07:55 AM
help you fix your problem I have Multinode Treepicker in Umbraco 7.4.1. I'm trying to find out how to set the picker to start from the parent of the parent of my current node. I'm also need the option to set the picker to start from the siblings of the parent of my current node. , hr_117 found the answer !
code :
$parent/..
T-SQL XPath query including Parent

T-SQL XPath query including Parent


By : neelesh
Date : March 29 2020, 07:55 AM
it helps some times Your own code uses .nodes() to get a derived table from repeating elements. In your case there are two levels of repeating elements:
many fields and within each field many items
code :
SELECT fld.value(N'(id/text())[1]',N'int') AS FieldID
      ,itm.value(N'(name/text())[1]',N'nvarchar(max)') AS ItemName
      ,itm.value(N'(value/text())[1]',N'nvarchar(max)') AS ItemValue
FROM @xml.nodes(N'/fields/field') AS A(fld)
OUTER APPLY A.fld.nodes(N'items/item') AS B(itm);
PHP 7 DomDocument xpath query parent parameter

PHP 7 DomDocument xpath query parent parameter


By : Cédric CLAUS
Date : January 02 2021, 06:32 AM
Hope this helps I'm trying to use eBaysvc.xsd not only to validate an xml but to build the xml itself: , To access ancestor of some node you could use expression like:
code :
//xs:element[ancestor::*[@name="AddDisputeRequestType"]]
Related Posts Related Posts :
  • Delete a xml child element from a selected node using FLWOR
  • XSLT: Omit last newline in output
  • Spring batch extract xml record from database
  • Copying file without duplicates
  • XSLT sum results for template
  • XSLT namespace versions
  • Xml layout file has too many views. How can I reduce them?
  • XSL Sort Numbers Separated by Periods
  • Can't get Excel Custom Ribbon Callbacks to work
  • Add Value to an attribute in XML File using shell script
  • Retrieve Response body as plain text or xml in Angularjs 2 HTTP GET request
  • How to convert a series of images as a slideshow and single images as inline images?
  • Merge 2 variables (lists) and remove duplicates
  • Missing operation for soapAction "" and body element "" with soap version 1.1 BW6
  • XPath to return always null
  • UWP: allow XSL transformation in a WebView for local content
  • How to create new ancestor elements with XSLT and change the order of others?
  • Groovy:Parse xml
  • To Remove only specified parent element not child element in xslt
  • Querying the entity identifiers present in an XBRL instance with MarkLogic XQuery
  • "Template rules match elements in no namespace" message
  • iTunes Podcast XML elements/tags
  • How do I view Transaction Assistant entries with the Kronos API?
  • xpath remove nodes based on child's attribute value
  • Merging XML nodes with identical child node values using XSLT
  • how to grab property values from xml in batch file to create a condition to run files
  • Comment the parent element based on child element string in xslt
  • XSLT, concat values to comma separated string and filtering unnecessary elements
  • XSL - check if the first listitem is a <br /> tag
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com