Package nu.xom

Examples of nu.xom.Element.addAttribute()


    public MusicXmlRenderer()
    {  root = new Element("score-partwise");
   
      Element elID = new Element("identification");
      Element elCreator = new Element("creator");
      elCreator.addAttribute(new Attribute("type", "software"));
      elCreator.appendChild("JFugue MusicXMLRenderer");
      elID.appendChild(elCreator);
      root.appendChild(elID);
   
      //  add an empty score-part list here (before any parts are added)
View Full Code Here


    {
      Element elInstrName = new Element("instrument-name");
      elInstrName.appendChild(instrument.getInstrumentName());

      Element elInstrument = new Element("score-instrument");
      elInstrument.addAttribute(new Attribute("id", Byte.toString(instrument.getInstrument())));
      elInstrument.appendChild(elInstrName);
    }
   
    public void tempoEvent(Tempo tempo)
    {  doTempo(tempo);
View Full Code Here

    doTempo(tempo);
    }
   
    private void doTempo(Tempo tempo)
    {  Element elDirection = new Element("direction");
    elDirection.addAttribute(new Attribute("placement", "above"));
    Element elDirectionType = new Element("direction-type");
    Element elMetronome = new Element("metronome");
    Element elBeatUnit = new Element("beat-unit");
    //  assume quarter note beat unit
    elBeatUnit.appendChild("quarter");
View Full Code Here

      //  tie start/stop
      boolean bDoNotation = false;
      if (note.isStartOfTie())
      {  Element elTie = new Element("tie");
        Attribute atType = new Attribute("type", "start");
        elTie.addAttribute(atType);
        elNote.appendChild(elTie);
        bDoNotation = true;
      }
      else if (note.isEndOfTie())
      {  Element elTie = new Element("tie");
View Full Code Here

        bDoNotation = true;
      }
      else if (note.isEndOfTie())
      {  Element elTie = new Element("tie");
      Attribute atType = new Attribute("type", "stop");
      elTie.addAttribute(atType);
      elNote.appendChild(elTie);
        bDoNotation = true;
    }
      //  duration type
      String sDuration;
View Full Code Here

      if (bDoNotation)
      {  Element elNotations = new Element("notations");
        if (note.isStartOfTie())
        {  Element elTied = new Element("tied");
          Attribute atStart = new Attribute("type", "start");
          elTied.addAttribute(atStart);
          elNotations.appendChild(elTied);
        }
        else if (note.isEndOfTie())
        {  Element elTied = new Element("tied");
        Attribute atStart = new Attribute("type", "stop");
View Full Code Here

          elNotations.appendChild(elTied);
        }
        else if (note.isEndOfTie())
        {  Element elTied = new Element("tied");
        Attribute atStart = new Attribute("type", "stop");
        elTied.addAttribute(atStart);
        elNotations.appendChild(elTied);
      }
        elNote.appendChild(elNotations);
      }
      if (elCurMeasure == null)
View Full Code Here

   
    // Append attributes
    AxisIterator iter = node.iterateAxis(Axis.ATTRIBUTE);
    ArrayList prefixes = null;
    while ((next = (NodeInfo) iter.next()) != null) {
      elem.addAttribute((Attribute) convertNodeInfo(next));
     
      // keep track of attributes with prefixes, so we can avoid adding costly
      // additional namespaces declarations below. This safes potentially vast
      // amounts of memory due too XOM's expensive NS declaration storage scheme.
      String prefix = next.getPrefix();
View Full Code Here

      item = new Element(item);

      // add copy of content to wrapper:
      if (node instanceof Attribute) {
        Attribute attr = (Attribute) node;         
        item.addAttribute((Attribute) attr.copy());
      } else if (node instanceof Document) {
        Document doc = (Document) node;         
        for (int j=0; j < doc.getChildCount(); j++) {
          item.appendChild(doc.getChild(j).copy());
        }
View Full Code Here

       
        Element root = new Element("root", "http://www.example.org");
        Document doc = new Document(root);
        root.appendChild(new Element("child"));
        root.appendChild("test");
        root.addAttribute(new Attribute("test", "test"));
       
        try {
            doc.query("//");
            fail("Queried //");
        }
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.