Package slash.navigation.kml.binding20

Examples of slash.navigation.kml.binding20.Document


  public void testOutputDocumentFull() {
    DocType dt = new DocType("root");
    Comment comment = new Comment("comment");
    ProcessingInstruction pi = new ProcessingInstruction("jdomtest", "");
    Element root = new Element("root");
    Document doc = new Document();
    doc.addContent(dt);
    doc.addContent(comment);
    doc.addContent(pi);
    doc.addContent(root);
    String xmldec = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    String dtdec = "<!DOCTYPE root>";
    String commentdec = "<!--comment-->";
    String pidec = "<?jdomtest?>";
    String rtdec = "<root />";
View Full Code Here


  @Test
  public void testDeepNesting() {
    // need to get beyond 16 levels of XML.
    DocType dt = new DocType("root");
    Element root = new Element("root");
    Document doc = new Document();
    doc.addContent(dt);
    doc.addContent(root);
    String xmldec = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    String dtdec = "<!DOCTYPE root>";
    String lf = "\n";
   
    StringBuilder raw = new StringBuilder();
View Full Code Here

      if (START_DOCUMENT != state) {
        throw new JDOMException("JDOM requires that XMLStreamReaders " +
            "are at their beginning when being processed.");
      }

      final Document document = factory.document(null);

      while (state != END_DOCUMENT) {
        switch (state) {

          case START_DOCUMENT:
            // for the <?xml version="..." standalone=".."?>
            document.setBaseURI(stream.getLocation().getSystemId());
            document.setProperty("ENCODING_SCHEME",
                stream.getCharacterEncodingScheme());
            document.setProperty("STANDALONE",
                String.valueOf(stream.isStandalone()));
            document.setProperty("ENCODING",
                stream.getEncoding());
            break;

          case DTD:
            document.setDocType(DTDParser.parse(
                stream.getText(), factory));
            break;

          case START_ELEMENT:
            document.setRootElement(processElementFragment(factory, stream));
            break;

          case END_ELEMENT:
            throw new JDOMException("Unexpected XMLStream event at Document level: END_ELEMENT");
          case ENTITY_REFERENCE:
            throw new JDOMException("Unexpected XMLStream event at Document level: ENTITY_REFERENCE");
          case CDATA:
            throw new JDOMException("Unexpected XMLStream event at Document level: CDATA");
          case SPACE:
            throw new JDOMException("Unexpected XMLStream event at Document level: SPACE");
          case CHARACTERS:
            throw new JDOMException("Unexpected XMLStream event at Document level: CHARACTERS");

          case COMMENT:
            document.addContent(
                factory.comment(stream.getText()));
            break;

          case PROCESSING_INSTRUCTION:
            document.addContent(factory.processingInstruction(
                stream.getPITarget(), stream.getPIData()));
            break;

          default:
            throw new JDOMException("Unexpected XMLStream event " + state);
View Full Code Here

    /* Load the map. This is called in the main class upon game start */
    public void load(File loadFile) {
        try {
            SAXBuilder builder = new SAXBuilder();
            Document document = builder.build(loadFile);
            Element root = document.getRootElement();

            for (Element tile : root.getChildren()) {
                int x = (int) Double.parseDouble(tile.getAttributeValue("x"));
                int y = (int) Double.parseDouble(tile.getAttributeValue("y"));
                tiles[x][y] = new Tile(TileType.valueOf(tile.getAttributeValue("type")), x, y, 32, 32);
View Full Code Here

        System.out.println("Loaded map: " + loadFile.getName());
    }

    public void save(File saveFile) {
        Document document = new Document();
        Element root = new Element("tiles");
        document.setRootElement(root);

        for (int x = 0; x < AMOUNT_TILES_WIDTH; x++) {
            for (int y = 0; y < AMOUNT_TILES_HEIGHT; y++) {
                Element tile = new Element("tile");
                System.out.println("X: " + tiles[x][y].getX() + " Y: " + tiles[x][y].getY() + " Type: " + String.valueOf(tiles[x][y].getType()));
View Full Code Here

  private static final String PLAYER = "player";
 
  public static Tree<String> buildDemoPokerTree() throws JDOMException, IOException {
    NodeMetaInfo<String> root = null;
    SAXBuilder parser = new SAXBuilder();
    Document doc = parser.build("/home/m1/programming/java/jPokerTreeView/data/large_tree.xml");
    Element data = doc.getRootElement().getChildren().get(0);
    root = convert(data);
    root.setChildren(convert(data.getChildren()));
   
    Tree<String> tree = new Tree<String>(root);
    return tree;
View Full Code Here

  }
 
  public static Tree<String> buildPokerTree(String filePath) throws JDOMException, IOException{
    NodeMetaInfo<String> root = null;
    SAXBuilder parser = new SAXBuilder();
    Document doc = parser.build(filePath);
    Element data = doc.getRootElement().getChildren().get(0);
    root = convert(data);
    root.setChildren(convert(data.getChildren()));
   
    Tree<String> tree = new Tree<String>(root);
    return tree;
View Full Code Here

  }
 
  public static Tree<String> buildDemoPokerSmallTree() throws JDOMException, IOException {
    NodeMetaInfo<String> root = null;
    SAXBuilder parser = new SAXBuilder();
    Document doc = parser.build("/home/m1/programming/java/jPokerTreeView/data/simple_tree.xml");
    Element data = doc.getRootElement().getChildren().get(0);
    root = convert(data);
    root.setChildren(convert(data.getChildren()));
    Tree<String> tree = new Tree<String>(root);
    return tree;
  }
View Full Code Here

                String cleanScmUrl = "not defined";
                try
                {
                    String content = ReleaseUtil.readXmlFile(pomFile, ls);
                    SAXBuilder builder = new SAXBuilder();
                    Document document = builder.build(new StringReader( content ));
                    Element root = document.getRootElement();

                    Element scmElement = root.getChild("scm", getNamespaceOrNull(root));

                    if(null != scmElement)
                    {
View Full Code Here

    if (messageFormatIS == null) {
      logger.debug("file messageformat.xml not found in classpath");
    } else {
      try {
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(messageFormatIS);

        messageFormatIS.close();

        Element rootElement = document.getRootElement();
        List<Element> markers = rootElement.getChildren("marker");
        for (Element marker : markers) {
          AbstractFoundationLoggingMarker.markersXmlMap.put(marker.getAttributeValue("id"), marker);
        }
View Full Code Here

TOP

Related Classes of slash.navigation.kml.binding20.Document

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.