Re: writing xml files with a schema



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
>>
>>
>>
.



Relevant Pages

  • Re: writing xml files with a schema
    ... How would you place attributes of an element in the XML document??? ... Chris DeBoer wrote: ... >> To construct this in MATLAB, ... I can make a real nice schema in VS to verify my ...
    (comp.soft-sys.matlab)
  • Re: Maddening working with .NET/.XSDs
    ... When I generate a schema from a bit ... Just starting out messing with XML in .NET. ... <Chris xmlns="http://tempuri.org/Chris.xsd"</a>;> ... I'm presuming that it doesn't want to parse it because it's trying to ...
    (microsoft.public.dotnet.xml)
  • Re: how to return xml document from a web service
    ... what specific XML you expect. ... If you have a schema that defines what you expect, ... The second issue with this approach is that XML is not a string. ... >> methods from the wire transport. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • my first Tck/Tk program... and an XML question
    ... program which takes an XML Schema file, ... a basic XML tree and allows the user to save it. ... proc open_schema { ...
    (comp.lang.tcl)
  • RE: Data Insertion
    ... >The physical database structure is already in place. ... >I can determine the XML file and whether it contains a schema. ... In this particular case XML Schema is used to create a DataSet schema (set ... you're probably wondering how it's possible to load XML without XML ...
    (microsoft.public.dotnet.framework.compactframework)