Return-Path: X-Original-To: apmail-ant-user-archive@www.apache.org Delivered-To: apmail-ant-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 42754422F for ; Thu, 7 Jul 2011 14:31:29 +0000 (UTC) Received: (qmail 5418 invoked by uid 500); 7 Jul 2011 14:31:28 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 5289 invoked by uid 500); 7 Jul 2011 14:31:27 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 5281 invoked by uid 99); 7 Jul 2011 14:31:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 14:31:27 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of Steve.Amerige@sas.com designates 65.55.88.14 as permitted sender) Received: from [65.55.88.14] (HELO TX2EHSOBE007.bigfish.com) (65.55.88.14) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 14:31:19 +0000 Received: from mail170-tx2-R.bigfish.com (10.9.14.242) by TX2EHSOBE007.bigfish.com (10.9.40.27) with Microsoft SMTP Server id 14.1.225.22; Thu, 7 Jul 2011 14:30:58 +0000 Received: from mail170-tx2 (localhost.localdomain [127.0.0.1]) by mail170-tx2-R.bigfish.com (Postfix) with ESMTP id B1B70FD045F for ; Thu, 7 Jul 2011 14:30:57 +0000 (UTC) X-SpamScore: -22 X-BigFish: S-22(zzbb2dK9371M103dKc85dh1432N1a09M98dK853kzz1202hzz8275bh8275dhz2fh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:149.173.6.147;KIP:(null);UIP:(null);IPVD:NLI;H:mercav04d.na.sas.com;RD:mercav04d.na.sas.com;EFVD:NLI Received-SPF: pass (mail170-tx2: domain of sas.com designates 149.173.6.147 as permitted sender) client-ip=149.173.6.147; envelope-from=Steve.Amerige@sas.com; helo=mercav04d.na.sas.com ;d.na.sas.com ; Received: from mail170-tx2 (localhost.localdomain [127.0.0.1]) by mail170-tx2 (MessageSwitch) id 1310049057430244_20407; Thu, 7 Jul 2011 14:30:57 +0000 (UTC) Received: from TX2EHSMHS017.bigfish.com (unknown [10.9.14.245]) by mail170-tx2.bigfish.com (Postfix) with ESMTP id 4EAB17004B for ; Thu, 7 Jul 2011 14:30:57 +0000 (UTC) Received: from mercav04d.na.sas.com (149.173.6.147) by TX2EHSMHS017.bigfish.com (10.9.99.117) with Microsoft SMTP Server (TLS) id 14.1.225.22; Thu, 7 Jul 2011 14:30:53 +0000 X-TM-IMSS-Message-ID: <674bd007000002be@mercav04d.na.sas.com> Received: from [10.25.11.12] ([10.25.11.12]) by mercav04d.na.sas.com ([10.36.10.9]) with ESMTP (TREND IMSS SMTP Service 7.1) id 674bd007000002be ; Thu, 7 Jul 2011 10:30:52 -0400 Message-ID: <4E15C31C.5040109@sas.com> Date: Thu, 7 Jul 2011 10:30:52 -0400 From: Steve Amerige User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 ThunderBrowse/3.3.5 MIME-Version: 1.0 To: Subject: Re: Syntax for Names: target, property, macrodef, etc. References: <4E0C633F.2000807@sas.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------060405010108070000010004" X-OriginatorOrg: sas.com X-Virus-Checked: Checked by ClamAV on apache.org --------------060405010108070000010004 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit When I look at the 1.8.2 codebase, I see in: ant-1.8.2\src\main\org\apache\tools\ant\taskdefs\MacroDef.java /** * Check if a character is a valid character for an element or * attribute name. * * @param c the character to check * @return true if the character is a letter or digit or '.' or '-' * attribute name */ public static boolean isValidNameCharacter(char c) { // ? is there an xml api for this ? return Character.isLetterOrDigit(c) || c == '.' || c == '-'; } This seems to be at odds with the specification: http://www.w3.org/TR/xml/#sec-common-syn Names and Tokens [4] |NameStartChar| ::= |":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]| [4a] |NameChar| ::= |NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]| [5] |Name| ::= |NameStartChar (NameChar )*| [6] |Names| ::= |Name (#x20 Name )*| [7] |Nmtoken| ::= |(NameChar )+| [8] |Nmtokens| ::= |Nmtoken (#x20 Nmtoken )*| I've also looked at: ant-1.8.2\src\main\org\apache\tools\ant\taskdefs\AntStructure.java /** * Does this String match the XML-NMTOKEN production? * @param s the string to test * @return true if the string matches the XML-NMTOKEN */ public static final boolean isNmtoken(String s) { final int length = s.length(); for (int i = 0; i < length; i++) { char c = s.charAt(i); // XXX - we are committing CombiningChar and Extender here if (!Character.isLetterOrDigit(c) && c != '.' && c != '-' && c != '_' && c != ':') { return false; } } return true; } Maybe I'm looking at the wrong part in the code for where *element* names (such as macrodef and scriptdef) are validated and where other names (such as property name="...") are validated. But, the Ant code doesn't match what is specified by the XML BNF. Also, the XML BNF doesn't seem to allow spaces in a *Name* object. Is there an Ant BNF specification that reflects the code? Is there any formal specification for Ant syntax? Where do I find it? Sorry to be a bother! But, I'm just trying to be very clear in understanding Ant and am hoping that a formal specification exists. Many thanks! Steve Amerige SAS Institute, Deployment Software Developer On 6/30/2011 9:31 AM, Dominique Devienne wrote: > On Thu, Jun 30, 2011 at 6:51 AM, Steve Amerige wrote: >> I'm looking for the authoritative specification within Ant for the value of >> the name attribute as in: >> >> >> >> >> >> and so forth. I can't find within the Ant manual any BNF that defines what >> a valid name is allowed to be. > Anything goes really, AFAIK. There is no specifications. > > Some names will create issues, for example can't > be called from the command line because -foo will be interpreted as a > CLI switch and since not found Ant will error out. This "behavior" is > relied upon to have "private" targets. > > Also remember this is XML land, so attribute whitespace normalization > will apply (depending on the parser used possibly) which may result in > some whitespaces being removed. > > But aside from these quirks, Ant does not put any restrictions on > names in general. --DD > > PS: Also keep in mind that property expansion does occurs inside these > names, but I assume you mean the names after expansion. --------------060405010108070000010004--