Package nu.xom

Examples of nu.xom.Attribute


    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


    {
      if (elCurPart == null)
        newVoice(new Voice((byte)0));
      if (elCurMeasure == null)
      {  elCurMeasure = new Element("measure");
      elCurMeasure.addAttribute(new Attribute("number", Integer.toString(1)));
       
        //  assemble attributes element
        Element elAttributes = new Element("attributes");
        if (bAddDefaults)
        {  //  divisions - 4 per beat
View Full Code Here

    //  finishCurrentVoice

    private void newVoice(Voice voice)
    {//  add a part to the part list
      elCurScorePart = new Element("score-part");
      Attribute atPart = new Attribute("id", voice.getMusicString());
      elCurScorePart.addAttribute(atPart);
      //  empty part name - Finale ignores it and Sibelius gets it wrong
      elCurScorePart.appendChild(new Element("part-name"));
      Element elPL = root.getFirstChildElement("part-list");
      elPL.appendChild(elCurScorePart);
     
      //  start a new part - note that the score-part and the part have the
      //  same id attribute
      elCurPart = new Element("part");
      Attribute atPart2 = new Attribute(atPart);
      elCurPart.addAttribute(atPart2);
      elCurMeasure = null;
      doFirstMeasure(true);
    //  newVoice
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);
    }
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

      Elements elMeasures = elCurPart.getChildElements("measure");
      Element elLastMeasure = null;
    if (elMeasures.size() > 0)
    {  elLastMeasure = elMeasures.get(elMeasures.size()-1);
      //  get the new measure number from the last one
      Attribute elNumber = elLastMeasure.getAttribute("number");
      if (elLastMeasure.getChildElements("note").size() < 1)
        bNewMeasure = false;
      else
        nextNumber = Integer.parseInt(elNumber.getValue()) + 1;
      }
    else
    //  first measure may not have been added yet
      bNewMeasure = (elCurMeasure.getChildElements("note").size() > 0);
    }
      if (bNewMeasure)
      {  //  start the new measure
      elCurMeasure = new Element("measure");
     
      //  add the new measure number
      elCurMeasure.addAttribute(new Attribute("number",
                    Integer.toString(nextNumber)));
      }
      //  else continue using the same elCurMeasure
    //  newMeasure
View Full Code Here

      elNote.appendChild(elDuration);
      //  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");
      Attribute atType = new Attribute("type", "stop");
      elTie.addAttribute(atType);
      elNote.appendChild(elTie);
        bDoNotation = true;
    }
      //  duration type
      String sDuration;
      boolean bDotted = false;
      if (dDuration == 1.0)
        sDuration = "whole";
        else if (dDuration == 0.75)
        {  sDuration = "half";
          bDotted = true;
        }
        else if (dDuration == 0.5)
          sDuration = "half";
        else if (dDuration == 0.375)
        {  sDuration = "quarter";
          bDotted = true;
        }
        else if (dDuration == 0.25)
          sDuration = "quarter";
        else if (dDuration == 0.1875)
        {  sDuration = "eighth";
          bDotted = true;
        }
        else if (dDuration == 0.125)
          sDuration = "eighth";
        else if (dDuration == 0.09375)
        {  sDuration = "16th";
          bDotted = true;
        }
        else if (dDuration == 0.0625)
          sDuration = "16th";
        else if (dDuration == 0.046875)
        {  sDuration = "32nd";
          bDotted = true;
        }
        else if (dDuration == 0.03125)
          sDuration = "32nd";
        else if (dDuration == 0.0234375)
        {  sDuration = "64th";
          bDotted = true;
        }
        else if (dDuration == 0.015625)
          sDuration = "64th";
        else if (dDuration == 0.01171875)
        {  sDuration = "128th";
          bDotted = true;
        }
        else if (dDuration == 0.0078125)
          sDuration = "128th";
        else sDuration = "/" + Double.toString(dDuration);
      Element elType = new Element("type");
      elType.appendChild(sDuration);
      elNote.appendChild(elType);
      //  dotted
      if (bDotted)
      {  Element elDot = new Element("dot");
        elNote.appendChild(elDot);
      }
      //  notations
      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");
        elTied.addAttribute(atStart);
        elNotations.appendChild(elTied);
      }
        elNote.appendChild(elNotations);
      }
View Full Code Here

   * @param partHeader is the array of <code>XMLpart</code> classes that stores
   * the <code>part-list</code> elements
   */
  private void parsePartHeader(Element part, XMLpart partHeader)
  {  //  ID
    Attribute ID = part.getAttribute("id");
    //  may be changed by midi-instrument below
    partHeader.ID = ID.getValue();
    //  part-name
    Element partName = part.getFirstChildElement("part-name");
    partHeader.part_name = partName.getValue();
    //  may or may not have 1 or more score-instrument and
    //  midi-instrument elements
View Full Code Here

        Element notations = note.getFirstChildElement("notations");
        if (notations != null)
        {   //  ties
          Element tied = notations.getFirstChildElement("tied");
          if (tied != null)
          {  Attribute tiedType = tied.getAttribute("type");
            String sTiedType = tiedType.getValue();
              if (sTiedType.compareToIgnoreCase("start") == 0)
                isStartOfTie = true;
              else if (sTiedType.compareToIgnoreCase("end") == 0)
                isEndOfTie = true;
            }
View Full Code Here

     
      String namespaceURI = reader.getAttributeNamespace(i);
      String value = reader.getAttributeValue(i);     
      Attribute.Type type = convertAttributeType(reader.getAttributeType(i));
     
      Attribute attr = nodeBuilder.createAttribute(qname, namespaceURI, value, type);
//      Attribute attr = new Attribute(qname, namespaceURI, value, type);
      elem.addAttribute(attr);
    }
  }
View Full Code Here

TOP

Related Classes of nu.xom.Attribute

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.