Re: writing xml files with a schema
- From: ryan <ryan.kelly@xxxxxxxxxxxx>
- Date: Fri, 21 Oct 2005 09:04:35 -0400
How would you place attributes of an element in the XML document???
such as
<bike type="huffy">
<color>red</color>
...
...
<bike>
ryan
Chris DeBoer wrote:
>
>
> Karl,
>
> Thanks a lot. I think that will do the trick!
>
> Chris
>
> Karl Critz wrote:
>>
>>
>> There is a pretty good article online about how to use schemas.
>> Check out:
>>
>> <http://www.w3schools.com/schema/schema_howto.asp>
>>
>> This is their example on what a document using schemas looks
> like:
>>
>> ------------------------
>> <?xml version="1.0"?>
>> <note xmlns="http://www.w3schools.com"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://www.w3schools.com/note.xsd">
>>
>> <to>Tove</to>
>>
>> <from>Jani</from>
>>
>> <heading>Reminder</heading>
>>
>> <body>Don't forget me this
> weekend!</table></table></body>
>>
>> </note>
>> -----------------
>>
>> To construct this in MATLAB, you would do something like:
>>
>> docNode = com.mathworks.xml.XMLUtils.createDocument('note');
>> docRootNode = docNode.getDocumentElement;
>> docRootNode.setAttribute('xmlns','http://www.w3schools.com');
>> docRootNode.setAttribute('xmlns:xsi','http://www.w3.org/2001/XMLSchema-instance');
>> docRootNode.setAttribute('xsi:schemaLocation','http://www.w3schools.com/note.xsd');
>>
>> toElement = docNode.createElement('to');
>> docRootNode.appendChild(toElement);
>> toElement.appendChild(docNode.createTextNode('Tove'));
>>
>> %the rest is left as an exercise for the reader
>>
>> -karl
>>
>>
>> "Chris DeBoer" <christopher_c_deboer@xxxxxxxxxxxxx> wrote
> in
>> message
>> news:ef01866.-1@xxxxxxxxxxxxxxxxxxx
>>> I'm trying to write an xml file from matlab to be read in
by
>> Visual
>>> Studio. I can make a real nice schema in VS to verify my
data
> and
>>> ease data access but I don't know how to use that schema as
I
>> create
>>> the xml file in matlab.
>>>
>>> I'm writing the file with the java class included in Matlab
> but
>> it
>>> seems to change the order of attributes and things when I
> enter
>> them.
>>>
>>> Here are the first few lines of the xmlwrite example:
>>>
>>> docNode = com.mathworks.xml.XMLUtils.createDocument...
>>> ('root_element')
>>> docRootNode = docNode.getDocumentElement;
>>>
>>> What in the world is the com.mathworks.xml.XMLUtils class?
> Are
>> there
>>> other methods that include a schema?
>>>
>>> I may just need to know the correct method from the java
> class.
>>>
>>> Any help would be great!
>>> Thanks, Chris
>>
>>
>>
.
- Prev by Date: Re: Problems in printing (standalone GUI)
- Next by Date: Re: writing xml files with a schema
- Previous by thread: Adding a Block into a Blockset Library
- Next by thread: Re: writing xml files with a schema
- Index(es):
Relevant Pages
|