Import XSD for autocompletion when Writing XML

Questions about XML that are not covered by the other forums should go here.
LMCGIB10
Posts: 6
Joined: Wed Feb 15, 2012 5:45 pm

Import XSD for autocompletion when Writing XML

Post by LMCGIB10 »

Hi,
Addmitedly, I've been away from oXygen for a while and have forgotten a basic of XML authoring.
I'm looking to import my schema as follows

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<akomaNtoso xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:SchemaLocation="http://docs.oasis-open.org/legaldocml/ns/akn/3.0/CSD01 ./akomantoso20.xsd">
<tag1FromXSD>
</tag1FromXSD>
<lotsMoreTags>
</lotsMoreTags>
...

</akomaNtoso>
Please note that the online schemaLoction does NOT exist yet, however I have it available locally e.g. in the same directory as the XML I am authoring.
I would therefore like to have elements autocomplete whenever I try to open a new tag e.g. <tag1FromXSD>. This should be picked up from the XSD within the same directory.

How do I do this?
Sorry for real basic question.
Thank you very much for the help if it is available.
Lewis
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Import XSD for autocompletion when Writing XML

Post by adrian »

Hi,

The most significant issue with this is that XML is case sensitive, so xsi:SchemaLocation won't work. It has to be xsi:schemaLocation (note the lowercase 's'). You'll also need to declare the default namespace: xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0/CSD01" (assuming that this is the target namespace of the schema).

However, it's a lot easier to just use Oxygen's Associate Schema action (Document > Schema > Associate Schema or the corresponding toolbar button), pick your XML schema file, and it will do all this for you.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
LMCGIB10
Posts: 6
Joined: Wed Feb 15, 2012 5:45 pm

Re: Import XSD for autocompletion when Writing XML

Post by LMCGIB10 »

Hi Adrian,
This is exactly what I was looking for.
oXygen 14.1 is well and truly a bt above the rest.
I am gutted I won't be at XMLPrague again this year :0(
Thank you very much for your help, have a great day.
Lewis
Post Reply