예제 #1
0
 /**
  * Return the value of the source attribute if it exists.
  *
  * @param node the node containing attributes
  * @return the source path or {@code null} if not defined
  */
 private String getScriptSourcePath(XmlTagNode node) {
   for (XmlAttributeNode attribute : node.getAttributes()) {
     if (attribute.getName().getLexeme().equals(SRC)) {
       String text = attribute.getText();
       return text != null && text.length() > 0 ? text : null;
     }
   }
   return null;
 }
예제 #2
0
 /**
  * Determine if the specified node is a Dart script.
  *
  * @param node the node to be tested (not {@code null})
  * @return {@code true} if the node is a Dart script
  */
 private boolean isScriptNode(XmlTagNode node) {
   if (node.getTagNodes().size() != 0 || !node.getTag().getLexeme().equals(SCRIPT)) {
     return false;
   }
   for (XmlAttributeNode attribute : node.getAttributes()) {
     if (attribute.getName().getLexeme().equals(TYPE)) {
       Token valueToken = attribute.getValue();
       if (valueToken != null) {
         String value = valueToken.getLexeme();
         if (value.equals(APPLICATION_DART_IN_DOUBLE_QUOTES)
             || value.equals(APPLICATION_DART_IN_SINGLE_QUOTES)) {
           return true;
         }
       }
     }
   }
   return false;
 }
 private Token scanAttribute(AngularHtmlUnitResolver resolver, XmlAttributeNode attribute) {
   int offset = attribute.getValueToken().getOffset() + 1;
   String value = attribute.getText();
   return resolver.scanDart(value, 0, value.length(), offset);
 }
 private void setExpression(XmlAttributeNode attribute, XmlExpression xmlExpression) {
   attribute.setExpressions(new XmlExpression[] {xmlExpression});
 }
 protected void setExpressions(XmlAttributeNode attribute, List<XmlExpression> xmlExpressions) {
   attribute.setExpressions(xmlExpressions.toArray(new XmlExpression[xmlExpressions.size()]));
 }