AW: Retrieving parts of a document
"Kirmse, Daniel" <[email protected]> Wed, 21 Jan 2004 12:49:20 +0100
| Newsgroups | gmane.text.xml.xpath.general |
|---|---|
| Message-ID | <[email protected]> |
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C3E014.8507104A Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Forget about it! I finally found out how to achieve this. =20 -----Urspr=FCngliche Nachricht----- Von: [email protected] = [mailto:[email protected]] Im Auftrag von Kirmse, = Daniel Gesendet: Mittwoch, 21. Januar 2004 10:04 An: [email protected] Betreff: Retrieving parts of a document =20 Hi, is there a way to retrieve a part of a document as XML? Suppose this document: <?xml version=3D"1.0"?> <!DOCTYPE chapter PUBLIC "-//X-HIVE/Generated Public ID 101//EN" = "dtd/books.dtd"> <chapter> <title>Data Model</title> <section> <title>Syntax For Data Model</title> </section> <section> <title>XML</title> <section> <title>Basic Syntax</title> </section> <section> <title>XML and Semistructured Data</title> </section> </section> </chapter> The result I have in mind is: <section> <title>XML</title> <section> <title>Basic Syntax</title> </section> <section> <title>XML and Semistructured Data</title> </section> </section> =20 By using a XPath expression like /chapter/section[child::title/text() = =3D "XML"] I would merely navigate to the context of node "section" = (Well maybe the phrasing is not right. I hope I made you understand my = intention). Do I have to use XQuery to accomplish that? Well I think I could write = a XQuery expression for that example that generates the output. But = what if I do not know the structure of the subtree/part of document to = retrieve but only the structure of the root node of this subtree/part = of document? =20 Thanks, Daniel ------_=_NextPart_001_01C3E014.8507104A Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Diso-8859-1"> <meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)"> <title>Retrieving parts of a document</title> <style> <!-- /* Font Definitions */ @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:#606420; text-decoration:underline;} p {margin-right:0cm; margin-left:0cm; font-size:12.0pt; font-family:"Times New Roman";} span.EmailFormatvorlage18 {font-family:Arial; color:navy;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style> </head> <body lang=3DDE link=3Dblue vlink=3D"#606420"> <div class=3DSection1> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = lang=3DEN-GB style=3D'font-size:10.0pt;font-family:Arial;color:navy'>Forget about = it! I finally found out how to achieve this.</span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = lang=3DEN-GB style=3D'font-size:10.0pt;font-family:Arial;color:navy'> </span></f= ont></p> <p class=3DMsoNormal style=3D'margin-left:35.4pt'><font size=3D2 = face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'>-----Urspr=FCngliche = Nachricht-----<br> <b><span style=3D'font-weight:bold'>Von:</span></b> [email protected] = [mailto:[email protected]] <b><span style=3D'font-weight:bold'>Im Auftrag von </span></b>Kirmse, Daniel<br> <b><span style=3D'font-weight:bold'>Gesendet:</span></b> Mittwoch, 21. = Januar 2004 10:04<br> <b><span style=3D'font-weight:bold'>An:</span></b> = [email protected]<br> <b><span style=3D'font-weight:bold'>Betreff:</span></b> Retrieving = parts of a document</span></font></p> <p class=3DMsoNormal style=3D'margin-left:35.4pt'><font size=3D3 face=3D"Times New Roman"><span = style=3D'font-size:12.0pt'> </span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial'>Hi,</span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial'>is there a way to retrieve a part of a = document as XML?</span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial'>Suppose this document:</span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'><?xml version=3D"1.0"?></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'><!DOCTYPE = chapter PUBLIC "-//X-HIVE/Generated Public ID 101//EN" = "dtd/books.dtd"></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier = New"'><chapter></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> = <title>Data Model</title></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> = <section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> <title>Syntax For Data Model</title></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> = </section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> = <section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> <title>XML</title></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> <section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier = New"'> <title>Basic Syntax</title></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> </section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> <section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier = New"'> <title>XML and Semistructured = Data</title></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier = New"'> </span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier = New"'></section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> = </section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier = New"'></chapter></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial'>The result I have in mind = is:</span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> = <section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> <title>XML</title></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> <section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier = New"'> <title>Basic Syntax</title></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> </section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> <section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier = New"'> <title>XML and Semistructured = Data</title></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier = New"'> </span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier = New"'></section></span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3D"Courier = New"><span style=3D'font-size:10.0pt;font-family:"Courier New"'> = </section></span></font></p> <p class=3DMsoNormal style=3D'margin-left:35.4pt'><font size=3D3 face=3D"Times New Roman"><span = style=3D'font-size:12.0pt'> </span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial'>By using a XPath expression like /chapter/section[child::title/text() =3D</span></font> <font size=3D2 = face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial'>"XML"] I would = merely navigate to the context of node</span></font> <font size=3D2 = face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial'>"section" (Well = maybe the phrasing is not right. I hope I made you understand my = intention).</span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial'>Do I have to use XQuery to accomplish = that?</span></font> <font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt;font-family:Arial'>Well I think I could write a XQuery expression for that example that generates = the</span></font> <font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt;font-family:Arial'>output. But what if I do not know the structure of the subtree/part of document = to retrieve but only the structure of the root node of this subtree/part = of document?</span></font></p> <p class=3DMsoNormal style=3D'margin-left:35.4pt'><font size=3D3 face=3D"Times New Roman"><span = style=3D'font-size:12.0pt'> </span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial'>Thanks,</span></font></p> <p style=3D'margin-left:35.4pt'><font size=3D2 face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial'>Daniel</span></font></p> </div> </body> </html> ------_=_NextPart_001_01C3E014.8507104A--