Package nu.xom

Examples of nu.xom.DocType


        if (elPartMeasures.get(xM).getChildCount() < 1)
          elDocPart.removeChild(xM);
    }
    //  create the Document
    Document xomDoc = new Document(root);
    DocType docType = new DocType("score-partwise",
            "-//Recordare//DTD MusicXML 1.1 Partwise//EN",
            "http://www.musicxml.org/dtds/partwise.dtd");
    xomDoc.insertChild(docType, 0);
    return xomDoc;
    //  GetMusicXMLDoc
View Full Code Here


     * the input is a XOM Document, which has been built previously
     * @throws Exception if there is an error parsing the pattern
     */
 
  public void parse() throws JFugueException
  DocType docType = xomDoc.getDocType();
    Element  root = xomDoc.getRootElement();
 
    if (docType.getRootElementName().compareToIgnoreCase("score-partwise") == 0)
    {  Element partlist = root.getFirstChildElement("part-list");
      Elements parts = partlist.getChildElements();
      XMLpart[] partHeaders = new XMLpart[parts.size()];
      for (int p = 0; p < parts.size(); ++p)
      {  partHeaders[p] = new XMLpart();
View Full Code Here

   
    Nodes nodes = nodeFactory.makeDocType(rootName, publicID, systemID);
    for (int k=0; k < nodes.size(); k++) {
      Node node = nodes.get(k);
      if (node instanceof DocType) {
        DocType docType = (DocType) node;
        if (docType.getInternalDTDSubset().length() == 0) {
          // xom >= 1.1 only
          String subset = (String) invoke(info, "getDTDInternalSubset");
          if (subset == MISSING_StAX2) return nodes;
          docType.setInternalDTDSubset(subset);
        }
      }
    }
    return nodes;
  }
View Full Code Here

    if (internalDTDSubset.length() == 0) internalDTDSubset = null;
   
    Nodes nodes = factory.makeDocType(rootElementName, publicID, systemID);
    for (int i=0; i < nodes.size(); i++) {
      if (nodes.get(i) instanceof DocType) {
        DocType docType = (DocType) nodes.get(i);
        if (docType.getInternalDTDSubset().length() == 0) {
          try {
            docType.setInternalDTDSubset(internalDTDSubset);
          } catch (IllegalAccessError e) {
            ; // ignore; setInternalDTDSubset() is private in xom < 1.1
          }
        }
      }
View Full Code Here

        log("", new Comment(data));
        return child.makeComment(data);
      }
 
      public Nodes makeDocType(String rootElementName, String publicID, String systemID) {
        log("", new DocType(rootElementName, publicID, systemID));
        return child.makeDocType(rootElementName, publicID, systemID);
      }
 
      public Nodes makeProcessingInstruction(String target, String data) {
        log("", new ProcessingInstruction(target, data));
View Full Code Here

      }
 
      public Nodes makeDocType(String rootElementName, String publicID, String systemID) {
        flush();
        try {
          serializer.write(new DocType(rootElementName, publicID, systemID));
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        return NONE;
      }
View Full Code Here

        } else if (child instanceof ProcessingInstruction) {
          ProcessingInstruction pi = (ProcessingInstruction) child;
          nodes = factory.makeProcessingInstruction(
            pi.getTarget(), pi.getValue());
        } else if (child instanceof DocType) {
          DocType docType = (DocType) child;
          nodes = factory.makeDocType(
              docType.getRootElementName(),
              docType.getPublicID(),
              docType.getSystemID());
        } else {
          throw new IllegalArgumentException("Unrecognized node type");
        }
       
        // append nodes:
View Full Code Here

//        if (ns.getPrefix().length() > 0) {
//          item.addAttribute(new Attribute("prefix", ns.getPrefix()));
//        }
//        item.addAttribute(new Attribute("uri", ns.getValue()));
      } else if (node instanceof DocType) {
        DocType docType = (DocType) node;
        Element e;
       
        e = new Element("rootName");
        e.appendChild(docType.getRootElementName());
        item.appendChild(e);
       
        if (docType.getPublicID() != null) {
          e = new Element("publicID");
          e.appendChild(docType.getPublicID());
          item.appendChild(e);
        }
        if (docType.getSystemID() != null) {
          e = new Element("systemID");
          e.appendChild(docType.getSystemID());
          item.appendChild(e);
        }
        if (docType.getInternalDTDSubset().length() > 0) {
          e = new Element("internalDTDSubset");
          e.appendChild(docType.getInternalDTDSubset());
          item.appendChild(e);
        }
      } else { // Element, Text, Comment, ProcessingInstruction
        item.appendChild(node.copy());
      }
View Full Code Here

   
    public void testDocTypeIsNotAnXPathNode() {
    
        Element root = new Element("root");
        Document doc = new Document(root);
        DocType doctype = new DocType("root");
        doc.setDocType(doctype);
       
        Nodes result = doc.query("child::node()[1]");
        assertEquals(1, result.size());
        assertEquals(root, result.get(0));
View Full Code Here

    public void testGetNodeBeforeDocType() {
    
        Element root = new Element("root");
        Document doc = new Document(root);
        DocType doctype = new DocType("root");
        doc.setDocType(doctype);
        Comment c = new Comment("test");
        doc.insertChild(c, 0);
       
        Nodes result = doc.query("child::node()[1]");
View Full Code Here

TOP

Related Classes of nu.xom.DocType

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.