Thanks, Dermot, for explaining, and for clarifying the comment.
The changes should be fine then.
Thanks,
Jack
On 11/05/10 10:24, Dermot McCluskey wrote:
Hi Jack,
Thanks for looking at this.
On 11/05/10 17:07, Jack Schwartz wrote:
Hi Dermot.
Line 334 looks incorrect to me... The regular expression:
'^{.*}base$'
requires that "base" be at the end of the line. This is not what you
want, according to the comment on line 330: there's a filename after
"base".
From the example that I put in the comments:
330 #
{http://www.w3.org/XML/1998/namespace}base="/path/to/sub-doc.xml"
That is meant to represent what the attribute would look like
printed out.
Everything up to the "=" is the attribute name and everything
in quotes after the "=" is the attribute value.
It's only the attribute name that I'm comparing here.
Sorry if that wasn't clear. I'll reword it as follows.
Change:
# If a sub-document was xincluded from a different directory
# from the main doc, lxml will add an attribute, eg
# {http://www.w3.org/XML/1998/namespace}base="/path/to/sub-doc.xml"
# which we don't want, so we delete it, if found.
to:
# If a sub-document is xincluded from a directory other than that where
# the main doc is located, lxml will add an attribute whose name
# is typically "{http://www.w3.org/XML/1998/namespace}base"
# and whose value is the base location of the sub-document,
# eg "/path/to/sub-doc.xml".
# We don't want this attribute in our XML, so we remove it, if found.
And as per the comments from Joe, I'll backslash the curly braces
in the regex to make it clear they are not special meaning characters
here.
Thanks.
- Dermot
I did a few quick checks to validate my claims:
schwa...@jslaptop:~$ python
Python 2.6.4 (r264:75706, Oct 21 2010, 03:48:43) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> base_attrib = re.compile(r'^{.*}base$')
>>>
a='{http://www.w3.org/XML/1998/namespace}base="/path/to/sub-doc.xml"'
>>> print base_attrib.match(a)
None <<--- This is "no match"
>>> print base_attrib.match("{ }base")
<_sre.SRE_Match object at 0x80fa4b8> <<--- match; "base" at the end.
>>> print base_attrib.match("{ }base=")
None <<--- No match; "base" not at the end.
>>>
Thanks,
Jack
On 11/05/10 04:42, Dermot McCluskey wrote:
Hi,
Can I get a review for this fairly simple fix for ManifestParser bug:
http://monaco.sfbay/detail.jsf?cr=6997263
Webrev is at: http://cr.opensolaris.org/~dermot/webrev-6997263/
Thanks,
- Dermot
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss