Xpath Extract data from Parent element and not its child elements where parent name is same as childXPath - extract value from parent with highest node valueXPATH for first element whose name is among the names of some other elementsFragment input xhtml to seperate xhtml files with ancestor nodes deailsHow to traverse to preceding parent node and get value of elements in XPath?xpath of elemnts including same childEffectively searching through entire 1 level nested JSONB in PostgresXSLT 2: How to wrap all content between first and last occurrence of a XML-tag?xpath: nested nodes with same nameConvert LocalDate into Timestamp in Postgres' json columnPostgreSQL occasional slow insertion speed because of FK trigger
Am I testing diodes properly?
Why do players in the past play much longer tournaments than today's top players?
Why did the Japanese attack the Aleutians at the same time as Midway?
What would the EU do if an EU member declared war on another EU member?
The monorail explodes before I can get on it
I have a ruthless DM and I'm considering leaving the party. What are my options to minimize the negative impact to the rest of the group?
Extract an attribute value from XML
Creating custom objects with custom properties using generics
Where is the USB2 OTG port on the RPi 4 Model B located?
Are randomly-generated passwords starting with "a" less secure?
Can I intentionally omit previous work experience or pretend it doesn't exist when applying for jobs?
Cops: The Hidden OEIS Substring
Was adding milk to tea started to reduce employee tea break time?
Why did my rum cake turn black?
Did any of the founding fathers anticipate Lysander Spooner's criticism of the constitution?
Is killing off one of my queer characters homophobic?
"A killed B" translation
Are there any intersection of Theory A and Theory B?
Does Google Maps take into account hills/inclines for route times?
Bronze Age Underwater Civilization
Is Arc Length always irrational between two rational points?
How can I deal with a player trying to insert real-world mythology into my homebrew setting?
Keep milk (or milk alternative) for a day without a fridge
diff shows a file that does not exist
Xpath Extract data from Parent element and not its child elements where parent name is same as child
XPath - extract value from parent with highest node valueXPATH for first element whose name is among the names of some other elementsFragment input xhtml to seperate xhtml files with ancestor nodes deailsHow to traverse to preceding parent node and get value of elements in XPath?xpath of elemnts including same childEffectively searching through entire 1 level nested JSONB in PostgresXSLT 2: How to wrap all content between first and last occurrence of a XML-tag?xpath: nested nodes with same nameConvert LocalDate into Timestamp in Postgres' json columnPostgreSQL occasional slow insertion speed because of FK trigger
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Parent and child tags have same name. I am trying to extract everything from parent except for the child elements.
We have several rows in parent that we want to extract. There are several Parent and child which are nested as below.
Have tried //Record/preceding-sibling::* which does not give me parent element start and end tag.
[not(descendant::Record)] and many other alternatives but no luck.
<Record contentId="1">
<Metrics_Library_Name>Text1</Metrics_Library_Name>
<Metrics_Library_ID>1</Metrics_Library_ID>
<Record contentId="1a">
<Questionnaire_ID>1a</Questionnaire_ID>
<Year>2018</Year>
<Quarter/>
<Month>02-Feb</Month>
</Record>
<Record contentId="1b">
<Questionnaire_ID>1a</Questionnaire_ID>
<Year>2018</Year>
<Quarter/>
<Month>02-Feb</Month>
</Record>
</Record>
Expected output:
<Record contentId="1">
<Metrics_Library_Name>Text1</Metrics_Library_Name>
<Metrics_Library_ID>1</Metrics_Library_ID>
</Record>
postgresql-9.5 xpath-2.0
add a comment |
Parent and child tags have same name. I am trying to extract everything from parent except for the child elements.
We have several rows in parent that we want to extract. There are several Parent and child which are nested as below.
Have tried //Record/preceding-sibling::* which does not give me parent element start and end tag.
[not(descendant::Record)] and many other alternatives but no luck.
<Record contentId="1">
<Metrics_Library_Name>Text1</Metrics_Library_Name>
<Metrics_Library_ID>1</Metrics_Library_ID>
<Record contentId="1a">
<Questionnaire_ID>1a</Questionnaire_ID>
<Year>2018</Year>
<Quarter/>
<Month>02-Feb</Month>
</Record>
<Record contentId="1b">
<Questionnaire_ID>1a</Questionnaire_ID>
<Year>2018</Year>
<Quarter/>
<Month>02-Feb</Month>
</Record>
</Record>
Expected output:
<Record contentId="1">
<Metrics_Library_Name>Text1</Metrics_Library_Name>
<Metrics_Library_ID>1</Metrics_Library_ID>
</Record>
postgresql-9.5 xpath-2.0
<Parent1 Record> <Text1> <Text2>...<Child1 Record><Text1></Child1> <Text2><Child2 Record>... </Child2> </Parent1 Record> <Parent2 Record> <Text1> <Text2>...<Child1 Record><Text1> <Text2></Child1><Child2 Record>...</Child2> </Parent2 Record>
– BPM
Mar 26 at 4:26
XPath selects nodes but XPath is read-only -- it cannot delete children of a selected node. Use XSLT to get the stated wanted result
– Dimitre Novatchev
Jun 11 at 23:38
add a comment |
Parent and child tags have same name. I am trying to extract everything from parent except for the child elements.
We have several rows in parent that we want to extract. There are several Parent and child which are nested as below.
Have tried //Record/preceding-sibling::* which does not give me parent element start and end tag.
[not(descendant::Record)] and many other alternatives but no luck.
<Record contentId="1">
<Metrics_Library_Name>Text1</Metrics_Library_Name>
<Metrics_Library_ID>1</Metrics_Library_ID>
<Record contentId="1a">
<Questionnaire_ID>1a</Questionnaire_ID>
<Year>2018</Year>
<Quarter/>
<Month>02-Feb</Month>
</Record>
<Record contentId="1b">
<Questionnaire_ID>1a</Questionnaire_ID>
<Year>2018</Year>
<Quarter/>
<Month>02-Feb</Month>
</Record>
</Record>
Expected output:
<Record contentId="1">
<Metrics_Library_Name>Text1</Metrics_Library_Name>
<Metrics_Library_ID>1</Metrics_Library_ID>
</Record>
postgresql-9.5 xpath-2.0
Parent and child tags have same name. I am trying to extract everything from parent except for the child elements.
We have several rows in parent that we want to extract. There are several Parent and child which are nested as below.
Have tried //Record/preceding-sibling::* which does not give me parent element start and end tag.
[not(descendant::Record)] and many other alternatives but no luck.
<Record contentId="1">
<Metrics_Library_Name>Text1</Metrics_Library_Name>
<Metrics_Library_ID>1</Metrics_Library_ID>
<Record contentId="1a">
<Questionnaire_ID>1a</Questionnaire_ID>
<Year>2018</Year>
<Quarter/>
<Month>02-Feb</Month>
</Record>
<Record contentId="1b">
<Questionnaire_ID>1a</Questionnaire_ID>
<Year>2018</Year>
<Quarter/>
<Month>02-Feb</Month>
</Record>
</Record>
Expected output:
<Record contentId="1">
<Metrics_Library_Name>Text1</Metrics_Library_Name>
<Metrics_Library_ID>1</Metrics_Library_ID>
</Record>
postgresql-9.5 xpath-2.0
postgresql-9.5 xpath-2.0
edited Mar 26 at 4:26
BPM
asked Mar 26 at 4:16
BPMBPM
62 bronze badges
62 bronze badges
<Parent1 Record> <Text1> <Text2>...<Child1 Record><Text1></Child1> <Text2><Child2 Record>... </Child2> </Parent1 Record> <Parent2 Record> <Text1> <Text2>...<Child1 Record><Text1> <Text2></Child1><Child2 Record>...</Child2> </Parent2 Record>
– BPM
Mar 26 at 4:26
XPath selects nodes but XPath is read-only -- it cannot delete children of a selected node. Use XSLT to get the stated wanted result
– Dimitre Novatchev
Jun 11 at 23:38
add a comment |
<Parent1 Record> <Text1> <Text2>...<Child1 Record><Text1></Child1> <Text2><Child2 Record>... </Child2> </Parent1 Record> <Parent2 Record> <Text1> <Text2>...<Child1 Record><Text1> <Text2></Child1><Child2 Record>...</Child2> </Parent2 Record>
– BPM
Mar 26 at 4:26
XPath selects nodes but XPath is read-only -- it cannot delete children of a selected node. Use XSLT to get the stated wanted result
– Dimitre Novatchev
Jun 11 at 23:38
<Parent1 Record> <Text1> <Text2>...<Child1 Record><Text1></Child1> <Text2><Child2 Record>... </Child2> </Parent1 Record> <Parent2 Record> <Text1> <Text2>...<Child1 Record><Text1> <Text2></Child1><Child2 Record>...</Child2> </Parent2 Record>
– BPM
Mar 26 at 4:26
<Parent1 Record> <Text1> <Text2>...<Child1 Record><Text1></Child1> <Text2><Child2 Record>... </Child2> </Parent1 Record> <Parent2 Record> <Text1> <Text2>...<Child1 Record><Text1> <Text2></Child1><Child2 Record>...</Child2> </Parent2 Record>
– BPM
Mar 26 at 4:26
XPath selects nodes but XPath is read-only -- it cannot delete children of a selected node. Use XSLT to get the stated wanted result
– Dimitre Novatchev
Jun 11 at 23:38
XPath selects nodes but XPath is read-only -- it cannot delete children of a selected node. Use XSLT to get the stated wanted result
– Dimitre Novatchev
Jun 11 at 23:38
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349769%2fxpath-extract-data-from-parent-element-and-not-its-child-elements-where-parent-n%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349769%2fxpath-extract-data-from-parent-element-and-not-its-child-elements-where-parent-n%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
<Parent1 Record> <Text1> <Text2>...<Child1 Record><Text1></Child1> <Text2><Child2 Record>... </Child2> </Parent1 Record> <Parent2 Record> <Text1> <Text2>...<Child1 Record><Text1> <Text2></Child1><Child2 Record>...</Child2> </Parent2 Record>
– BPM
Mar 26 at 4:26
XPath selects nodes but XPath is read-only -- it cannot delete children of a selected node. Use XSLT to get the stated wanted result
– Dimitre Novatchev
Jun 11 at 23:38