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
  1. Home
  2. General Programming
  3. XML / XSL
  4. Please help in XMLReader of c#.NET

Please help in XMLReader of c#.NET

Scheduled Pinned Locked Moved XML / XSL
csharphelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hemendravyas
    wrote on last edited by
    #1

    I'm using .net 1.1 Now I have tried with the code: System.Text.ASCIIEncoding encoder=new System.Text.ASCIIEncoding(); byte bytes=encoder.GetBytes(p_strXmlFrag); //Here its giving error MemoryStream ms=new MemoryStream(bytes); XmlWriter writer=XmlWriter.Create(ms); //Here it could not find create method ms.Position=0; XmlTextReader.xmlFile=new XmlTextReader(ms); ---- ---- ---- ---- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ I'm also pasting the total method code to make it clear: public static bool Validate(string p_strMmlFrag, out string p_strErr) { p_strErr=string.Empty; //starting of if statement if m_xsc==null) { m_xsc=new XmlSchemaCollection(); try { string path=AppDomain.CurrentDomain.BaseDirectory+m_strSchema; if (!File.Exists(path)) { path=AppDomain.CurrentDoamin.BaseDirectory+"/bin"+m_strSchema; } XmlTextReader xmlFile=new XmlTextReader(path); m_ifSchema=XmlSchema.Read(xmlFile, new ValidationEventHandler (ValidationCallBack)); //Error rises in the above line as the destination file path (stored in path variable), I have just created (the file) and it's definitely empty. I tried the above mentioned solution but it's giving error!!!!!!!! m_xsc.Add(m_ifSchema); } // ending of if statement catch { ----- } ------- ------ ------- ------ private const string m_strSchema="StructureLinkage.xsd" private static XmlSchemaCollection=m_xsc; private static XmlSchema m_ifSchema; // For the first time only m_xsc in null and after that it does not need to enter into above block of code once m_xsc is instantiated. }

    S 1 Reply Last reply
    0
    • H hemendravyas

      I'm using .net 1.1 Now I have tried with the code: System.Text.ASCIIEncoding encoder=new System.Text.ASCIIEncoding(); byte bytes=encoder.GetBytes(p_strXmlFrag); //Here its giving error MemoryStream ms=new MemoryStream(bytes); XmlWriter writer=XmlWriter.Create(ms); //Here it could not find create method ms.Position=0; XmlTextReader.xmlFile=new XmlTextReader(ms); ---- ---- ---- ---- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ I'm also pasting the total method code to make it clear: public static bool Validate(string p_strMmlFrag, out string p_strErr) { p_strErr=string.Empty; //starting of if statement if m_xsc==null) { m_xsc=new XmlSchemaCollection(); try { string path=AppDomain.CurrentDomain.BaseDirectory+m_strSchema; if (!File.Exists(path)) { path=AppDomain.CurrentDoamin.BaseDirectory+"/bin"+m_strSchema; } XmlTextReader xmlFile=new XmlTextReader(path); m_ifSchema=XmlSchema.Read(xmlFile, new ValidationEventHandler (ValidationCallBack)); //Error rises in the above line as the destination file path (stored in path variable), I have just created (the file) and it's definitely empty. I tried the above mentioned solution but it's giving error!!!!!!!! m_xsc.Add(m_ifSchema); } // ending of if statement catch { ----- } ------- ------ ------- ------ private const string m_strSchema="StructureLinkage.xsd" private static XmlSchemaCollection=m_xsc; private static XmlSchema m_ifSchema; // For the first time only m_xsc in null and after that it does not need to enter into above block of code once m_xsc is instantiated. }

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      You already got an answer for this question in the C# forum (answer[^]). Instead of simply reposting the question in another forum, you should try to understand what you were told in the answer and work with that info.


      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

      www.troschuetz.de

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

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