Xinclude and XPointer.. How to ? Please help me
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 9
- Joined: Thu Oct 19, 2006 5:31 pm
Xinclude and XPointer.. How to ? Please help me
Post by manuel.dorne »
Hello,
I've made a xinclude call like that:
<xs:appinfo>
<Actions>
<xi:include href="testXI.xml" xpointer="A1"/>
</Actions>
</xs:appinfo>
and here is the file where i have my information:
<Noms>
<Nom Init="DF" xml:id="A1" ><LastName>Faveur</LastName><FirstName>David</FirstName></Nom>
<Nom Init="MD"><LastName>Dorne</LastName><FirstName>Manuel</FirstName></Nom>
<Nom Init="PR"><LastName>Rajaud</LastName><FirstName>Patrick</FirstName></Nom>
</Noms>
I don't know how to get the firstname of the element id="A1" via my xpointer ?
Could you help me ?
Thanks
I've made a xinclude call like that:
<xs:appinfo>
<Actions>
<xi:include href="testXI.xml" xpointer="A1"/>
</Actions>
</xs:appinfo>
and here is the file where i have my information:
<Noms>
<Nom Init="DF" xml:id="A1" ><LastName>Faveur</LastName><FirstName>David</FirstName></Nom>
<Nom Init="MD"><LastName>Dorne</LastName><FirstName>Manuel</FirstName></Nom>
<Nom Init="PR"><LastName>Rajaud</LastName><FirstName>Patrick</FirstName></Nom>
</Noms>
I don't know how to get the firstname of the element id="A1" via my xpointer ?
Could you help me ?
Thanks
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
oXygen offers XInclude support through Xerces which does not support the entire xpointer() scheme. However you can include only the FirstName subelement that you want using the element() scheme:
Also oXygen adds support for including an XPointer fragment through the xml:id attribute as in your case:
but the element
includes the entire element Nom.
Regards,
Sorin
oXygen offers XInclude support through Xerces which does not support the entire xpointer() scheme. However you can include only the FirstName subelement that you want using the element() scheme:
Code: Select all
<xi:include href="testXI.xml" xpointer="element(/1/1/2)" xmlns:xi="http://www.w3.org/2001/XInclude"/>
Code: Select all
<Nom Init="DF" xml:id="A1" >
Code: Select all
<xi:include href="testXI.xml" xpointer="A1" xmlns:xi="http://www.w3.org/2001/XInclude"/>
Regards,
Sorin
-
- Posts: 9
- Joined: Thu Oct 19, 2006 5:31 pm
-
- Posts: 9
- Joined: Thu Oct 19, 2006 5:31 pm
Post by manuel.dorne »
Hi again !
When i generate the result file, i get this
<Text>
Voici les noms des personnes de la société
<Noms xml:base="testXi.xml">
<Nom Init="DF"><LastName>Faveur</LastName><FirstName>David</FirstName></Nom>
<Nom Init="MD"><LastName>Dorne</LastName><FirstName>Manuel</FirstName></Nom>
<Nom Init="PR"><LastName>Rajaud</LastName><FirstName>Patrick</FirstName></Nom>
</Noms>
</Text>
But, this file is not valid with my XSD because of the xml:base="textXi.xml" !
Do you know how to remove residual element like xml:base on my final generated file ?
Thanks
When i generate the result file, i get this
<Text>
Voici les noms des personnes de la société
<Noms xml:base="testXi.xml">
<Nom Init="DF"><LastName>Faveur</LastName><FirstName>David</FirstName></Nom>
<Nom Init="MD"><LastName>Dorne</LastName><FirstName>Manuel</FirstName></Nom>
<Nom Init="PR"><LastName>Rajaud</LastName><FirstName>Patrick</FirstName></Nom>
</Noms>
</Text>
But, this file is not valid with my XSD because of the xml:base="textXi.xml" !
Do you know how to remove residual element like xml:base on my final generated file ?
Thanks
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
You can avoid generating the xml:base attribute by disabling the Base URI fix-up option in Options -> Preferences -> XML -> XML Parser but generally this is not recommended. Why don't you modify your XSD to allow the xml:base attribute ?manuel.dorne wrote:Do you know how to remove residual element like xml:base on my final generated file ?
Regards,
Sorin
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Use the XPointer expression which I specified to obtain only the FirstName element that you want. With the following XInclude elementmanuel.dorne wrote:When i generate the result file, i get this
<Text>
Voici les noms des personnes de la société
<Noms xml:base="testXi.xml">
<Nom Init="DF"><LastName>Faveur</LastName><FirstName>David</FirstName></Nom>
<Nom Init="MD"><LastName>Dorne</LastName><FirstName>Manuel</FirstName></Nom>
<Nom Init="PR"><LastName>Rajaud</LastName><FirstName>Patrick</FirstName></Nom>
</Noms>
</Text>
Code: Select all
<xs:appinfo>
<Actions>
<xi:include href="testXI.xml" xpointer="element(/1/1/2)" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</Actions>
</xs:appinfo>
Code: Select all
<xs:appinfo>
<Actions>
<FirstName xml:base="test2.xml">David</FirstName>
</Actions>
</xs:appinfo>
Regards,
Sorin
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service