Writer content doesn't seems to be a standard XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Everyone,

I am trying to implement a ODT based report generator in Go language by
substituting placeholder fields and images.

In order to replace an image in the document, I decode the XML find the
<draw:image> node under <draw:frame> with the property which matches
the substituting field. Then I replace "xlink:href" and "loext:mime-
type" attributes matching the substituted image. Finally, add the image
in manifest.xml

This way I am able to substitute the images in the ODT doucment.
However, while encoding the xml back to string I found that the
ordering of certain texts in the document were jumbled.

Checking the content I found that the content doesn't seems to be
standard XML. Eg:

   <text:p text:style-name="P1">
     Sample
     <text:span text:style-name="T3">a</text:span>
     <text:span text:style-name="T14">dmission</text:span>
     format
   </text:p>

When I re-encode this XML, I get the following:

   <text:p text:style-name="P1">
     Sample format
     <text:span text:style-name="T3">a</text:span>
     <text:span text:style-name="T14">dmission</text:span>
   </text:p>

Thereby, completely jumbling the ordering of text.

Shouldn't the original XML be in one of the below format?

   <text:p text:style-name="P1">
     <text:span text:style-name="blah">Sample</text:span>
     <text:span text:style-name="T3">a</text:span>
     <text:span text:style-name="T14">dmission</text:span>
     <text:span text:style-name="blah2">format</text:span>
   </text:p>

   OR

   <text:p text:style-name="P1">
     Sample application format
   </text:p>

   OR

   <text:p text:style-name="P1">
     <text:span text:style-name="blah">Sample admission
   format</text:span>
   </text:p>


Is there any reasoning behind this? Am I missing something here?
Someone please enlighten me.

Thank You.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux