|
Does anyone know of a good beautifier for XML that works with Visual Studio? Unfortunately, for now I am stuck with Visual C++ 6.0, but I would like to use it to edit XML, and most of the XML I am working with is poorly formatted (actually, all one line).
I guess a reasonable follow up question would be, does anyone know of a good XML editor (that doesn't cost much)? But I would really prefer to do my editing in Dev Studio, so a plugin is still preferable.
Thanks,
Cagey
|
|
|
|
|
Hi,
I don't know about a beautifier, but have a look at www.firstobject.com, there will be an inexpensive (no cost) xml editor.
Regards
G. Steudtel
|
|
|
|
|
|
|
Certainly not a plugin, though you could add it to your tools menu easily enough. This is what I use:
using System.IO;
using System.Xml;
class FormatXml {
static void Main(string[] args) {
XmlTextReader r = new XmlTextReader(args[0]);
XmlTextWriter w = new XmlTextWriter(new StreamWriter(args[1]));
r.WhitespaceHandling = WhitespaceHandling.None;
w.Formatting = Formatting.Indented;
w.Indentation = 1;
w.IndentChar = '\t';
w.QuoteChar = '\'';
w.WriteNode(r, false);
w.Close();
}
}
Adjust the Indentation, IndentChar and QuoteChar properties to match your tastes.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Frontpage 2003 (ick!) beautifies XML. It is a very poor XML editor though (no surprise eh?).
|
|
|
|
|
I have an XSLT transform that's used to transform an XML file into WebControl treenodes. I'm wanting to use script in the transform, but in order to do so, I have to import the xmlns:msxsl namespace.
When I do this, that namespace is also imported into the first <TREENODE> of the resulting XML. This causes the treeview webcontrol to give the error "The data at the root level is invalid.". How do I stop this namespace from being imported into the resulting XML?
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Use the exclude-result-prefixes attribute on the stylesheet.
(Replying to my own post again!)
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
My team and I are working with XML, and want to use the MSXML parser. I've heard that the MSXML parser only comes with IE5 and above. Is there a way to distribute it with your app, or download it separately from IE5/6? We don't want to have to have a certain version of IE be a requirement for the use of our library.
Thanks!
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
|
Thanks!
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
What could be wrong here??? I get the error "Invalid at the top level of the document"; however, loading the exact same text from a file using load() works!
CoInitialize();<br />
<br />
CComPtr< IXMLDOMDocument2 > pDocument;<br />
pDocument.CoCreateInstance( CLSID_DOMDocument40, NULL, CLSCTX_INPROC_SERVER );<br />
<br />
VARIANT_BOOL status;<br />
<br />
pDocument->loadXML( BSTR( "< ParticleSystem />" ), &status );
|
|
|
|
|
Without checking this out it may be because of the BSTR constructor you are using. BSTR's are unsigned short pointers, while you are passing in a const char* so a pointer cast is probably done (by the compiler) so two characters from your const char will be going into one character of the BSTR ie could be any character!! I suggest you try using CComBSTR, _bstr_t, or SysAllocString (and a matching free) to create your string to parse...
|
|
|
|
|
Thanks for your help. I finally found that my problem was a combination of two different problems.
1. Here was the real problem: I was loading (as binary) a Unicode file that has a BOM (byte-order mark) at the front of the file. Then I passed the text to loadXML. Apparently, loadXML can't handle Unicode special characters. I consider this a bug in loadXML.
2. In order to test loadXML, I was creating a BSTR like this:
BSTR( "< ParticleSystem />" );
Like you said, the constructor was not converting the string to a Unicode string as I expected it to do. loadXML was able to parse this:
BSTR( L"< ParticleSystem />" );
|
|
|
|
|
If it's any consolation, I've hit that first problem too. My solution was to provide an IStream implementation that ate the BOM from it's input if present; it used memory mapped files so didn't ever call ReadFile...
Steve S
|
|
|
|
|
|
Michael Dunn wrote:
Jambolo wrote:
BSTR( L"< ParticleSystem />" );
That is still not correct, you need to make a real BSTR or use a wrapper class like _bstr_t
Well, it worked just fine, so I'm not convinced. Regardless, I am using CComBSTR for the real code, but I will keep that in mind for next time.
|
|
|
|
|
Hi,
I've got an XML file which I want to read in vb.NET.
I've tryied with the XMLDocument object but it's not enough for what I want to do.
So now I want to read it as a dataset but I need an XML Schema.
So my question, is it possible to build an XLT file from an XML file ?
Thx
Sybux
|
|
|
|
|
Open your XML data file in Studio, you said you're using VB .NET so I have to assume your using Visual Studio here as well ... anyway, right-click and select the Create Schema option; this will build an XSD file from the XML file. Once you've done that, and the XSD is open in the editor, you can make changes as you see fit.
When your done with your changes to the XSD, right-click, select the Generate DataSet. Go to the form you want to use the DataSet on and drop a DataSet component on the form. From the typed drop-down list, select your XSD file and you're ready to go.
Hope this helps(?)
D.
|
|
|
|
|
I have an XML schema in a C# project in Visual Studio .NET and I want to populate a combobox using enumerations contained in the schema. Any ideas on how to do this ?
Thanks
PS : I am VERY new to C# and XML so take it easy ...
|
|
|
|
|
You can use XmlDataDocument class to impotr XML file to a DataSet and set the datasource of ComboBox with DataSet. I'm not sure what do you mean by enumeration in Schema?!
Hope it helps
Mazy
No sig. available now.
|
|
|
|
|
I want to convert a text based protocol into XML, using C#, how do I do that in the best maner ?
Can I use XSLT in any way ? or do I have to make an parser that converts the file manually ?
An example of the text file:
BORN ANTAL AXLAR = 220
VARMGÅNG
TJUVBROMS
TEST EFTER TÅG !!
FELKODER
W00 T02
VARMGÅNGS MÄTVÄRDEN ANTAL AXLAR = 220 TÅGRIKTNING = U
LH097 023 029 030 029 026 031 017 030 022 029 033 027 032 027 025 020 033 034 029 024 031 028 027 024 031 027 020 024 033 037 031 019 027 026 022 022 032 024 022 019 032 026 024 029 029 028 029 024 032 031 028 027 032 031 021 026 031 029 023 027 030 032 025 022 025 031 027 024 039 032 023 025 032 029 023 027 029 038 025 028 028 027 024 024 034 025 020 029 028 037 025 028 035 031 023 025 024 026 023 023 030 032 025 021 039 033 022 027 035 026 020 028 031 029 023 024 035 027 027 024 027 026 024 022 033 027 027 025 030 029 030 028 032 028 027 025 030 024 034 026 025 023 024 025 028 029 023 029 036 032 022 027 030 029 028 025 028 027 022 024 035 027 034 028 033 023 022 025 030 025 028 027 032 028 022 027 030 026 020 029 029 028 025 024 016 017 013 012 018 012 011 015 016 012 014 013 019 012 013 013 014 011 011 013 036 027 032 029 028 022 024 024 023 017 017 021 032 026 018 025 LV097 028 026 027 033 039 027 031 032 024 025 027 023 037 026 028 023 031 028 025 022 030 028 023 024 028 025 025 026 032 029 024 021 033 022 020 022 034 023 022 021 028 029 026 023 030 027 025 026 033 028 023 019 032 028 023 026 030 023 024 032 030 026 022 024 028 022 020 029 036 032 022 021 038 025 026 025 032 033 026 027 030 020 027 025 038 024 024 029 027 027 019 027 035 021 025 023 034 026 028 026 032 030 028 018 035 031 027 026 029 031 022 024 029 022 023 020 028 031 023 037 028 022 024 020 032 024 021 031 031 028 029 020 032 025 029 022 032 024 032 026 025 025 026 020 031 026 024 026 034 030 022 022 033 026 021 024 034 023 022 020 034 029 025 035 034 021 027 027 032 029 024 024 023 027 028 028 025 023 023 021 032 032 023 023 013 013 008 012 014 013 008 010 013 012 011 010 016 013 009 016 014 010 008 011 046 032 027 027 029 025 024 019 028 010 024 010 033 020 021 022
TJUVBROMS MÄTVÄRDEN
LÅGNIVÅ HS = 047
LÅGNIVÅ VS = 047
ANTAL AXLAR HS = 220
ANTAL AXLAR VS = 220 TÅGRIKTNING = U
TH 002 002 001 001 002 002 002 002 002 002 002 002 001 002 002 001 001 001 001 001 001 001 001 001 002 001 001 001 002 002 002 002 001 001 001 002 001 001 001 001 001 001 002 001 001 001 002 001 001 001 002 002 001 001 001 001 002 001 002 001 002 001 002 001 001 001 002 001 001 001 002 002 001 001 001 001 002 001 002 001 001 002 001 002 001 001 002 001 001 001 002 001 001 001 001 002 001 001 002 001 001 001 001 001 001 001 001 001 001 001 001 001 002 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 002 001 001 001 002 001 001 001 001 002 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 002 002 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 002 001 001 001 001 001 001 001 001 001 001 002 001 001 001 001 001 001 002 001 001 001 002 001 001 001 002 001 002 001 001 001 001 001 001 001 002 001 001 001 TV 001 001 002 001 002 001 003 002 002 002 003 001 003 003 002 001 001 001 003 003 001 001 001 002 003 002 001 001 001 003 003 002 001 001 002 003 002 001 001 001 002 002 002 001 001 002 003 002 001 001 001 002 002 001 001 001 003 002 001 001 002 002 002 001 001 001 003 002 001 001 002 003 001 001 001 001 003 001 001 001 003 003 002 001 002 003 002 001 001 001 002 002 001 001 003 003 001 001 002 003 001 001 001 002 002 001 002 001 002 001 001 001 003 002 001 001 002 003 001 001 001 002 002 001 001 002 003 001 001 001 003 002 001 001 003 003 001 001 002 003 001 001 002 002 001 001 002 003 001 001 002 002 001 001 002 003 001 001 001 003 002 001 002 002 002 001 001 002 002 001 001 001 002 001 002 001 002 001 001 001 002 001 001 001 002 002 002 002 002 001 002 003 001 001 002 003 001 001 002 002 001 001 002 002 001 001 003 002 001 002 002 002 001 001 002 001 002 002 001 001 <.
.
|
|
|
|
|
you have to read the text into your program and convert it into xml.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
now this is a REAL BIG problem
i'm using window XP (hope this is not the reason)
i cant create a file in my computer but it works on my school server
**********************************************
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set OutputXMLFile = fso.CreateTextFile("c:\xx.htm",true)
**********************************************
everytime i run this method my IE hang(???)
so, is it my IIS configuration problem or else
|
|
|
|
|
Set OutputXMLFile = fso.CreateTextFile(@"c:\xx.htm",true);
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|