retro-starr Posted February 11, 2011 Share Posted February 11, 2011 I have an XML file that I need newlines for each entry between two tags. This is an example of what it looks like: <notes> blah1 blah2</notes> I don't do anything fancy except drag the file into a new tab in Firefox. In Firefox the output looks like: blah1 blah2This is not something I want. I tried using <![CDATA[ ]]>, but that didn't do anything. Link to comment Share on other sites More sharing options...
Ingolme Posted February 12, 2011 Share Posted February 12, 2011 It looks like your file is being interpretted as HTML.Be sure to put an XML declaration at the top: <?xml version="1.0" encoding="UTF-8" ?> Link to comment Share on other sites More sharing options...
jeffman Posted February 12, 2011 Share Posted February 12, 2011 That was my thought at first, but when I opened a file that Firefox does recognize as XML, it did its "XML Thing" (does it have a name?) and sure enough newlines were displayed as a spaces. It's kind of an outliner/interpreter. You can load a file with no whitespace, and it pretty-prints it so you can see the structure.Anyway, Firefox seems to use its own rules for pretty-printing. There is probably no way to change this behavior. Link to comment Share on other sites More sharing options...
boen_robot Posted February 12, 2011 Share Posted February 12, 2011 It doesn't matter how Firefox pretty prints your XML file. The only thing that really matters is if it's parsing it correctly.You can find out by actually trying to put this contents in a place where this will make a difference... say, as the contents of a <pre> element on an HTML page for example. Try it. I'm sure you'll find out the new lines are OK. Link to comment Share on other sites More sharing options...
jeffman Posted February 12, 2011 Share Posted February 12, 2011 I think the big question is what retro-starr is trying to accomplish. Link to comment Share on other sites More sharing options...
retro-starr Posted February 13, 2011 Author Share Posted February 13, 2011 I have a passwd.xml that I made so I take it a step further on the web and do some cool things with it. First of which is figure out how to decrypt the file (using gpg), then display it securely. From there I want to do something fancy like make a UI to add entries to the file and lastly secure it again when done. Maybe I could start a new thread to get help on that? Link to comment Share on other sites More sharing options...
boen_robot Posted February 13, 2011 Share Posted February 13, 2011 The very fact the XML is publically visible (even if in an encrypted state) is probably bad for security on the first place.Assuming you make sure the file is only visible to the server itself, and not to clients, consider encrypting only the different contents (text nodes), not the whole file itself. Why? So that each password can be encrypted and decrypted independantly.You can manipulate XML files with PHP by using DOM which is similar to the one in JavaScript. Link to comment Share on other sites More sharing options...
retro-starr Posted February 16, 2011 Author Share Posted February 16, 2011 That sounds interesting, how is XML publically visible when still encrypted? Link to comment Share on other sites More sharing options...
boen_robot Posted February 16, 2011 Share Posted February 16, 2011 That sounds interesting, how is XML publically visible when still encrypted?When something is encrypted, it essentially means "gibberish" to the naked eye (and program), and for it to be turned into something readable, it needs to be decrypted by the use of a "key" (sort of a "password" if you will).But when you see gibberish that you know to be encrypted text, nothing stops you from trying out every possible key in an attempt to get something readable. A wrong password will produce more gibberish, so you can rest assure that if the XML is parseable, the key was correct. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.