Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 3749986

@User 3749986
About
Posts
3
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Xml special character
    U User 3749986

    pass each string in the following function, and you will always get the right result:

            Public Function MakeXMLString(ByVal text As String) As String
                text = text.Replace("&", "&")
                text = text.Replace("'", "'")
                text = text.Replace("""", """)
                text = text.Replace("<", "&lt;")
                text = text.Replace(">", "&gt;")
                Return text
            End Function
    

    good luck!

    XML / XSL html xml tutorial question

  • change attributes whitin XML
    U User 3749986

    Hello guys, I am having a problem with the order or the attributes with xml in vb. I get the following header:

    <?xml version="1.0" ?>

    • <tvtnl:spotPlanningFile xsi:schemaLocation="http://www.tvtimes.nl/sko/schema/20010910" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tvtnl="http://www.tvtimes.nl/sko/schema/20010910">

    and I need:

    <?xml version="1.0" ?>

    • <tvtnl:spotPlanningFile xmlns:tvtnl="http://www.tvtimes.nl/sko/schema/20010910" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.tvtimes.nl/sko/schema/20010910">

    notice the first and the last attribute.(they need to be switched) my code to come to this:

    Dim xmlDoc As New Xml.XmlDocument
    Dim xmlDeclaration As Xml.XmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0", "", "")

    'root
    Dim rootNode As Xml.XmlElement = xmlDoc.CreateElement("tvtnl", "spotPlanningFile", "http://www.tvtimes.nl/sko/schema/20010910")
    xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement)

    Dim att As Xml.XmlAttribute = xmlDoc.CreateAttribute("xsi:schemaLocation", "http://www.tvtimes.nl/sko/schema/20010910")
    att.Value = "http://www.tvtimes.nl/sko/schema/20010910"
    rootNode.SetAttributeNode(att)

    rootNode.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")

    xmlDoc.AppendChild(rootNode)

    what am i doing wrong? got any tips?? here is something i already tried:

                    Dim xmlDeclaration As Xml.XmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0", "", "")
    
                    'root
                    Dim rootNode As Xml.XmlElement = xmlDoc.CreateElement("tvtnl", "spotPlanningFile", "http://www.tvtimes.nl/sko/schema/20010910")
                    xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement)
    
    
                    'Dim xmlmanager As New Xml.XmlNamespaceManager(xmlDoc.NameTable)
                    'xmlmanager.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance")
    
                    Dim att As Xml.XmlAttribute = xmlDoc.CreateAttribute("xsi:schemaLocation", "http://www.tvtimes.nl/sko/schema/20010910")
                    att.Value = "http://www.tvtimes.nl/sko/schema/20010910"
                    rootNode.SetAttributeNode(att)
    
                    
                    'XmlAttribute att = doc.CreateAttribute("xsi", "noNamespaceSchemaLocation", "http://www.w3.org/2001/XMLSchema-instance");
                    'att.Value = "TestCaseSchema\_03.xsd";
    
    XML / XSL xml database help question announcement

  • XML serializition.
    U User 3749986

    Hello all, i'm making a dynamic light system, that contains scene's. A scene has a lamp (philips livingColor), min 1 max 8, and each lamp has its own platform. The save/edit a scene i am saving all data in the class Lamp (and motor) in a list . The struct: Color_point has string, int and a Color. However, if i want to serialise the class, i wont get a color in the xml. I know this is an private attribute, so i wont get something back. And I already read some more about making a different struc tfor the color. But.. how? See Code:

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Drawing;
    using System.Collections;
    using System.Collections.Specialized;
    using System.Xml.Serialization;

    namespace Light
    {
    [Serializable()]
    public struct Color_Point
    {
    public string Name;
    public int Time;
    public Color Rgb;

        public Color\_Point(string name, int time, Color rgb)
        {
            Name = name;
            Time = time; //in ms
            Rgb = rgb;
        }
    
    }
    \[Serializable()\]
    public class Lamp
    {
        public int address;
        public Color current\_Color;
        public Color previous\_Color;
        public List<Color\_Point> list = new List<Color\_Point>();
    
        public Lamp()
        {
            address = 0;
        }
    
          
    
        public void setColor(Int32 time, Color rgb, string name)
        {
            int correct\_time = 0;
            if (name != "Fade")
            {
                if (list.Count == 0)
                    list.Add(new Color\_Point(name, 0, rgb));
                else
                {
                    correct\_time = getTime("btnColor" + LastNumber()) + time;
                    
                    list.Add(new Color\_Point(name, correct\_time, rgb));
                    
                }
                }
            else 
                list.Add(new Color\_Point(name, time, rgb));
            
        }
    

    How can i make sure that i also save the Colors?? Thank you!

    .NET (Core and Framework) question lamp graphics xml json
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups