/// <summary> /// Returns the URDF XML string representation of this model object. /// </summary> /// <returns>The URDF XML string representation of this model object</returns> public override string ToString() { XmlStringBuilder sb = new XmlStringBuilder(UrdfSchema.MESH_ELEMENT_NAME) .AddAttribute(UrdfSchema.FILE_NAME_ATTRIBUTE_NAME, this.FileName); if (this.Scale != DEFAULT_SCALE) { sb.AddAttribute(UrdfSchema.SCALE_ATTRIBUTE_NAME, this.Scale); } if (this.Size != null) { sb.AddAttribute(UrdfSchema.SIZE_ATTRIBUTE_NAME, this.Size); } return(sb.ToString()); }
public void AddAttributeTwice() { string expected = "<hello a=\"2\"/>"; XmlStringBuilder sb = new XmlStringBuilder("hello"); sb.AddAttribute("a", 1).AddAttribute("a", 2); Assert.AreEqual(expected, sb.ToString()); }
public void BuildXmlStringAttributesOnly() { string expected = "<hello a=\"b\" c=\"4\"/>"; XmlStringBuilder sb = new XmlStringBuilder("hello"); sb.AddAttribute("a", "b").AddAttribute("c", 4); Assert.AreEqual(expected, sb.ToString()); }
public void BuildXmlString() { string expected = "<hello a=\"b\">\r\n<subelement/>\r\n</hello>"; XmlStringBuilder sb = new XmlStringBuilder("hello"); sb.AddAttribute("a", "b").AddSubElement("<subelement/>"); Assert.AreEqual(expected, sb.ToString()); }
/// <summary> /// Returns the URDF XML string representation of this model object. /// </summary> /// <returns>The URDF XML string representation of this model object</returns> public override string ToString() { if (this.Equals(Origin.DEFAULT_ORIGIN)) { return(string.Empty); } XmlStringBuilder sb = new XmlStringBuilder(UrdfSchema.ORIGIN_ELEMENT_NAME); if (!this.Xyz.Equals(new XyzAttribute())) { sb.AddAttribute(UrdfSchema.XYZ_ATTRIBUTE_NAME, this.Xyz); } if (!this.Rpy.Equals(new RpyAttribute())) { sb.AddAttribute(UrdfSchema.RPY_ATTRIBUTE_NAME, this.Rpy); } return(sb.ToString()); }
/// <summary> /// Returns the URDF XML string representation of this model object. /// </summary> /// <returns>The URDF XML string representation of this model object</returns> public override string ToString() { XmlStringBuilder sb = new XmlStringBuilder(UrdfSchema.COLLISION_ELEMENT_NAME) .AddSubElement(this.Geometry.ToString()); if (this.Name != null) { sb.AddAttribute(UrdfSchema.NAME_ATTRIBUTE_NAME, this.Name); } if (!this.Origin.Equals(Origin.DEFAULT_ORIGIN)) { sb.AddSubElement(this.Origin.ToString()); } return(sb.ToString()); }