Package net.xoetrope.xml

Examples of net.xoetrope.xml.XmlElement


    if ( useValueAsId && ( source.getAttribute( "value" ) == null ))
      model.setAttribValue( model.getAttribute( "value" ), source.getAttribute( "id" ));

    // Add the children of the source element
    for ( int i = 0; i < numChildren; i++ ) {
      XmlElement ele = ( XmlElement )children.elementAt( i );
      Object elementName = ele.getAttribute( "id" );
      // Give a unique id for unnamed elements
      if (( elementName == null ) || ( elementName.toString().length() == 0 )) {
        if ( useValueAsId )
          elementName = ele.getAttribute( "value" );
        else {
          elementName = String.valueOf( getNextId() );
          hasAutoId = true;
        }
      }

      // Create a node/model for the child
      XModel childModel = (XModel)model.get( (String)elementName );
//      XModel childModel = ( XModel )model.append( ( String )elementName );

      // Allocate store for the child's children
      childModel.hasAutoId( hasAutoId );
      childModel.setNumChildren( Math.max( childModel.getNumChildren(), ele.getChildren().size() ) );

      // Recurse to add the childs details
      loadTable( ele, childModel );
    }
  }
View Full Code Here


   * @param model the model to write
   */
  public static void outputModel( Writer w, XModel model )
  {
    try {
      XmlElement topEle = XmlParserFactory.getInstance().createXmlElement( model.getTagName() );
      outputModel( topEle, model );
      //XmlWriter writer = XmlParserFactory.getInstance().getWriter( w );
      NanoXmlWriter writer = new NanoXmlWriter( w );
      writer.write( topEle, true, 2 );
    }
View Full Code Here

        }
      }
    }
    for ( int i = 0; i < model.getNumChildren(); i++ ) {
      XModel childModel = model.get( i );
      XmlElement newEle = parentEle.createElement( childModel.getTagName() );
      parentEle.addChild( newEle );
      outputModel( newEle, childModel );
    }
  }
View Full Code Here

   */
  public void read( Reader r )
  {
    names = new Vector();
    hotspots = new Vector();
    XmlElement element = XmlSource.read( r );
    if ( ( element == null ) || ( element.getChildren() == null ) )
      return;
    Enumeration e = element.getChildren().elements();
    while ( e.hasMoreElements() ) {
      XmlElement ele = (XmlElement)e.nextElement();
      if ( ele.getName().compareTo( "area" ) == 0 ) {
        Object name = ele.getAttribute( "name" );
        if ( name == null )
          names.addElement( "" );
        else
          names.addElement( ele.getAttribute( "name" ) );
        addHotspot( ele.getAttribute( "coords" ) );
        tooltips.addElement( ele.getAttribute( "tooltip" ) );
      }
      else
        addCustomHotspot( ele );
    }
  }
View Full Code Here

   */
  public void read( Reader r )
  {
    names = new Vector();
    hotspots = new Vector();
    XmlElement element = XmlSource.read( r );
    Enumeration e = element.getChildren().elements();
    while ( e.hasMoreElements() ) {
      XmlElement ele = ( XmlElement )e.nextElement();
      if ( ele.getName().compareTo( "area" ) == 0 ) {
        Object name = ele.getAttribute( "name" );
        if (name == null)
          names.addElement("");
        else
          names.addElement( ele.getAttribute( "name" ));
       
        addHotspot( ele.getAttribute( "coords" ));
      }
      else
        addCustomHotspot( ele );
    }
  }
View Full Code Here

   */
  public void read( Reader r )
  {
    names = new Vector();
    hotspots = new Vector();
    XmlElement element = XmlSource.read( r );
    if (( element == null ) || ( element.getChildren() == null ))
      return;

    Enumeration e = element.getChildren().elements();
    while ( e.hasMoreElements() ) {
      XmlElement ele = ( XmlElement )e.nextElement();
      Object name = ele.getAttribute( "name" );
      Object image = ele.getAttribute( "image" );
      if ( name == null )
        names.addElement( "" );
      else
        names.addElement( ele.getAttribute( "name" ).toString() );
      addHotspot( ele.getAttribute( "coords" ).toString(), image == null ? "" : image.toString() );
      handleElement( ele );
    }
  }
View Full Code Here

    XApplet so = new XApplet();
    XProject project = XProjectManager.getCurrentProject( so );
    XDataSource ds = new XDataSource( project );
    InputStream is = ds.getClass().getClassLoader().getResourceAsStream( "test/xui/data/people.xml" );

    XmlElement src = XmlSource.read( new BufferedReader( new InputStreamReader( is ) ) );
    src.setName( "people" );
    ds.loadTable( src, xBaseModel );

    xBaseModel.setId( "TextXBaseModel" );
    xBaseModel.setTagName( "TestNode" );
    xBaseModel.setNumAttributes( 3 );
View Full Code Here

TOP

Related Classes of net.xoetrope.xml.XmlElement

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.