Examples of useFragment()


Examples of dk.brics.xmlgraph.XMLGraph.useFragment()

   * @param wrapchoices if set, extra choice nodes are added around attribute nodes and
   *       element nodes and above text nodes
   */
  public static XMLGraph convert(XML x, GapConversion gaps, boolean wrapchoices) {
    XMLGraph xg = new XMLGraph();
    xg.useFragment(extend(xg, x, gaps, wrapchoices));
    return xg;
  }
 
  private static final class PendingNode {
    public Node node;
View Full Code Here

Examples of dk.brics.xmlgraph.XMLGraph.useFragment()

  }

  public XMLGraph transferValidate(final ValidateStm s, XMLGraph base) {
    final SchemaType schema = s.getSchema();
    final XMLGraph g = global_xg.clone();
    g.useFragment(new XMLGraphFragment(schema.getTypeNode(), schema.getTemplateGaps(), schema.getAttributeGaps(), schema.getGapTypes()));
    g.sharpen();
    return g;
  }
 
  /**
 
View Full Code Here

Examples of dk.brics.xmlgraph.XMLGraph.useFragment()

          if (g.getOpenTemplateGaps().remove(n.getName())) {
            g.getClosedTemplateGaps().add(n.getName());
          }
         
          XMLGraph sub = b.getGlobalXMLGraph().clone();
          sub.useFragment(new XMLGraphFragment(typeNode, null, null, null));
          g.merge(sub);
         
          n.setContentAndStatus(false, n.isRemoved(), cs, g);
         
          // get the original roots back
View Full Code Here

Examples of dk.brics.xmlgraph.XMLGraph.useFragment()

              if (gapType != null) {
                  XMLGraph value_xg = b.getIn(s, s.getXMLSource());
                  XMLGraph type_xg = b.getGlobalXMLGraph().clone();
//                  SequenceNode n = b.getSchemaTypes().get(gapType);
                  Node n = fg.getTypemap().get(gapType);
                  type_xg.useFragment(new XMLGraphFragment(n, null, null, null));
                  Validator validator = new Validator(new ValidationErrorHandler() {
                                public boolean error(ElementNode n, Origin origin, String msg,
                                        String example, Origin schema) {
                                    if (example == null)
                                         example = "";
View Full Code Here

Examples of dk.brics.xmlgraph.XMLGraph.useFragment()

             
          case CLOSE:
              if (g.getGapTypeMap().isEmpty())
                  return;
              XMLGraph empty_xg = b.getGlobalXMLGraph().clone();
              empty_xg.useFragment(new XMLGraphFragment(b.getEmptySequence(), null, null, null));
                        XMLGraph type_xg = b.getGlobalXMLGraph().clone();
              for (final Map.Entry<String,String> gapentry : g.getGapTypeMap().entrySet()) {
                  final String gapName = gapentry.getKey();
                  final String gapType = gapentry.getValue();
                          Node n = fg.getTypemap().get(gapType);
View Full Code Here

Examples of dk.brics.xmlgraph.XMLGraph.useFragment()

                        XMLGraph type_xg = b.getGlobalXMLGraph().clone();
              for (final Map.Entry<String,String> gapentry : g.getGapTypeMap().entrySet()) {
                  final String gapName = gapentry.getKey();
                  final String gapType = gapentry.getValue();
                          Node n = fg.getTypemap().get(gapType);
                          type_xg.useFragment(new XMLGraphFragment(n, null, null, null));
                  Validator validator = new Validator(new ValidationErrorHandler() {
                                public boolean error(ElementNode n, Origin origin, String msg,
                                        String example, Origin schema) {
                                    if (example == null)
                                         example = "";
View Full Code Here

Examples of dk.brics.xmlgraph.XMLGraph.useFragment()

            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()) {
                String typeGapType = gaptypes.get(valueGapType.getKey());
View Full Code Here

Examples of dk.brics.xmlgraph.XMLGraph.useFragment()

    return g;
  }

  public XMLGraph transferConst(ConstStm s) {
    final XMLGraph g = global_xg.clone();
    g.useFragment(stm_nodes.getTemplateConstantXMLFragment(s.getConst()));
    // open gaps
    g.processReachableNodes(new NodeProcessor<Object>() {
      @Override
      public Object process(ChoiceNode n) {
        if (n.isGap() && !n.isOpen()) {
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.