Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    52

    [C#]Creazione XML con tag particolare

    Buongiorno a tutti!

    Sto cercando di gererare un file xml con XMLDocument.
    Quando cerco di creare un tag del tipo <georssoint>, la libreria crea il tag <point>, eliminado il prefisso "georss".

    Posto il codice:

    codice:
    XmlDocument xDoc = new XmlDocument();
    XmlDeclaration xDecl = xDoc.CreateXmlDeclaration("1.0", System.Text.Encoding.UTF8.WebName, null);
    xDoc.AppendChild(xDecl);
    
    XmlElement xRoot = xDoc.CreateElement("", "rss", "");
    xDoc.AppendChild(xRoot);
    
    XmlElement xElemChannel = xDoc.CreateElement("channel");
    xRoot.AppendChild(xElemChannel);
    
    XmlElement xElemTitle = xDoc.CreateElement("title");
    xElemTitle.InnerText = "Titolo del file 1";
    xElemChannel.AppendChild(xElemTitle);
    
    XmlElement xElemItem = xDoc.CreateElement("item");
    xElemChannel.AppendChild(xElemItem);
    
    XmlElement xElemTitleItem = xDoc.CreateElement("title");
    xElemTitleItem.InnerText = "TITOLO";
    xElemItem.AppendChild(xElemTitleItem);
    
    XmlElement xElemIcon = xDoc.CreateElement("icon");
    xElemIcon.InnerText = "./img/poligono5.jpg";
    xElemItem.AppendChild(xElemIcon);
    
    //XmlElement xElemGeorss = xDoc.CreateElement("georss", "point", "");
    xElemGeorss = xDoc.CreateElement("georss:point");
    string coordinate = "...";
    xElemGeorss.InnerText = coordinate;
    xElemItem.AppendChild(xElemGeorss);
    
    Response.Clear();
    Response.ContentType = "text/xml";
    xDoc.Save(Response.OutputStream);            
    Response.End();
    Come posso creare il tag <georssoint> ?

    Grazie mille
    ******************************

    Attenti al cane....

    è fuggito!

    ******************************

  2. #2
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    52
    Nessuno??
    Se non si è capito bene dalla mia descrizione, quando cerco di aggiungo questo tag
    codice:
    xElemGeorss = xDoc.CreateElement("georss:point");
    viene aggiunto questo
    codice:
    <point>
    ******************************

    Attenti al cane....

    è fuggito!

    ******************************

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.