Search code examples
xmllocationdirectorypath-finding

Can't access other folders/directories with my XML program


So right now I'm trying to access a certain file automatically through the browse function on my computer. This is what I have so far, but it only keeps me within the same folder as my file is in. How would I access another folder with this:

<SupportedDevices>
  <Device VID="0x1234" PID="0x0001">
    <Firmware MajorVersion="1" MinorVersion="00">filename.bin</Firmware>
  </Device>
  <Device VID="0x1234" PID="0x0002">
    <Firmware MajorVersion="1" MinorVersion="01"> filename1.bin</Firmware>
  </Device>
</SupportedDevices> 

The filename.bin is one of the files I am trying to access but it only keeps me within the same folder.

I've tried a few other methods of getting it to get out of the folder but to no avail.


Solution

  • XML is not a program but a format; it has no way to access files. (Well, there are entities for including files into the XML, but those aren't in play here.)

    Applications that use XML can access files specified in XML, but the notation required will be constrained by the application, not by XML.

    Ideally, you'd consult with the documentation for the application using the XML. Or, you could state the application in your question, and someone might know the format expected by the application. Failing that, you might try:

    1. file:///c:/path/to/filename.bin (Remove c:/ if not on DOS/Windows.)
    2. c:/path/to/filename.bin (Remove c: if not on DOS/Windows.)
    3. ../relative_path/to/filename.bin
    4. In any of the above, replace / (Unix path separator) with \ (DOS/Windows path separator). This is unlikely to be the issue, though, because most XML-based apps work with / path separators.

    Finally, see also Still not working? in How to reference a local xml schema file correctly? for a technique for using a browser to catch simple mistakes somewhere along the directory path.