[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
RE: [xml-dev] Need some advice from an XML expert
- From: "Michael Kay" <mike@saxonica.com>
- To: "'J Siatkowski'" <jason.siatkowski@gmail.com>,<xml-dev@lists.xml.org>
- Date: Tue, 20 Mar 2007 17:14:51 -0000
>
> For one, I'm not happy with the fact that the xml file needs
> so much information regarding namespaces.
>
> This is what the top section of my XML file looks like:
>
> <?xml version="1.0" encoding="utf-8"?>
> <n:Transactions
> xmlns:n="dsTransaction"
> xmlns:mstns="http://tempuri.org/dsTransaction.xsd"
> xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
> xmlns:codegen="urn:schemas-microsoft-com:xml-msprop"
> xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
> xs:schemaLocation="dsTransaction.xsd">
>
> I don't see why the customers should have to include this
> stuff in their files.
They don't have to. The only namespace actually used is
xmlns:n="dsTransaction", so that's the only one that needs to be declared.
(It's not a good choice of namespace URI, however. You should really make it
an absolute URI and try to make it globally unique.)
>
> It seems to me that when the file is uploaded, I should be
> able to validate the file against any schema I like. Does
> this sound right?
Yes, you can apply any schema you like. Though of course you can't expect to
get the answer "valid" if you validate against a schema that the instance
doesn't conform to.
> Could I take an XML file that looks like this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <WireTransfers>
> <WireTransfer>
> <Value_Date>2007-02-15</Value_Date>
> <Amount>22222.33</Amount>
> <Bank_Action>R</Bank_Action>
> <Date_Blocked_Rejected>2007-02-15</Date_Blocked_Rejected>
> <Wire_Transfer_Transaction_Type>Bank to
> Bank</Wire_Transfer_Transaction_Type>
> <other elements>
> </WireTransfer>
> </WireTransfers>
>
> And then validate it against my schema?
You can validate it, and validation will fail, because your schema says that
the element must have a name whose namespace URI is "dsTransaction". You
don't need to define a target namespace in your schema (though I would
recommend it), but if the schema defines a target namespace then the users
must use it. Rules is rules.
Michael Kay
http://www.saxonica.com/
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]