Skip to main content
Known Participant
March 10, 2010
Question

Controling size of xml

  • March 10, 2010
  • 2 replies
  • 914 views

Hello

I am exporting the xml from my text layout but my xml has some extra contents due to which the size become large like if i apply the bold character property on text and after that when i will remove this bold property,the succeedind all span tags will have fontweight =normal and even in succeeding paragraphs also which doesn't needed.

I am writing a sample of text and xml produced:

normal text this is bold text this is italic text this is underlined text  here the font size is 18
normal text in next paragraph

<TextFlow columnCount="inherit" columnGap="inherit" columnWidth="inherit" fontFamily="Arial" fontSize="12" lineBreak="inherit" paddingBottom="inherit" paddingLeft="inherit" paddingRight="inherit" paddingTop="inherit" verticalAlign="inherit" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008">
  <p>
    <span>normal text</span>
    <span fontWeight="bold">this is bold text</span>
    <span fontWeight="normal"></span>
    <span fontStyle="italic" fontWeight="normal">this is italic text</span>
    <span fontStyle="normal" fontWeight="normal"></span>
    <span fontStyle="normal" fontWeight="normal" textDecoration="underline">this is underlined text</span>
    <span fontStyle="normal" fontWeight="normal" textDecoration="none"></span>
    <span fontSize="18" fontStyle="normal" fontWeight="normal" textDecoration="none">here the font size is 18</span>
    <span></span>
  </p>
  <p>
    <span fontSize="12" fontStyle="normal" fontWeight="normal" textDecoration="none">normal text in next paragraph</span>
  </p>
</TextFlow>

thnks.

This topic has been closed for replies.

2 replies

Adobe Employee
March 10, 2010

If you apply bold at the TextFlow level, and override it back to normal on every span, this is what you'd get. There are a couple of possible solutions for this. First, you could turn off the bold at the root level by calling applyFormatToElement(textFlow). Then instead of fontWeight=normal on every span, you'd have a single one at the root level. But if you are trying to say that you want to set it back to its default value, that is you want it removed from the XML, then you should call clearFormatOnElement. The difference is that in first case you are saying you want the fontWeight to be normal, even if (for example) the parent format (in this case the textFlow's hostFormat) sets it to bold. In the second case you are saying that you don't want to override the value, so its as if it was never set.

- robin

Known Participant
March 11, 2010

Hi robin

thanks for your reply

I am not applying the property at text flow level rathar i am applying by editManager.applyLeafFormat(format) ,format being type of TextLayoutFormat.

my question was that can't i get the xml like for my text that i present in my last post:

<TextFlow columnCount="inherit" columnGap="inherit" columnWidth="inherit" lineBreak="inherit" paddingBottom="inherit" paddingLeft="inherit" paddingRight="inherit" paddingTop="inherit" verticalAlign="inherit" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008">
  <p>
    <span>normal text</span>
    <span fontWeight="bold">this is bold text</span>
    <span fontStyle="italic" font weight="normal">this is italic text</span>
    <span textDecoration="underline" font style =" normal">this is underlined text</span>
    <span></span>
    <span fontSize="18">here the font size is 18</span>
  </p>
  <p>
    <span>normal text in next paragraph</span>
  </p>
</TextFlow>

You can see when I remove the bold format ,only the next span tag has font weight="normal " and no succeedind tag contain until i again use bold formatting.plz figure out my mistakes and suggest the changes that i should apply.

thanks.

Adobe Employee
March 10, 2010

The TextFlow object and the importer take an IConfiguration as input.  The IConfiguration.textFlowIniitalFormat specifies formats that are applied to the TextFlow.  Make a custom configuration with a different initial format when you create your TextFlow.  Pass that to the TextFlow constructor or the importer.

Hope that helps,

Richard

Known Participant
March 11, 2010

Hi Richard

I apply your suggestion of IConfiguration.textFlowInitialFormat but i get the error:


Access of possibly undefined property textFlowInitialFormat through a reference with static type Class.

Plz suggest the changes that i can apply.

Thanks

Known Participant
March 11, 2010

Hi Richard

I have removed the error.

But this suggestion even not solving the actual problem.

thanks