#157 attDef/desc context disregarded

ROMA
open-accepted
5
2011-11-09
2010-01-24
Ian Rons
No

I've noticed that in the following example, Roma reads <desc>manuscript folios</desc> as the description for the attribute as a whole, rather than using the default TEI <desc>:

<classSpec ident="att.dimensions" mode="change" module="tei" type="atts">
<attList>
<attDef ident="unit" mode="change">
<valList mode="replace" type="closed">
<valItem ident="folios">
<desc>manuscript folios</desc>
</valItem>
<valItem ident="lines">
<desc>lines of text</desc>
</valItem>
<valItem ident="words">
<desc>words of text</desc>
</valItem>
<valItem ident="chars">
<desc>characters of text</desc>
</valItem>
<valItem ident="mm">
<desc>millimetres</desc>
</valItem>
</valList>
</attDef>
</attList>
<classSpec>

Discussion

  • Ian Rons
    Ian Rons
    2010-01-24

    • summary: Parsing --> attDef/desc context disregarded
     
  • that's surprising. I can't see the problem offhand on a quick search through the code, I'll have to dig deeper

     
  • Ian Rons
    Ian Rons
    2010-01-25

    I took a look and found this sort of thing in romadom.php and docdom.php, which would appear to be the culprit or at least in the vicinity:
    $oDesc = $oChild->getElementsByTagName( 'desc' )->item(0);

     
  • Ian Rons
    Ian Rons
    2010-01-26

    I should perhaps make it clear by saying that the getElementsByTagName method looks at all descendents, not just children.

     
  • This will require a rather serious re-examination of Roma code, as PHP XML does not seem to give me a simple way of asking "is there a <desc> child". I'll continue looking.

     
    • status: open --> open-accepted
     
  • Ian Rons
    Ian Rons
    2010-02-07

    Indeed, this bug seems to have revealed a broader issue. I use PHP a fair bit and tend to use the simplexml PHP extension for everything except xpath queries (although it does simple xpath node queries), and this would make available the children() method.

    To avoid a rewrite, you could perhaps use simplexml_import_dom() followed by SimpleXMLElement::children() in this case, and although I may regret this I am tempted to offer my services to tidy it up in other areas (as per the other bugs I've spotted lately) if you're not that into PHP.

     
  • I am wondering about working around this with childNode; but I am reluctant to spend a lot of time on Roma at the moment, as I really regard it as frozen. If you _can_ spend time to understand the problem and fix it, that would be great. To be honest, I find the code in romadom.php/getAttributeDomByElementInModule incomprehensible now :-{

     
  • Lou Burnard
    Lou Burnard
    2011-11-09

    • milestone: 871214 --> ROMA