Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

Question about XML and namespaces

$
0
0

I am having some trouble understanding working with XLM namespaces in AS3. I need to output a programs data in OpenDocument text format (.odt) for editing by word processing programs.

 

The root declaration of an .odt document declares a set of namespaces some of which I have shown below. The XML below is a short section representative of the output I need to construct and save. And to use in illustration for my question.

 

As I understand it the namespace when declared in the root element can be used by any decendent element. However my attempts to work with the namespace in AS3 keep producing a "Error #1083: The prefix "office" for element "office:font-face-decls" is not bound."

 

So my question is how do I add elements dynamically to the XML without generating the error. My attempts to date have only been successful when I add the xmls declaration to the decendent node e.g.

<style:style xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
style:name="Table1" style:family="table">

 

instead of

<style:style style:name="Table1" style:family="table">

 

 

Example XML for .odt

<office:document-content office:version="1.1" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"     xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"     xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"     xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"     xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0">   <office:font-face-decls>    <style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/>  </office:font-face-decls>  <office:automatic-styles>    <style:style style:name="Table1" style:family="table">      <style:table-properties style:width="16.999cm" table:align="margins"/>    </style:style>  </office:automatic-styles>  <office:body>    <office:text>      <text:sequence-decls>        <text:sequence-decl text:display-outline-level="0" text:name="Table"/>      </text:sequence-decls>      <table:table table:name="Table1" table:style-name="Table1">        <table:table-column table:style-name="Table1.A"/>        <table:table-column table:style-name="Table1.B" table:number-columns-repeated="2"/>        <table:table-column table:style-name="Table1.D"/>        <table:table-row>          <table:table-cell table:style-name="Table1.A1" office:value-type="string">            <text:p text:style-name="Table_20_Contents">Client</text:p>          </table:table-cell>          <table:table-cell table:style-name="Table1.B1" table:number-columns-spanned="3" office:value-type="string">            <text:p text:style-name="Table_20_Contents"/>          </table:table-cell>          <table:covered-table-cell/>          <table:covered-table-cell/>        </table:table-row>      </table:table>    </office:text>  </office:body></office:document-content>

Viewing all articles
Browse latest Browse all 21156

Latest Images

Trending Articles



Latest Images