Need to load XSD



  • Hi All

    I wanted to load new XSD in to the xml file.

    I am just open the xml and validate, but there is no pop up showing to load new XSD.

    Can anyone advise on this?

    ganesang



  • @ganesan-govindarajan

    This is not really a Notepad++ related question…



  • @ganesan-govindarajan Maybe you want to check N++ plugin XML Tools, see https://github.com/morbac/xmltools



  • @chcg

    Thanks for the reply.

    I have already installed the XML tool plugin but my concern is when i open the new XML file which is different schema (XSD) than previous file and there is no pop-up show to load new schema file in Notepad++.



  • I don’t use XML (and thus XML Tools), so I’m not an expert on such things… But a quick google found https://stackoverflow.com/a/30167471/5508606, which claims that Plugins > XML Tools > Validate Now should pop up a window asking for where the XSD is. Does the procedure shown on Stack Overflow not work for you? If not, what does happen?

    As a test, I just grabbed the XML example from https://www.w3schools.com/xml/schema_example.asp, and when I tried to validate it, it said “Failed to locate the main schema resource at ‘shiporder.xsd’” – which was defined with the xsi:noNamespaceSchemaLocation. If I remove that from the <shiporder ...> tag, then when I try to validate, it asks me for the location. So my conclusion is that XML Tools will only ask you for the schema location if it’s not embedded in the XML itself; if it is embedded, it will automatically use the one it finds. (It even says that in the dialog: “This dialog box is displayed because the default validation schema cannot be found in XML root element. To avoid having to specify the XSD for every validation, please define the default XML schema in your root element using the following syntax: …, where XSD_FILE_PATH is the relative or absolute path of the XML schema file.”)

    If this doesn’t happen for you, give us a brief example XML and XSL that shows the problem. To embed the files in your reply, put 4 spaces before each row, and a blank line before and after, shown below.

    ----------

    Formatting / Rendering Example

    
    **XML**
    
        <?xml version="1.0" encoding="UTF-8" ?>
        <shiporder ...
        ...
        </shiporder>
    
    **XSD**
    
        <?xml version="1.0" encoding="UTF-8" ?>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
        ...
        </xs:schema> 
    
    

    which will render like

    XML

    <?xml version ...
    <shiporder ...
    

    XSD

    <?xml version="1.0" encoding="UTF-8" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    ...
    </xs:schema>


  • PS: also look at Plugins > XML Tool > About XML Tools, and include your version of XML Tools. Also go to ? > Debug Info > Copy debug information to clipboard and paste in your reply. These will let us know the particulars of which Notepad++ and XML Tools, so we can try to better replicate your circumstances.


Log in to reply