Examples of XMLTokenizer


Examples of de.pdark.decentxml.XMLTokenizer

   
    public static Document parse(final XMLSource xmlSource, final String originDetails) throws IOException {
        XMLParser parser = new XMLParser () {
            @Override
            protected XMLTokenizer createTokenizer(XMLSource source) {
                XMLTokenizer tolerantTokenizerIgnoringEntities = new TolerantXMLTokenizer(source, originDetails);
                tolerantTokenizerIgnoringEntities.setTreatEntitiesAsText (this.isTreatEntitiesAsText());
                return tolerantTokenizerIgnoringEntities;
            }
        };
        return parser.parse (xmlSource);  
    }
View Full Code Here

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

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

      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
Copyright © 2018 www.massapi.com. 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.