Amara 1 to Amara 2 equivalents

10 views
Skip to first unread message

werner

unread,
Apr 20, 2012, 12:03:07 PM4/20/12
to ak...@googlegroups.com
Hi,

I tried to post this some time ago but it still is not showing - no idea what happened as I am posting online.

Started playing with 2.x and it reading and working with a file seems to be as easy as before.

doc = binderytools.bind_string(doc_header) changed to doc = bindery.parse(doc_header)

or from file:

doc = binderytools.bind_file(file) changed to doc = bindery.parse(file)

doc.x.y.z etc etc

But I haven't found the equivalent for:
element.xml_append(doc.xml_create_element(name, content=value))

Looked at the different wiki pages, but have not found the right one.

Is there some documentation besides what is on the wiki?

Werner

P.S.
Sorry if this shows up twice now.


Uche Ogbuji

unread,
Apr 20, 2012, 1:56:48 PM4/20/12
to ak...@googlegroups.com
On Fri, Apr 20, 2012 at 10:03 AM, werner <werner...@sfr.fr> wrote:
Hi,

I tried to post this some time ago but it still is not showing - no idea what happened as I am posting online.

Started playing with 2.x and it reading and working with a file seems to be as easy as before.

doc = binderytools.bind_string(doc_header) changed to doc = bindery.parse(doc_header)

or from file:

doc = binderytools.bind_file(file) changed to doc = bindery.parse(file)

doc.x.y.z etc etc

But I haven't found the equivalent for:
element.xml_append(doc.xml_create_element(name, content=value))


from amara import tree
new_elem = tree.element(None, name)
new_elem.xml_append(tree.text(value))
element.xml_append(new_elem)


3 lines instead of 1, but works as well.
 

Looked at the different wiki pages, but have not found the right one.

Sorry, no, but I try to update the wiki when needed. Most useful: 

 

Is there some documentation besides what is on the wiki?

Werner

P.S.
Sorry if this shows up twice now.



--
You received this message because you are subscribed to the Google Groups "akara" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akara/-/u7VrpS9foLoJ.
To post to this group, send email to ak...@googlegroups.com.
To unsubscribe from this group, send email to akara+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akara?hl=en.



--
Uche Ogbuji                       http://uche.ogbuji.net
Weblog: http://copia.ogbuji.net
Poetry ed @TNB: http://www.thenervousbreakdown.com/author/uogbuji/
Founding Partner, Zepheira        http://zepheira.com
Linked-in: http://www.linkedin.com/in/ucheogbuji
Articles: http://uche.ogbuji.net/tech/publications/
Friendfeed: http://friendfeed.com/uche
Twitter: http://twitter.com/uogbuji
http://www.google.com/profiles/uche.ogbuji

Werner

unread,
Apr 20, 2012, 2:17:32 PM4/20/12
to ak...@googlegroups.com
Uche and Luis,

On 20/04/2012 19:56, Uche Ogbuji wrote:
...


>
> from amara import tree
> new_elem = tree.element(None, name)
> new_elem.xml_append(tree.text(value))
> element.xml_append(new_elem)
>
> Viz: http://xml3k.org/Amara/Tutorial#Creating_a_document_from_scratch
>
> 3 lines instead of 1, but works as well.

no problem as I it is in a method, so only need to do it ones.

Thanks for the tips, will keep going on this tomorrow and most likely
have some more questions.

Werner

Reply all
Reply to author
Forward
0 new messages