Package org.eclipse.wst.xml.core.internal.parser

Examples of org.eclipse.wst.xml.core.internal.parser.XMLTokenizer


    final Pattern nsNamePattern = Pattern.compile("xmlns:.*"); //$NON-NLS-1$

    String attributeName = null;
    String attributeValue = null;

    XMLTokenizer tokenizer = new XMLTokenizer(contents);

    String token = tokenizer.primGetNextToken();
    while (token != null &&
        !DOMRegionContext.XML_TAG_CLOSE.equals(token) &&
        !DOMRegionContext.XML_EMPTY_TAG_CLOSE.equals(token)) {

      if (DOMRegionContext.XML_TAG_ATTRIBUTE_NAME.equals(token)) {
        attributeName = tokenizer.yytext();
      }
      else if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(token)) {
        attributeValue = StringUtils.strip(tokenizer.yytext());
        for (int i = 0; i < nsValuePatterns.length; i++) {
          if (nsNamePattern.matcher(attributeName).matches()) {
            if (nsValuePatterns[i].matcher(attributeValue).matches()) {
              return VALID;
            }
          }
        }
      }
      token = tokenizer.primGetNextToken();
    }
    return INVALID;
  }
View Full Code Here


      return INVALID;

    String attributeName = null;
    String attributeValue = null;

    XMLTokenizer tokenizer = new XMLTokenizer(contents);

    String token = tokenizer.primGetNextToken();
    while (token != null &&
        !DOMRegionContext.XML_TAG_CLOSE.equals(token) &&
        !DOMRegionContext.XML_EMPTY_TAG_CLOSE.equals(token)) {

      if (DOMRegionContext.XML_TAG_ATTRIBUTE_NAME.equals(token)) {
        attributeName = tokenizer.yytext();
      }
      else if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(token)) {
        attributeValue = StringUtils.strip(tokenizer.yytext());
        for (int i = 0; i < fPairs.length; i++) {
          boolean nameMatched = fPairs[i].attribute.matcher(attributeName).matches();
          if(nameMatched) {
            boolean valueMatched = fPairs[i].value.matcher(attributeValue).matches();
            if(valueMatched) {
              return VALID;
            }
          }
        }
      }
      token = tokenizer.primGetNextToken();
    }
    return INVALID;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.core.internal.parser.XMLTokenizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.