Oxygen unable to deal with empty tags when doing XInclude

Having trouble installing Oxygen? Got a bug to report? Post it all here.
michaelwk
Posts: 3
Joined: Wed Sep 13, 2006 11:41 am

Oxygen unable to deal with empty tags when doing XInclude

Post by michaelwk »

Hi,

I've a file containing empty tags. I want to include it in another XML using XInclude. Everything works until processor found an empty tag like this <test/>. All tags that follows this are included but without the values. Example <hello>lalala</hello> become <hello></hello>.
Changing <test/> by <test></test> solve the problem but I don't want to do this everywhere.

Further more, I can't validate my result file which contains the <xi:include> tags. I use .XSD
scheme, and i don't want to transform it to allow other kind of tags.

regards,
michael
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

Can you post sample files for reproducing the error and the result that you get after resolving the XInclude elements ? In a simple test that I did the XInclude elements are resolved correctly if the XML document is well-formed. It is not necessary to be valid. What do you mean by result file that contains <xi:include> tags ? How do you obtain this result file ? Anyway if you want to validate it the include element of the XInclude namespace must be declared in the schema. The current version of the XML parser does not accept it without being declared.

Regards,
Sorin
Last edited by sorin_ristache on Wed Sep 13, 2006 2:51 pm, edited 1 time in total.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Sorry, if you validate against an XML Schema you do not need to declare the elements of the XInclude namespace (include, fallback) in your schema. Just enable XInclude processing in <oXygen/> from Options -> Preferences -> XML / XML Parser -> Enable XInclude processing and the Validate Document action will resolve correctly xi:include elements. You need to declare the include and fallback elements only if you validate against DTD.

Regards,
Sorin
michaelwk
Posts: 3
Joined: Wed Sep 13, 2006 11:41 am

Post by michaelwk »

for example these 2 file (XSD, XSL are removed)

_blank.xml:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<test>
<document/>
<fs>
<f>
<name>LAlalalalalallalalalla will appear in result</name>
<xml-page/>
<bundle>
<name>XMLpage is an empty tag ang this text will never appear in result</name>
</bundle>
</f>
</fs>
</test>
and tests.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:xi="http://www.w3.org/2001/XInclude">
<document/>
<f>
<xi:include href="_blank.xml" xpointer="element(/1/2/1)">
<xi:fallback>404</xi:fallback>
</xi:include>
</f>
</test>
result is :

Code: Select all

<test> <document></document> <f>  <f>  <name>LAlalalalalallalalalla will appear in result</name>  <xml-page></xml-page><bundle><name></name></bundle></f>  </f> </test>
you can see the text in <name> diseapear !

Regards,
Michael
michaelwk
Posts: 3
Joined: Wed Sep 13, 2006 11:41 am

Post by michaelwk »

if in _blank.xml i change <xml-page/> by <xml-page></xml-page>, i've :

Code: Select all

<test> <document></document> <f>  <f>  <name>LAlalalalalallalalalla will appear in result</name>  <xml-page></xml-page>  <bundle>  <name>XMLpage is an empty tag ang this text will never appear in result</name>  </bundle>  </f>  </f> </test>
Regards,
Michael
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

I reported the bug to the developers of the XInclude processor. Also we will try to fix the bug in <oXygen/> independent of the XInclude processor developers. You have to use the workaround that you found until the bug is fixed: use <xml-page></xml-page> instead of <xml-page/> in _blank.xml.


Thank you for your report,
Sorin
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Oxygen unable to deal with empty tags when doing XInclude

Post by sorin_ristache »

Hello,
michaelwk wrote:I've a file containing empty tags. I want to include it in another XML using XInclude. Everything works until processor found an empty tag like this <test/>. All tags that follows this are included but without the values. Example <hello>lalala</hello> become <hello></hello>.
Changing <test/> by <test></test> solve the problem but I don't want to do this everywhere.
We fixed the problem in a previous version (version 8.2). You can try the latest version from the Download page.


Regards,
Sorin
Post Reply