Re: atom problem

Robert Goene <[email protected]> Wed, 22 Jun 2005 11:11:31 +0200
Newsgroups gmane.editors.bitflux.general
Message-ID <[email protected]>
Christian Stocker wrote:
> 
> On 22.6.2005 0:18 Uhr, Robert Goene wrote:
> 
>>Hi List,
>>
>>I try to implement the atom 0.8 xml standard in BXE 1.0.1-dev for use in
>>Lenya and i am experiencing some problems.
>>
>>When the editor is loaded, two javascript errors occur:
>>
>>Error: this.ownerDocument.vdom.firstChild has no properties
>>Source File: http://82.94.247.19:8888/bxeng/relaxng/NodeVAL.js
>>Line: 237
>>
>>Error: startElement has no properties
>>Source File: http://82.94.247.19:8888/bxeng/relaxng/RelaxNG.js
>>Line: 305
>>
>>When the bxe context-menu is used, a similar error is shown:
>>
>>ERROR in Bitflux editor:
>>this.ownerDocument.vdom.firstChild has no properties
>>in File: .../NodeVAL.js
>>Linenumber: 237
>>Type: TypeError
>>
>>Does this ring any bells?
> 
> 
> No, not really :) What exactly did you do? How does your relaxng look
> like? Did you use trang? Did you take it from somewhere?
> 
> And furthermore, I'd advice to use BXE 1.1-dev, as this is, were all the
> bugfixes go currently (but I don't think, it helps with your problem)

I will give it a try.

I use the atom 0.8 specification from 
http://atompub.org/2005/04/18/atom.rnc and i use Trang to create the rng 
version. Validating and saving the xml files is possible when i use the 
'source editor' that is included in lenya (the one-form editor).

There are some schematron rules in the rng definition. Commenting them 
does not lead to other behaviour of BXE.

This is the RNG file as copied from the 'debug' menu of BXE:


<?xml version="1.0" encoding="UTF-8" ?>
<!--
   -*- rnc -*-
   RELAX NG Compact Syntax Grammar for the
   Atom Format Specification Version 08
-->
<grammar xmlns:s="http://www.ascc.net/xml/schematron" 
xmlns:atom="http://purl.org/atom/ns#draft-ietf-atompub-format-08" 
xmlns:xhtml="http://www.w3.org/1999/xhtml" 
xmlns="http://relaxng.org/ns/structure/1.0" 
ns="http://purl.org/atom/ns#draft-ietf-atompub-format-08" 
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" 
xmlns:rng="http://relaxng.org/ns/structure/1.0"><start>
     <choice>
       <ref name="atomFeed"/>
       <ref name="atomEntry"/>
     </choice>
   </start><!-- Common attributes --><define name="atomCommonAttributes">

       <attribute name="xml:base" type="optional">
         <ref name="atomUri"/>
       </attribute>


       <attribute name="xml:lang" type="optional">
         <ref name="atomLanguageTag"/>
       </attribute>

   </define><!-- Text Constructs --><define name="atomPlainTextConstruct">
     <ref name="atomCommonAttributes"/>

       <attribute name="type" type="optional">
         <choice>
           <value>text</value>
           <value>html</value>
         </choice>
       </attribute>

     <text/>
   </define><define name="atomXHTMLTextConstruct">
     <ref name="atomCommonAttributes"/>
     <attribute name="type">
       <value>xhtml</value>
     </attribute>
     <ref name="xhtmlDiv"/>
   </define><define name="atomTextConstruct">
     <choice>
       <ref name="atomPlainTextConstruct"/>
       <ref name="atomXHTMLTextConstruct"/>
     </choice>
   </define><!-- Person Construct --><define name="atomPersonConstruct">
     <ref name="atomCommonAttributes"/>
     <interleave>
       <element name="atom:name">
         <text/>
       </element>
       <optional>
         <element name="atom:uri">
           <ref name="atomUri"/>
         </element>
       </optional>
       <optional>
         <element name="atom:email">
           <ref name="atomEmailAddress"/>
         </element>
       </optional>
       <zeroOrMore>
         <ref name="extensionElement"/>
       </zeroOrMore>
     </interleave>
   </define><!-- Date Construct --><define name="atomDateConstruct">
     <ref name="atomCommonAttributes"/>
     <data type="dateTime"/>
   </define><!-- atom:feed --><define name="atomFeed">
     <element name="atom:feed">
     <!--
       <s:rule context="atom:feed">
         <s:assert test="atom:link[@rel='alternate'] or 
atom:link[not(@rel)]">An atom:feed must have at least one link element 
with a rel attribute of 'alternate'.</s:assert>
       </s:rule>
       <s:rule context="atom:feed">
         <s:assert test="atom:author or 
not(atom:entry[not(atom:author)])">An atom:feed must have an atom:author 
unless all of its atom:entry children have an atom:author.</s:assert>
       </s:rule>
       -->
       <ref name="atomCommonAttributes"/>
       <interleave>
         <optional>
           <ref name="atomAuthor"/>
         </optional>
         <zeroOrMore>
           <ref name="atomCategory"/>
         </zeroOrMore>
         <zeroOrMore>
           <ref name="atomContributor"/>
         </zeroOrMore>
         <optional>
           <ref name="atomCopyright"/>
         </optional>
         <optional>
           <ref name="atomGenerator"/>
         </optional>
         <optional>
           <ref name="atomIcon"/>
         </optional>
         <optional>
           <ref name="atomId"/>
         </optional>
         <optional>
           <ref name="atomImage"/>
         </optional>
         <oneOrMore>
           <ref name="atomLink"/>
         </oneOrMore>
         <optional>
           <ref name="atomSubtitle"/>
         </optional>
         <ref name="atomTitle"/>
         <ref name="atomUpdated"/>
         <zeroOrMore>
           <ref name="extensionElement"/>
         </zeroOrMore>
       </interleave>
       <zeroOrMore>
         <ref name="atomEntry"/>
       </zeroOrMore>
     </element>
   </define><!-- atom:entry --><define name="atomEntry">
     <element name="atom:entry">
     <!--
       <s:rule context="atom:entry">
         <s:assert test="atom:link[@rel='alternate'] or 
atom:link[not(@rel)] or atom:content">An atom:entry must have at least 
one link element with a rel attribute of 'alternate' or content.</s:assert>
       </s:rule>
       <s:rule context="atom:entry">
         <s:assert test="atom:author or ../atom:author or 
atom:source/atom:author">An atom:entry must have an atom:author if its 
feed does not.</s:assert>
       </s:rule>
     -->
       <!--
         N.B. This rule doesn't test
         for content with a non-binary type.
       -->
     <!--
       <s:rule context="atom:entry">
         <s:assert test="atom:summary or atom:content[not(@src)]">An 
atom:entry must have an atom:summary if the atom:content element is 
empty.</s:assert>
       </s:rule>
     -->
       <ref name="atomCommonAttributes"/>
       <interleave>
         <optional>
           <ref name="atomAuthor"/>
         </optional>
         <zeroOrMore>
           <ref name="atomCategory"/>
         </zeroOrMore>
         <optional>
           <ref name="atomContent"/>
         </optional>
         <zeroOrMore>
           <ref name="atomContributor"/>
         </zeroOrMore>
         <optional>
           <ref name="atomCopyright"/>
         </optional>
         <ref name="atomId"/>
         <zeroOrMore>
           <ref name="atomLink"/>
         </zeroOrMore>
         <optional>
           <ref name="atomPublished"/>
         </optional>
         <optional>
           <ref name="atomSource"/>
         </optional>
         <optional>
           <ref name="atomSummary"/>
         </optional>
         <ref name="atomTitle"/>
         <ref name="atomUpdated"/>
         <zeroOrMore>
           <ref name="extensionElement"/>
         </zeroOrMore>
       </interleave>
     </element>
   </define><!-- atom:content --><define name="atomInlineTextContent">
     <element name="atom:content">
       <ref name="atomCommonAttributes"/>

         <attribute name="type" type="optional">
           <choice>
             <value>text</value>
             <value>html</value>
           </choice>
         </attribute>

       <zeroOrMore>
         <text/>
       </zeroOrMore>
     </element>
   </define><define name="atomInlineXHTMLContent">
     <element name="atom:content">
       <ref name="atomCommonAttributes"/>
       <attribute name="type">
         <value>xhtml</value>
       </attribute>
       <ref name="xhtmlDiv"/>
     </element>
   </define><define name="atomInlineOtherContent">
     <element name="atom:content">
       <ref name="atomCommonAttributes"/>

         <attribute name="type" type="optional">
           <ref name="atomMediaType"/>
         </attribute>

       <zeroOrMore>
         <choice>
           <text/>
           <ref name="anyForeignElement"/>
         </choice>
       </zeroOrMore>
     </element>
   </define><define name="atomOutOfLineContent">
     <element name="atom:content">
       <ref name="atomCommonAttributes"/>

         <attribute name="type" type="optional">
           <ref name="atomMediaType"/>
         </attribute>

       <attribute name="src">
         <ref name="atomUri"/>
       </attribute>
       <empty/>
     </element>
   </define><define name="atomContent">
     <choice>
       <ref name="atomInlineTextContent"/>
       <ref name="atomInlineXHTMLContent"/>
       <ref name="atomInlineOtherContent"/>
       <ref name="atomOutOfLineContent"/>
     </choice>
   </define><!-- atom:author --><define name="atomAuthor">
     <element name="atom:author">
       <ref name="atomPersonConstruct"/>
     </element>
   </define><!-- atom:category --><define name="atomCategory">
     <element name="atom:category">
       <ref name="atomCommonAttributes"/>
       <attribute name="term"/>

         <attribute name="scheme" type="optional">
           <ref name="atomUri"/>
         </attribute>


         <attribute name="label" type="optional"/>

       <empty/>
     </element>
   </define><!-- atom:contributor --><define name="atomContributor">
     <element name="atom:contributor">
       <ref name="atomPersonConstruct"/>
     </element>
   </define><!-- atom:copyright --><define name="atomCopyright">
     <element name="atom:copyright">
       <ref name="atomTextConstruct"/>
     </element>
   </define><!-- atom:generator --><define name="atomGenerator">
     <element name="atom:generator">
       <ref name="atomCommonAttributes"/>

         <attribute name="uri" type="optional">
           <ref name="atomUri"/>
         </attribute>


         <attribute name="version" type="optional"/>

       <text/>
     </element>
   </define><!-- atom:icon --><define name="atomIcon">
     <element name="atom:icon">
       <ref name="atomCommonAttributes"/>
       <ref name="atomUri"/>
     </element>
   </define><!-- atom:id --><define name="atomId">
     <element name="atom:id">
       <ref name="atomCommonAttributes"/>
       <ref name="atomUri"/>
     </element>
   </define><!-- atom:image --><define name="atomImage">
     <element name="atom:image">
       <ref name="atomCommonAttributes"/>
       <ref name="atomUri"/>
     </element>
   </define><!-- atom:link --><define name="atomLink">
     <element name="atom:link">
       <ref name="atomCommonAttributes"/>
       <attribute name="href">
         <ref name="atomUri"/>
       </attribute>

         <attribute name="rel" type="optional">
           <choice>
             <ref name="atomNCName"/>
             <ref name="atomUri"/>
           </choice>
         </attribute>


         <attribute name="type" type="optional">
           <ref name="atomMediaType"/>
         </attribute>


         <attribute name="hreflang" type="optional">
           <ref name="atomLanguageTag"/>
         </attribute>


         <attribute name="title" type="optional"/>


         <attribute name="length" type="optional"/>

       <empty/>
     </element>
   </define><!-- atom:published --><define name="atomPublished">
     <element name="atom:published">
       <ref name="atomDateConstruct"/>
     </element>
   </define><!-- atom:source --><define name="atomSource">
     <element name="atom:source">
       <ref name="atomCommonAttributes"/>
       <interleave>
         <optional>
           <ref name="atomAuthor"/>
         </optional>
         <zeroOrMore>
           <ref name="atomCategory"/>
         </zeroOrMore>
         <zeroOrMore>
           <ref name="atomContributor"/>
         </zeroOrMore>
         <optional>
           <ref name="atomCopyright"/>
         </optional>
         <optional>
           <ref name="atomGenerator"/>
         </optional>
         <optional>
           <ref name="atomIcon"/>
         </optional>
         <optional>
           <ref name="atomId"/>
         </optional>
         <optional>
           <ref name="atomImage"/>
         </optional>
         <oneOrMore>
           <ref name="atomLink"/>
         </oneOrMore>
         <optional>
           <ref name="atomSubtitle"/>
         </optional>
         <ref name="atomTitle"/>
         <ref name="atomUpdated"/>
         <zeroOrMore>
           <ref name="extensionElement"/>
         </zeroOrMore>
       </interleave>
     </element>
   </define><!-- atom:subtitle --><define name="atomSubtitle">
     <element name="atom:subtitle">
       <ref name="atomTextConstruct"/>
     </element>
   </define><!-- atom:summary --><define name="atomSummary">
     <element name="atom:summary">
       <ref name="atomTextConstruct"/>
     </element>
   </define><!-- atom:title --><define name="atomTitle">
     <element name="atom:title">
       <ref name="atomTextConstruct"/>
     </element>
   </define><!-- atom:updated --><define name="atomUpdated">
     <element name="atom:updated">
       <ref name="atomDateConstruct"/>
     </element>
   </define><!-- Low-level simple types --><define name="atomNCName">
     <data type="string">
       <param name="minLength">1</param>
       <param name="pattern">[^:]*</param>
     </data>
   </define><!-- Whatever a media type is, it contains at least one 
slash --><define name="atomMediaType">
     <data type="string">
       <param name="pattern">.+/.+</param>
     </data>
   </define><!-- As defined in RFC 3066 --><define name="atomLanguageTag">
     <data type="string">
       <param name="pattern">[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*</param>
     </data>
   </define><!--
     Unconstrained; it's not entirely clear how IRI fit into
     xsd:anyURI so let's not try to constrain it here
   --><define name="atomUri">
     <text/>
   </define><!-- Whatever an email address is, it contains at least one 
@ --><define name="atomEmailAddress">
     <data type="string">
       <param name="pattern">.+@.+</param>
     </data>
   </define><!-- Simple Extension --><define name="simpleExtensionElement">
     <element>
       <anyName>
         <except>
           <nsName 
ns="http://purl.org/atom/ns#draft-ietf-atompub-format-08"/>
         </except>
       </anyName>
       <text/>
     </element>
   </define><!-- Structured Extension --><define 
name="structuredExtensionElement">
     <element>
       <anyName>
         <except>
           <nsName 
ns="http://purl.org/atom/ns#draft-ietf-atompub-format-08"/>
         </except>
       </anyName>
       <choice>
         <group>
           <oneOrMore>
             <attribute>
               <anyName/>
             </attribute>
           </oneOrMore>
           <zeroOrMore>
             <choice>
               <text/>
               <ref name="anyElement"/>
             </choice>
           </zeroOrMore>
         </group>
         <group>
           <zeroOrMore>
             <attribute>
               <anyName/>
             </attribute>
           </zeroOrMore>
           <group>
             <optional>
               <text/>
             </optional>
             <oneOrMore>
               <ref name="anyElement"/>
             </oneOrMore>
             <zeroOrMore>
               <choice>
                 <text/>
                 <ref name="anyElement"/>
               </choice>
             </zeroOrMore>
           </group>
         </group>
       </choice>
     </element>
   </define><!-- Other Extensibility --><define name="extensionElement">
     <choice>
       <ref name="simpleExtensionElement"/>
       <ref name="structuredExtensionElement"/>
     </choice>
   </define><define name="anyElement">
     <element>
       <anyName/>
       <zeroOrMore>
         <choice>
           <attribute>
             <anyName/>
           </attribute>
           <text/>
           <ref name="anyElement"/>
         </choice>
       </zeroOrMore>
     </element>
   </define><define name="anyForeignElement">
     <element>
       <anyName>
         <except>
           <nsName 
ns="http://purl.org/atom/ns#draft-ietf-atompub-format-08"/>
         </except>
       </anyName>
       <zeroOrMore>
         <choice>
           <attribute>
             <anyName/>
           </attribute>
           <text/>
           <ref name="anyElement"/>
         </choice>
       </zeroOrMore>
     </element>
   </define><!-- XHTML --><define name="anyXHTML">
     <element>
       <nsName ns="http://www.w3.org/1999/xhtml"/>
       <zeroOrMore>
         <choice>
           <attribute>
             <anyName/>
           </attribute>
           <text/>
           <ref name="anyXHTML"/>
         </choice>
       </zeroOrMore>
     </element>
   </define><define name="xhtmlDiv">
     <element name="xhtml:div">
       <zeroOrMore>
         <choice>
           <attribute>
             <anyName/>
           </attribute>
           <text/>
           <ref name="anyXHTML"/>
         </choice>
       </zeroOrMore>
     </element>
   </define></grammar>
<!-- EOF -->


And the corresponding XML file:

<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08">	
   <title/>
   <link href="http://example.org/"/>
   <updated>2003-12-13T18:30:02Z</updated>
   <author>
     <name>John Doe</name>
   </author>
   <entry>
     <title>This text was typed in the source editor</title>
     <link href="http://example.org/2003/12/13/atom03"/>
     <id>1</id>
     <updated>2003-12-13T18:30:02Z</updated>
     <summary>Some text.</summary>
     <content>test texxt</content>
   </entry>
   <entry>
     <title>New News</title>
     <link href="http://example.org/2003/12/13/atom03"/>
     <id>2</id>
     <updated>2003-12-13T18:30:02Z</updated>
     <summary>Some text.</summary>
   </entry>
</feed>


The xhtml as send to BXE:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:cleancode="http://www.cleancode.nl/doctypes/list/1.0" 
xmlns:cinclude="http://apache.org/cocoon/include/1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/" 
xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"><head><link 
type="text/css" href="/vandejong/authoring/css/page.css" 
rel="stylesheet"/><meta name="generator" content="Apache Lenya"/><meta 
name="description" content=""/><meta name="subject" content=""/><meta 
name="language" content=""/><title/>
</head>
<body>
<div id="page">
<div id="header"></div>
<div id="title"><h1/></div>

<div id="body" bxe_xpath="/atom:feed">	
   <h1 xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08"/>
   <a xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08" 
href="http://example.org/"/>



     <h1 
xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08">This text 
was typed in the source editor</h1>
     <a xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08" 
href="http://example.org/2003/12/13/atom03"/>


     <p 
xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08"><em>Some 
text.</em></p>
     <p 
xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08">test texxt</p>


     <h1 
xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08">New News</h1>

     <a xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08" 
href="http://example.org/2003/12/13/atom03"/>


     <p 
xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08"><em>Some 
text.</em></p>

</div></div></body></html>





Sorry for the long email and thanks for your help!


Regards, Robert
-- 
bx-editor-users mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-users