Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attDef/desc context disregarded #835

Closed
TEITechnicalCouncil opened this issue Jan 24, 2010 · 11 comments
Closed

attDef/desc context disregarded #835

TEITechnicalCouncil opened this issue Jan 24, 2010 · 11 comments

Comments

@TEITechnicalCouncil
Copy link

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>

Original comment by: sf_user_ianrons

@TEITechnicalCouncil
Copy link
Author

  • summary: Parsing --> attDef/desc context disregarded

Original comment by: sf_user_ianrons

@TEITechnicalCouncil
Copy link
Author

that's surprising. I can't see the problem offhand on a quick search through the code, I'll have to dig deeper

Original comment by: @sebastianrahtz

@TEITechnicalCouncil
Copy link
Author

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);

Original comment by: sf_user_ianrons

@TEITechnicalCouncil
Copy link
Author

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

Original comment by: sf_user_ianrons

@TEITechnicalCouncil
Copy link
Author

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.

Original comment by: @sebastianrahtz

@TEITechnicalCouncil
Copy link
Author

  • status: open --> open-accepted

Original comment by: @sebastianrahtz

@TEITechnicalCouncil
Copy link
Author

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.

Original comment by: sf_user_ianrons

@TEITechnicalCouncil
Copy link
Author

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 :-{

Original comment by: @sebastianrahtz

@TEITechnicalCouncil
Copy link
Author

  • milestone: 871214 --> ROMA

Original comment by: @lb42

@TEITechnicalCouncil
Copy link
Author

This issue was originally assigned to SF user: rahtz
Current user is: sebastianrahtz

@peterstadler
Copy link
Member

moving to TEIC/Roma-Antiqua#14, closing here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants