Package dk.brics.xact.analysis

Examples of dk.brics.xact.analysis.XMLAnalysisException


  }
  private String getConstantString(Value v, Origin orig) {
    if (v instanceof StringConstant)
      return ((StringConstant)v).value;
    else
      throw new XMLAnalysisException("Constant string expected", orig);
  }
View Full Code Here


      return null;
    }
    if (System.getProperty("dk.brics.xact.analysis.ignore-non-constant-string") != null) {
      return "NONCONSTANT";
    }
    throw new XMLAnalysisException("Constant string expected", getCurrentOrigin());
  }
View Full Code Here

      if (lastSlash==-1)
        return "";
      else
        return s.substring(0, lastSlash);
    } else {
      throw new XMLAnalysisException("Class constant expected", getCurrentOrigin());
    }
  }
View Full Code Here

   * Assumes UTF-8.
   */
  public String getResourceString(String name) {
    InputStream in = TranslatorContext.class.getClassLoader().getResourceAsStream(name);
    if (in == null)
      throw new XMLAnalysisException("Resource not found: " + name, getCurrentOrigin());
    BufferedReader reader = null;
    try {
      StringBuilder sb = new StringBuilder(1000);
          reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
          char[] cb = new char[1024];
          int len=0;
          while((len = reader.read(cb)) != -1)
              sb.append(cb, 0, len);
      return sb.toString();
    } catch (IOException e) {
      throw new XMLAnalysisException(e, getCurrentOrigin());
    } finally {
      try {
        if (reader != null)
          reader.close();
      } catch (IOException e) {
        throw new XMLAnalysisException(e, getCurrentOrigin());
      }
    }
  }
View Full Code Here

 
  public SchemaType parseSchemaType(String annotation, Origin origin) {
    if (annotation == null)
      return null;
   
    XMLAnalysisException ex = new XMLAnalysisException("Malformed @Type argument '" + annotation + "'", getCurrentOrigin());
    annotation = annotation.trim();
    // make schema
    SchemaType schema;
    int leftbrack = annotation.indexOf('[');
    int rightbrack = annotation.lastIndexOf(']');
View Full Code Here

          return XMLParser.parse(new ByteArrayInputStream(str.getBytes("UTF-8")), "UTF-8", true, context.getNamespaces(), origin);
      } catch (XMLTemplateException ex) {
          error(ErrorType.MALFORMED_XML_CONSTANT, ex.getMessage());
          return null;
      } catch (IOException ex) {
          throw new XMLAnalysisException(ex, origin);
      }
  }
View Full Code Here

            XMLGraph type_xg = b.getGlobalXMLGraph().clone();
            SchemaType schema = s.getSchema();
            String type = schema.getType();
            Node n = fg.getTypemap().get(type);
            if (n == null)
              throw new XMLAnalysisException("No schema definition found for " + type, s.getOrigin());
            type_xg.useFragment(new XMLGraphFragment(n, null, null, null));
            Map<String,String> gaptypes = schema.getGapTypes();
            if (gaptypes == null)
                gaptypes = Collections.emptyMap();
            for (Map.Entry<String,String> valueGapType : value_xg.getGapTypeMap().entrySet()) {
View Full Code Here

              System.err.println("Error: " + msg + " at " + s.getOrigin());
              Node empty = new ChoiceNode(new LinkedHashSet<Integer>(), s.getOrigin());
              global_xg.addNode(empty);
              stm_nodes.setTemplateConstantXMLFragment(t, new XMLGraphFragment(empty, new HashSet<String>(), new HashSet<String>(), new HashMap<String,String>()));
            } else {
              throw new XMLAnalysisException(msg, s.getOrigin());
            }
          }
        }

        @Override
View Full Code Here

            if (agap)
              g.addOpenAttributeGap(gapname);
            if (s.getSchema() != null) {
              if (g.getGapTypeMap().get(gapname) != null &&
                  !g.getGapTypeMap().get(gapname).equals(s.getSchema().getType()))
                throw new XMLAnalysisException("Different types of gap '" + gapname + "'", s.getOrigin());
              g.getGapTypeMap().put(gapname, s.getSchema().getType());
            }
          }
        }
        if (add_gap) {
View Full Code Here

TOP

Related Classes of dk.brics.xact.analysis.XMLAnalysisException

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.