Package org.jdom

Examples of org.jdom.Comment


  private static void buildRepositoriesFile(String src, String des) throws Exception
  {
    Element root  = Xml.loadFile(src);

    // --- insert warning into file as comment - first child element
    root.addContent(0,new Comment("\nWARNING - Do NOT MODIFY this file!\n"+
    "It is AUTOMATICALLY GENERATED by GeoNetwork each time it starts up \n"+
    "from the contents of "+src+".\n"));

    //--- now output the repositories file
    FileOutputStream os = new FileOutputStream(des);
View Full Code Here


              case XMLStreamConstants.CHARACTERS:
                  element.addContent(new Text(currentEvent.asCharacters().getData()));
                  break;
 
              case XMLStreamConstants.COMMENT:
                  element.addContent(new Comment(currentEvent.asCharacters().getData()));
                  break;
 
              case XMLStreamConstants.ENTITY_REFERENCE:
                EntityReference er = (EntityReference)currentEvent;
                  element.addContent(new EntityRef(er.getName(), er.getDeclaration().getPublicId(), er.getDeclaration().getSystemId()));
View Full Code Here

        return pi.getData();
    }

    public String getCommentStringValue(Object obj)
    {
        Comment cmt = (Comment) obj;

        return cmt.getText();
    }
View Full Code Here

    public void writeDefaultNamespace(String namespace) throws XMLStreamException {
        currentNode.addNamespaceDeclaration(Namespace.getNamespace("", namespace));
    }

    public void writeComment(String value) throws XMLStreamException {
        currentNode.addContent(new Comment(value));
    }
View Full Code Here

  }

  private void normaliseLineEndings(final Document document) {
    final Iterator i = document.getDescendants(new ContentFilter(ContentFilter.COMMENT));
    while (i.hasNext()) {
      final Comment c = (Comment) i.next();
      c.setText(c.getText().replaceAll("\n", SEPARATOR));
    }
  }
View Full Code Here

    public void writeDefaultNamespace(String namespace) throws XMLStreamException {
        currentNode.addNamespaceDeclaration(Namespace.getNamespace("", namespace));
    }

    public void writeComment(String value) throws XMLStreamException {
        currentNode.addContent(new Comment(value));
    }
View Full Code Here

    private void normaliseLineEndings( Document document )
    {
        for ( Iterator<?> i = document.getDescendants( new ContentFilter( ContentFilter.COMMENT ) ); i.hasNext(); )
        {
            Comment c = (Comment) i.next();
            c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) );
        }
        for ( Iterator<?> i = document.getDescendants( new ContentFilter( ContentFilter.CDATA ) ); i.hasNext(); )
        {
            CDATA c = (CDATA) i.next();
            c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) );
        }
    }
View Full Code Here

    private int getInsertPosition( Element webapp, String[] startAfter, String[] stopBefore )
        throws JDOMException, IOException
    {
        List children = webapp.getContent();
        Content insertAfter = new Comment( "inserted by gwt-maven-plugin" );

        ArrayList<String> namesBefore = new ArrayList<String>();
        ArrayList<String> namesAfter = new ArrayList<String>();

        for ( int i = 0; i < startAfter.length; i++ )
View Full Code Here

      TYPE_DEF_STACK.set(new Stack<String>());
    }

    if (type != null) {
      if (TYPE_DEF_STACK.get().contains(type.getQualifiedName())) {
        parent.addContent(new Comment("..."));
      }
      else if (type instanceof EnumTypeDefinition) {
        parent.addContent(new org.jdom.Text("..."));
      }
      else {
        XmlType baseType = type.getBaseType();
        if (baseType instanceof XmlClassType) {
          TypeDefinition typeDef = ((XmlClassType) baseType).getTypeDefinition();
          if (typeDef != null) {
            generateExampleXml(typeDef, parent, defaultNs, maxDepth);
          }
        }

        TYPE_DEF_STACK.get().push(type.getQualifiedName());
        for (Attribute attribute : type.getAttributes()) {
          generateExampleXml(attribute, parent, defaultNs);
        }
        if (type.getValue() != null) {
          generateExampleXml(type.getValue(), parent);
        }
        else {
          for (Element element : type.getElements()) {
            generateExampleXml(element, parent, defaultNs, maxDepth);
          }
        }
        TYPE_DEF_STACK.get().pop();
      }
    }
    else {
      parent.addContent(new Comment("..."));
    }
  }
View Full Code Here

                }
                if (typedef.getValue() != null) {
                  el.addContent(new Text("..."));
                }
                else {
                  el.addContent(new Comment("..."));
                }
              }
              else {
                el.addContent(new Text("..."));
              }
            }

            parent.addContent(el);
          }
          else {
            String namespace = ref.getNamespaceURI();
            String name = ref.getLocalPart();
            String prefix = namespace == null ? null : ((EnunciateFreemarkerModel) FreemarkerModel.get()).getNamespacesToPrefixes().get(namespace);
            Namespace jdomNS;
            if (Namespace.XML_NAMESPACE.getURI().equals(namespace)) {
              jdomNS = Namespace.XML_NAMESPACE;
            }
            else if (namespace == null || "".equals(namespace)) {
              jdomNS = Namespace.NO_NAMESPACE;
            }
            else if (namespace.equals(defaultNs)) {
              jdomNS = Namespace.getNamespace("", namespace);
            }
            else {
              jdomNS = Namespace.getNamespace(prefix, namespace);
            }
            org.jdom.Element el = new org.jdom.Element(name, jdomNS);
            el.addContent(new Text("..."));
            parent.addContent(el);
          }
        }
        if (iterations > 1) {
          parent.addContent(new Comment("...more \"" + (ref == null ? choice.getName() : ref.getLocalPart()) + "\" elements..."));
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.jdom.Comment

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.